unit DummyCube;

interface   

uses
  _Geometry,
  Frost.Engine,
  Frost.GL,
  Frost.Renderers;

type
  TDummyCube = class(TComponent)
    private               
      class var FMesh: TMesh;
      FSize: Single;
      procedure OnStart; override;
    public                                                         
      constructor Create(); overload;
      constructor Create(Parent: TGameObject; Size: Single = 1); overload;
  end;

implementation

{$REGION 'Dummy'}
constructor TDummyCube.Create(Parent: TGameObject; Size: Single = 1);
begin
  FSize := Size;
  SetGameObject(Parent);
end;

constructor TDummyCube.Create();
begin
  FSize := 1;
end;

procedure TDummyCube.OnStart;
var
   MeshRenderer: TMeshRenderer;
begin
  if FMesh = nil then
    FMesh := TMesh.CreateCube(FSize);
  MeshRenderer := TMeshRenderer.Create(GameObject);
  MeshRenderer.Mesh := FMesh;
  MeshRenderer.Material := TDummyMaterial.Create;
end;
{$ENDREGION}

end.
