Class TFB_CollisionTree

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TFB_CollisionTree = class(TObject)

Description

Particle collision tree

Hierarchy

Overview

Methods

Public constructor Create;
Public destructor Destroy; override;
Public procedure SetTreeMatrix(ARef: Pointer);
Public procedure SetOffsetMatrix(ARef: Pointer);
Public procedure SetMaterial(AMaterial: TFB_Material);
Public procedure AddHeightmap(AWidth, AHeight, ADepth: Single; ARows, ACols: Integer; ADataForm: Cardinal; AHeightData: PSingle; ACallback: TFB_MaterialSetCallback = nil);
Public procedure AddSphere(ARadius: Single);
Public procedure AddCube(AWidth, AHeight, ADepth: Single);
Public procedure AddCone(ABaseRadius, ATopRadius, AHeight: Single; ATopCap: Boolean = True; ABaseCap: Boolean = True);
Public procedure AddCustomPrimitive(APrimitive: TFB_CollisionPrimitive);
Public procedure FaceBegin(AMode: Cardinal);
Public procedure FaceVertex(x, y, z: Single); overload;
Public procedure FaceVertex(ARef: PSingle); overload;
Public procedure FaceEnd;
Public procedure Compile;
Public procedure DrawBoundingBoxes();

Properties

Public property BoundOffset: Single read FBoundOffset write FBoundOffset;
Public property FullDetection: Boolean read FFullDetection write FFullDetection;

Description

Methods

Public constructor Create;

Class constructor

Public destructor Destroy; override;

Class destructor

Public procedure SetTreeMatrix(ARef: Pointer);

Global tree translation matrix, OpenGL format.

Parameters
ARef
Pointer to a sequence of 16 Single values which represent a 4x4 Matrix
Public procedure SetOffsetMatrix(ARef: Pointer);

Offset translation matrix, OpenGL format. All following elements of the collision will recieve this offset matrix.

Parameters
ARef
Pointer to a sequence of 16 Single values which represent a 4x4 Matrix
Public procedure SetMaterial(AMaterial: TFB_Material);

Sets the material to use for following primitives. If AMaterial is 'nil', the default material 'fb_collision_mat_default' with Friction=0 will be used.

Public procedure AddHeightmap(AWidth, AHeight, ADepth: Single; ARows, ACols: Integer; ADataForm: Cardinal; AHeightData: PSingle; ACallback: TFB_MaterialSetCallback = nil);

Adds a heightmap to the collision tree.

Parameters
AWidth
Dimension in X coordinate.
AHeight
Height data multiplier
ADepth
Dimension in Z coordinate.
ARows
Row resolution of the map. Represents first length of a 2-dimensional Array.
ACols
Column resolution of the map. Represents second length of a 2-dimensional Array.
ADataForm
The way the data is stored.
AHeightData
Pointer to the height data.
ACallBack
Callback which makes it possible to assign different materials for single fields.
See also
FB_DATAFORM_POINTING
FB_DATAFORM_SEQUENCE
Public procedure AddSphere(ARadius: Single);

Adds a sphere to the collision tree.

Public procedure AddCube(AWidth, AHeight, ADepth: Single);

Adds a cube to the collision tree.

Parameters
AWidth
Dimension in X coordinate.
AHeight
Dimension in Y coordinate.
ADepth
Dimension in Z coordinate.
Public procedure AddCone(ABaseRadius, ATopRadius, AHeight: Single; ATopCap: Boolean = True; ABaseCap: Boolean = True);

Adds a cone to the collision tree.

Parameters
ABaseRadius
Radius of the cone's "floor".
ATopRadius
Radius of the cone's "ceiling".
AHeight
Height of the cone.
ATopCap
If true, particles also collide with the "ceiling" of the cone
ABaseCap
If true, particles also collide with the "floor" of the cone
Public procedure AddCustomPrimitive(APrimitive: TFB_CollisionPrimitive);

Adds a custom descendant of TFB_CollisionPrimitive to the tree. Note that setting an offset matrix with TFB_CollisionTree.SetOffsetMatrix has no effect here. The matrix must be set manually.

Public procedure FaceBegin(AMode: Cardinal);

Inits vertex recording for adding faces to the tree.

Parameters
AMode
The way how the vertices shall be interpretated.
See also
FB_FACEMODE_TRIANGLES
FB_FACEMODE_TRIANGLE_STRIP
FB_FACEMODE_QUADS
FB_FACEMODE_TRIANGLE_FAN
Public procedure FaceVertex(x, y, z: Single); overload;

Adds and interpretates a face vertex on positiom x|y|z

Public procedure FaceVertex(ARef: PSingle); overload;

Adds and interpretates a face vertex on positiom x|y|z the position.

Parameters
ARef
Pointer to a sequence of three Single values in xyz format, which represent
Public procedure FaceEnd;

Resets the interpretation values.

Public procedure Compile;

Compiles the collision tree. Without this, the tree will not have an effect. It's possible to later add elements and recompile it.

Public procedure DrawBoundingBoxes();

Draws the bounding boxes of all primitives

Properties

Public property BoundOffset: Single read FBoundOffset write FBoundOffset;

Defines at which delta a new tree node will be created. This may significantly reduce compile time and memory consumption without significantly decreasing the performance of the tree. 0.05 to 0.2 might be a good value for this, but it always belongs to the tree itself. The larger the value is, the less time will be needed for compilation but the more for a query.

Public property FullDetection: Boolean read FFullDetection write FFullDetection;

If true, then a detected collision will not stop further collision detection. False by default.


Generated by PasDoc 0.11.0 on 2009-06-29 23:12:35