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; {$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
uses Gorilla.Capsule; [...] begin FCapsule:= TGorillaCapsule.Create(GorillaViewport1); FCapsule.Parent := GorillaViewport1; {$IFDEF MSWINDOWS} /// create a very detailled capsule. FCapsule.Radius := 0.35; FCapsule.Segments := 128; FCapsule.Rings := 64; {$ELSE} /// on Android platform number of vertices is limited to 32K. FCapsule.Radius := 0.25; FCapsule.Segments := 32; FCapsule.Rings := 8; {$ENDIF} /// make it larger FCapsule.SetSize(2.75, 2, 2.75); /// to forbid mouse interaction FCapsule.SetHitTestValue(false); end;
TGorillaPlane
uses Gorilla.Plane; [...] begin FPlane:= TGorillaPlane.Create(GorillaViewport1); FPlane.Parent := GorillaViewport1; /// placing it as floor FPlane.RotationAngle.X := -90; {$IFDEF MSWINDOWS} /// create a very detailled plane. FPlane.SubdivisionsHeight := 128; FPlane.SubdivisionsWidth := 128; {$ELSE} /// on Android platform number of vertices is limited to 32K. FPlane.SubdivisionsHeight := 16; FPlane.SubdivisionsWidth := 16; {$ENDIF} /// make it larger FPlane.SetSize(10, 5, 0.1); /// to forbid mouse interaction FPlane.SetHitTestValue(false); end;
TGorillaCone
uses Gorilla.Cone; [...] begin FCone := TGorillaCone.Create(GorillaViewport1); FCone.Parent := GorillaViewport1; FCone.TopRadius := 0.01; FCone.BottomRadius := 2; /// create a cone with more detail {$IFDEF MSWINDOWS} /// create a very detailled cone. FCone.Sides := 128; FCone.HeightSegments := 128; {$ELSE} /// on Android platform number of vertices is limited to 32K. FCone.Sides := 32; FCone.HeightSegments := 1; {$ENDIF} /// make it larger FCone.SetSize(2, 2, 2); /// to forbid mouse interaction FCone.SetHitTestValue(false); end;
TGorillaTube
TGorillaTorus
TGorillaGrid3D