Class TCastleAbstractPrimitive

Unit

Declaration

type TCastleAbstractPrimitive = class(TCastleTransform)

Description

Base class to express primitives that can be easily added and adjusted inside TCastleViewport.

Such primitives can be anything visible that can be expressed using X3D nodes (like boxes or spheres). Particular descendants of this class, like TCastleBox or TCastleSphere, define a particular primitive. Note: for things not directly visible (like lights) descending from this class is not useful. Instead descend from TCastleTransform.

Using this class is somewhat similar to using TCastleScene, and loading (using TCastleSceneCore.Load) an X3D nodes graph with appropriate primitives. In fact, that is exactly what happens internally. But using this class is simpler (it hides X3D nodes from you, although it also hides some possibilities) and you can customize such primitives using the CGE editor.

Hierarchy

Overview

Methods

Protected procedure UpdateCollider;
Protected function InternalBuildNodeInside: TObject; override;
Public constructor Create(AOwner: TComponent); override;
Public destructor Destroy; override;
Public function PropertySections(const PropertyName: String): TPropertySections; override;
Public function HasColliderMesh: Boolean; override;
Public procedure ColliderMesh(const TriangleEvent: TTriangleEvent); override;

Properties

Protected property ShapeNode: TShapeNode read FShapeNode;
Public property Color: TCastleColor read FColor write SetColor;
Published property Material: TPrimitiveMaterial read FMaterial write SetMaterial default pmPhysical;
Published property Texture: String read FTexture write SetTexture;
Published property TextureNormalMap: String read FTextureNormalMap write SetTextureNormalMap;
Published property PreciseCollisions: Boolean read FPreciseCollisions write SetPreciseCollisions default false;
Published property RenderOptions: TCastleRenderOptions read GetRenderOptions;
Published property ColorPersistent: TCastleColorPersistent read FColorPersistent ;

Description

Methods

Protected procedure UpdateCollider;

Update collider, notifying it that we changed. This updates TCastleCollider with TCastleCollider.AutoSize. This also updates TCastleMeshCollider mesh, if it referred to us.

Protected function InternalBuildNodeInside: TObject; override;

This item has no description. Showing description inherited from TCastleTransform.InternalBuildNodeInside.

Helper for InternalBuildNode. Result must be TAbstractChildNode or Nil.

Public constructor Create(AOwner: TComponent); override;

This item has no description.

Public destructor Destroy; override;

This item has no description.

Public function PropertySections(const PropertyName: String): TPropertySections; override;

This item has no description. Showing description inherited from TCastleComponent.PropertySections.

Section where to show property in the editor.

Public function HasColliderMesh: Boolean; override;

This item has no description. Showing description inherited from TCastleTransform.HasColliderMesh.

Does this transform have a collision mesh that TCastleMeshCollider can use. Default implementation returns False.

Public procedure ColliderMesh(const TriangleEvent: TTriangleEvent); override;

This item has no description. Showing description inherited from TCastleTransform.ColliderMesh.

Enumerate triangles for a collision mesh that TCastleMeshCollider can use. Always the front side of triangles is CCW (this matters for TCastleMeshCollider with TCastleMeshCollider.DoubleSided = False).

Properties

Protected property ShapeNode: TShapeNode read FShapeNode;

Descendants should add primitive X3D geometry node here.

Public property Color: TCastleColor read FColor write SetColor;

Color of the text. Opaque white by default.

What exactly it means, depends on Material:

Published property Material: TPrimitiveMaterial read FMaterial write SetMaterial default pmPhysical;

Material type (which determines lighting calculation) for this primitive.

Published property Texture: String read FTexture write SetTexture;

Texture URL.

The way texture interacts with lighting depends on the Material type:

The texture mapping is done automatically, following a reasonable algorithm for the given primitive described in the X3D specification. See https://castle-engine.io/x3d_implementation_geometry3d.php for links to X3D specification. For example, https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-CD/Part01/components/geometry3D.html#Box describes how texture is applied to the 6 sides of the box.

Published property TextureNormalMap: String read FTextureNormalMap write SetTextureNormalMap;

Normal map texture URL. Providing normal enhances the details visible on the surface because of lighting. The normalmap texture mapping is the same as Texture mapping.

Published property PreciseCollisions: Boolean read FPreciseCollisions write SetPreciseCollisions default false;

Resolve collisions precisely with the primitive geometry. When this is False we will only consider the primitive bounding box for collisions, so e.g. player will not be able to move within sphere's box corners.

Published property RenderOptions: TCastleRenderOptions read GetRenderOptions;

Rendering options of the scene.

Published property ColorPersistent: TCastleColorPersistent read FColorPersistent ;

Color that can be visually edited in Castle Game Engine Editor, Lazarus and Delphi. Normal user code does not need to deal with this, instead read or write Color directly.

See also
Color
Color of the text.

Generated by PasDoc 0.16.0-snapshot.