This is an old revision of the document!


Primitives

Due to performance optimization Gorilla3D introduces their own primitive models. Default FireMonkey primitives TCube, TSphere, TPlane and TCylinder are still supported, but they reduce render speed a lot when there is used large subdivisioning by the user.

A sphere could reach an enormous amount of vertices, when subdivision is set to high values. Each time the sphere gets rendered, all those vertices are transfered to GPU.

To solve this problem, the Gorilla3D primitives TGorillaCube, TGorillaSphere, TGorillaCylinder and TGorillaPlane are inherited from TGorillaMesh and are able to use static framebuffers for fast rendering.

Static framebuffers will only push vertex data once to the GPU and render the elements only by switching to the framebuffer.

Supported primitives

TGorillaCube

uses
  Gorilla.Cube;
 
[...]
begin
  FCube := TGorillaCube.Create(GorillaViewport1);
  FCube.Parent := GorillaViewport1;
 
  /// increase the number vertices, but in many cases subdivisions of 1 are enough for a cube.
{$IFDEF MSWINDOWS}
  /// only on window platform a large number of vertices.
  FCube.SubdivisionsDepth := 128;
  FCube.SubdivisionsHeight := 128;
  FCube.SubdivisionsWidth := 128;
{$ELSE}
  // Android platform is limited to 32K vertices for meshes.
  FCube.SubdivisionsDepth := 32;
  FCube.SubdivisionsHeight := 32;
  FCube.SubdivisionsWidth := 32;
{$ENDIF}
 
  /// make it larger
  FCube.SetSize(2, 2, 2);
 
  /// to forbid mouse interaction use:
  FCube.SetHitTestValue(false);
end;

TGorillaSphere

uses
  Gorilla.Sphere;
 
[...]
 
begin
  FSphere := TGorillaSphere.Create(GorillaViewport1);
  FSphere.Parent := GorillaViewport1;  
 
  /// create a sphere with more detail
{$IFDEF MSWINDOWS}
  /// create a very detailled sphere.
  FSphere.SubdivisionsAxes := 128;
  FSphere.SubdivisionsHeight := 128;
{$ELSE}
  /// on Android platform number of vertices is limited to 32K.
  FSphere.SubdivisionsAxes := 32;
  FSphere.SubdivisionsHeight := 32;
{$ENDIF}
 
  /// make it larger
  FSphere.SetSize(2, 2, 2);
 
  /// to forbid mouse interaction
  FSphere.SetHitTestValue(false);
end;

TGorillaCylinder

uses
  Gorilla.Cylinder;
 
[...]
 
begin
  FCylinder:= TGorillaCylinder.Create(GorillaViewport1);
  FCylinder.Parent := GorillaViewport1;  
 
  /// create a cylinder with more detail
{$IFDEF MSWINDOWS}
  /// create a very detailled cylinder.
  FCylinder.SubdivisionsAxes := 128;
  FCylinder.SubdivisionsCap := 32;
  FCylinder.SubdivisionsHeight := 32;
{$ELSE}
  /// on Android platform number of vertices is limited to 32K.
  FCylinder.SubdivisionsAxes := 32;
  FCylinder.SubdivisionsCap := 1;
  FCylinder.SubdivisionsHeight := 1;
{$ENDIF}
 
  /// make it larger
  FCylinder.SetSize(2, 2, 2);
 
  /// to forbid mouse interaction
  FCylinder.SetHitTestValue(false);
end;

TGorillaCapsule

TGorillaPlane

TGorillaCone

TGorillaTube

TGorillaTorus

TGorillaGrid3D

TGorillaModel

For detailled reading on loading models, please have a closer look here.

Next step:: Terrain