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.

Source: scene/castlescene_abstractprimitive.inc (line 38).

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;
Public procedure SetEffects(const Value: array of TEffectNode);

Properties

Protected property ShapeNode: TShapeNode read FShapeNode;
Public property Color: TCastleColor read FColor write SetColor;
Public property TextureScale: TVector2 read FTextureScale write SetTextureScale;
Published property Material: TPrimitiveMaterial read FMaterial write SetMaterial default pmPhysical;
Published property Texture: String read GetTexture write SetTexture;
Published property TextureNormalMap: String read GetTextureNormalMap write SetTextureNormalMap;
Published property PreciseCollisions: Boolean read FPreciseCollisions write SetPreciseCollisions default false;
Published property RenderOptions: TCastleRenderOptions read GetRenderOptions;
Published property ColorPersistent: TCastleColorPersistent read FColorPersistent ;
Published property TextureScalePersistent: TCastleVector2Persistent read FTextureScalePersistent ;

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.

Source: scene/castlescene_abstractprimitive.inc (line 72).

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.

Source: scene/castlescene_abstractprimitive.inc (line 74).

Public constructor Create(AOwner: TComponent); override;

This item has no description.

Source: scene/castlescene_abstractprimitive.inc (line 76).

Public destructor Destroy; override;

This item has no description.

Source: scene/castlescene_abstractprimitive.inc (line 77).

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.

Source: scene/castlescene_abstractprimitive.inc (line 78).

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.

Source: scene/castlescene_abstractprimitive.inc (line 79).

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).

Source: scene/castlescene_abstractprimitive.inc (line 80).

Public procedure SetEffects(const Value: array of TEffectNode);

Add shader effects to configure how is the component rendered. See https://castle-engine.io/shaders for documentation how shader effects work in Castle Game Engine.

Source: scene/castlescene_abstractprimitive.inc (line 96).

Properties

Protected property ShapeNode: TShapeNode read FShapeNode;

Descendants should add primitive X3D geometry node here.

Source: scene/castlescene_abstractprimitive.inc (line 67).

Public property Color: TCastleColor read FColor write SetColor;

Color of the primitive. Opaque white by default.

What exactly it means, depends on Material:

Source: scene/castlescene_abstractprimitive.inc (line 91).

Public property TextureScale: TVector2 read FTextureScale write SetTextureScale;

Scale the texture coordinates of both Texture and TextureNormalMap. By default (1,1), no scaling.

Source: scene/castlescene_abstractprimitive.inc (line 100).

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

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

Source: scene/castlescene_abstractprimitive.inc (line 103).

Published property Texture: String read GetTexture 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.

Source: scene/castlescene_abstractprimitive.inc (line 120).

Published property TextureNormalMap: String read GetTextureNormalMap 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.

Source: scene/castlescene_abstractprimitive.inc (line 125).

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.

Source: scene/castlescene_abstractprimitive.inc (line 130).

Published property RenderOptions: TCastleRenderOptions read GetRenderOptions;

Rendering options of the scene.

Source: scene/castlescene_abstractprimitive.inc (line 133).

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 primitive.

Source: scene/auto_generated_persistent_vectors/tcastleabstractprimitive_persistent_vectors.inc (line 37).

Published property TextureScalePersistent: TCastleVector2Persistent read FTextureScalePersistent ;

TextureScale 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 TextureScale directly.

See also
TextureScale
Scale the texture coordinates of both Texture and TextureNormalMap.

Source: scene/auto_generated_persistent_vectors/tcastleabstractprimitive_persistent_vectors.inc (line 105).


Generated by PasDoc 0.17.0.snapshot.