unit uPlants;

interface

uses
  uGlobal;

function model_cactus(Params: array of variant): variant; stdcall;

implementation

function model_cactus(Params: array of variant): variant; stdcall;
var
  P, R, S: array of Double;

  //Base
  BaseRoot, Base, trunk: integer;
begin
  SetLength(P, 3);
  SetLength(R, 3);
  SetLength(S, 3);
  P[0]:=0;  P[1]:=0;  P[2]:=0;
  R[0]:=0;  R[1]:=0;  R[2]:=0;
  S[0]:=1;  S[1]:=1;  S[2]:=1;

  //Init POA-Animated Object
  Result:=call('POAAdd',[]);
  call('POAFrames',[Result, 0]);

  P[0]:=0;  P[1]:=0;  P[2]:=0;
  BaseRoot:=call('POAObjectAdd',[Result, otRoot, P,R,S]);
  if length(Params)>0 then call('glObjectParent', [call('poaObjectID', [Result, BaseRoot]), call('poaObjectID', [Params[0], 0])]);

  //=============
  P[0]:=0;  P[1]:=-14;  P[2]:=0;
  R[0]:=0;  R[1]:=0;  R[2]:=90;
  S[0]:=0.3;  S[1]:=0.3;  S[2]:=0.3;
  Base:=call('POAObjectAdd',[Result, otModel, P,R,S, 'data/models/cactus.3ds']);
//  call('glObjectParams', [call('poaObjectID', [Result, Base]), 'data/models/cactus.3ds']);
  call('glObjectParent', [call('poaObjectID', [Result, Base]), call('poaObjectID', [Result, BaseRoot])]);

  call('POAReset',[Result]);

end;

end.
