Primitives

Gorilla3D includes a comprehensive set of built-in primitive shapes for creating procedural geometry. These primitives can be used for prototyping, level design, visual effects, and as building blocks for more complex objects.

Table of Contents

Overview

All primitives inherit from TCustomMesh or TGorillaMesh and can be placed at design-time or created at runtime. They generate their own mesh geometry automatically.

Primitive Unit Description
Cube Gorilla.Cube Box / rectangular prism
Sphere Gorilla.Sphere UV sphere
Cylinder Gorilla.Cylinder Cylinder with caps
Cone Gorilla.Cone Cone with base
Capsule Gorilla.Capsule Cylinder with hemispherical ends
Hemisphere Gorilla.Hemisphere Half sphere
Torus Gorilla.Torus Donut shape
Disk Gorilla.Disk Flat circular disk
Plane Gorilla.Plane Flat rectangular plane
Tube Gorilla.Tube Hollow cylinder
RoundCube Gorilla.RoundCube Cube with rounded edges
ExtrudedMesh Gorilla.ExtrudedMesh Shape from extruded 2D profile
ProfileMesh Gorilla.ProfileMesh Shape from swept profile
GearMesh Gorilla.GearMesh Gear/cog shape
Grid Gorilla.Grid Visual grid overlay
Layers Gorilla.Layers Layer management
SkyBox Gorilla.SkyBox Sky dome / skybox
Volumetric Mesh Gorilla.Volumetric.Mesh Volumetric rendering mesh
Volumetric Noise Gorilla.Volumetric.Noise Noise-based volumetric effects

Basic Shapes

Cube

uses Gorilla.Cube;

var Cube := TGorillaCube.Create(Self);
Cube.Parent := GorillaViewport1;
Cube.Position.Point := Point3D(0, -1, 0);
Cube.Width := 2;
Cube.Height := 2;
Cube.Depth := 2;

Sphere

uses Gorilla.Sphere;

var Sphere := TGorillaSphere.Create(Self);
Sphere.Parent := GorillaViewport1;
Sphere.Width := 2;
Sphere.Height := 2;
Sphere.Depth := 2;

Cylinder

uses Gorilla.Cylinder;

var Cyl := TGorillaCylinder.Create(Self);
Cyl.Parent := GorillaViewport1;
Cyl.Width := 1;
Cyl.Height := 3;
Cyl.Depth := 1;

Cone

uses Gorilla.Cone;

var Cone := TGorillaCone.Create(Self);
Cone.Parent := GorillaViewport1;
Cone.Width := 2;
Cone.Height := 3;

Capsule

A cylinder with hemispherical caps — ideal for character colliders.

uses Gorilla.Capsule;

var Caps := TGorillaCapsule.Create(Self);
Caps.Parent := GorillaViewport1;
Caps.Width := 1;
Caps.Height := 2;

Hemisphere

uses Gorilla.Hemisphere;

var HS := TGorillaHemisphere.Create(Self);
HS.Parent := GorillaViewport1;
HS.Width := 2;
HS.Height := 1;

Torus

uses Gorilla.Torus;

var Torus := TGorillaTorus.Create(Self);
Torus.Parent := GorillaViewport1;
Torus.Width := 3;
Torus.Height := 3;

Disk

uses Gorilla.Disk;

var Disk := TGorillaDisk.Create(Self);
Disk.Parent := GorillaViewport1;
Disk.Width := 2;

Plane

uses Gorilla.Plane;

var Plane := TGorillaPlane.Create(Self);
Plane.Parent := GorillaViewport1;
Plane.Width := 10;
Plane.Depth := 10;

Tube

A hollow cylinder.

uses Gorilla.Tube;

var Tube := TGorillaTube.Create(Self);
Tube.Parent := GorillaViewport1;
Tube.Width := 2;
Tube.Height := 3;

RoundCube

A cube with rounded edges for a softer look.

uses Gorilla.RoundCube;

var RC := TGorillaRoundCube.Create(Self);
RC.Parent := GorillaViewport1;
RC.Width := 2;
RC.Height := 2;
RC.Depth := 2;

Advanced Shapes

ExtrudedMesh

Creates 3D geometry by extruding a 2D polygon profile along an axis.

uses Gorilla.ExtrudedMesh;

var Extr := TGorillaExtrudedMesh.Create(Self);
Extr.Parent := GorillaViewport1;

ProfileMesh

Creates 3D geometry by sweeping a 2D profile along a path (lathe/revolution).

uses Gorilla.ProfileMesh;

var Prof := TGorillaProfileMesh.Create(Self);
Prof.Parent := GorillaViewport1;

GearMesh

Generates gear/cog geometry with configurable teeth.

uses Gorilla.GearMesh;

var Gear := TGorillaGearMesh.Create(Self);
Gear.Parent := GorillaViewport1;

Utility Objects

Grid

Displays a visual grid for scene orientation and scale reference.

uses Gorilla.Grid;

var Grid := TGorillaGrid.Create(Self);
Grid.Parent := GorillaViewport1;

SkyBox

Renders a skybox or sky dome around the scene.

uses Gorilla.SkyBox;

var Sky := TGorillaSkyBox.Create(Self);
Sky.Parent := GorillaViewport1;
// Assign skybox textures

Gizmo

3D manipulation gizmo for translate/rotate/scale operations.

uses Gorilla.Gizmo;

OrientationCube

A small orientation cube shown in a viewport corner.

uses Gorilla.OrientationCube;

Volumetric Objects

Volumetric Mesh

Base mesh for volumetric rendering effects (fog, clouds, etc.).

uses Gorilla.Volumetric.Mesh;

var Vol := TGorillaVolumetricMesh.Create(Self);
Vol.Parent := GorillaViewport1;

Volumetric Noise

Noise-based volumetric effects using procedural noise generation.

uses Gorilla.Volumetric.Noise;

Common Operations

All primitives support standard 3D operations:

// Positioning
Cube.Position.Point := Point3D(3, -1, 0);

// Rotation
Cube.RotationAngle.Y := 45;

// Scaling
Cube.Scale.Point := Point3D(2, 1, 2);

// Applying materials
Cube.MaterialSource := GorillaDefaultMaterialSource1;

// Visibility
Cube.Visible := False;

// Parenting
Sphere.Parent := Cube; // Sphere follows Cube's transform

Best Practices

  • Use primitives for prototyping before replacing with detailed models
  • Capsules are ideal collision shapes for characters and projectiles
  • Planes work well as floors, walls, and water surfaces
  • Use SkyBox for environment backgrounds
  • Apply materials to give primitives visual appearance
  • Primitives auto-generate mesh data — no need to load external files
  • For terrain, use the dedicated TGorillaTerrain instead of planes
  • Combine primitives with the physics system for interactive scenes