Unit Castle3D

Description

Base 3D objects (T3D, T3DList, T3DTransform, T3DOrient, T3DMoving).

Uses

Overview

Classes, Interfaces, Objects and Records

Name Description
Class TBaseShadowVolumeRenderer Shadow volumes helper, not depending on OpenGL.
Object TRayCollisionNode Information about ray collision with a single 3D object.
Class TRayCollision Represents a ray collision with a 3D objects tree.
Object TCollisionDetailsItem Detailed information about collision with a single 3D object.
Class TCollisionDetails Represents a collision with a 3D objects tree.
Record TRenderStatistics Statistics about what was rendered during last frame.
Class TRenderParams Information that 3D object needs to render.
Class T3D Base 3D object, that can be managed by TCastleSceneManager.
Class T3DListCore List of 3D objects (T3D instances).
Class T3DList List of 3D objects (T3D instances), that can be treated like another, larger 3D object.
Class T3DWorld 3D world.
Class T3DCustomTransform Transform (move, rotate, scale) other T3D objects.
Class T3DTransform Transform (move, rotate, scale) children T3D objects.
Class T3DOrient Transform other 3D objects by changing their orientation.
Class T3DMoving 3D object moving and potentially pushing other 3D objects.
Class T3DLinearMoving 3D moving with constant speed between 2 points.
Class T3DAlive Alive, oriented 3D object.

Functions and Procedures

procedure TransformMatricesMult(var Transform, TransformInverse: TMatrix4Single; const Center: TVector3Single; const Rotation: TVector4Single; const Scale: TVector3Single; const ScaleOrientation: TVector4Single; const Translation: TVector3Single);

Types

TRenderFromViewFunction = procedure of object;
TVisibleChange = (...);
TVisibleChanges = set of TVisibleChange;
TVisibleChangeEvent = procedure (const Sender: T3D; const Changes: TVisibleChanges) of object;
TPrepareResourcesOption = (...);
TPrepareResourcesOptions = set of TPrepareResourcesOption;
PRayCollisionNode = ˆTRayCollisionNode;
PCollisionDetailsItem = ˆTCollisionDetailsItem;
TAbstractLightInstancesList = TFPSList;
TRenderingPass = 0..1;
TRemoveType = (...);
TOrientationType = (...);
T3DExistsEvent = function(const Item: T3D): boolean of object;

Constants

MaxSingle = Math.MaxSingle;
DefaultFallMinHeightToDamage = 5.0;
DefaultFallDamageScaleMin = 0.8;
DefaultFallDamageScaleMax = 1.2;
DefaultCreatureFallMinHeightToSound = 1.0;
DefaultPlayerFallMinHeightToSound = 4.0;
DefaultCreatureFallSoundName = 'creature_fall';
DefaultPlayerFallSoundName = 'player_fall';
DirectionFromOrientation: array [TOrientationType] of TVector3Single = ( (0, 0, -1), (0, -1, 0), (1, 0, 0) );
UpFromOrientation: array [TOrientationType] of TVector3Single = ( (0, 1, 0), (0, 0, 1), (0, 0, 1) );

Variables

RenderDebug3D: boolean = false;
RenderDebugCaptions: boolean = false;
LogShadowVolumes: boolean = false;

Description

Functions and Procedures

procedure TransformMatricesMult(var Transform, TransformInverse: TMatrix4Single; const Center: TVector3Single; const Rotation: TVector4Single; const Scale: TVector3Single; const ScaleOrientation: TVector4Single; const Translation: TVector3Single);

Apply transformation to a matrix. Calculates at the same time transformation matrix, and it's inverse, and multiplies given Transform, TransformInverse appropriately. The precise meaning of Center, Translation and such parameters follows exactly the X3D Transform node definition (see http://www.web3d.org/files/specifications/19775-1/V3.2/Part01/components/group.html#Transform ).

Parameters
Rotation
Rotation is expressed as a 4D vector, in which the first 3 components specify the rotation axis (does not need to be normalized, but must be non-zero), and the last component is the rotation angle in radians.

Types

TRenderFromViewFunction = procedure of object;
 
TVisibleChange = (...);

Describe what visible thing changed for T3D.VisibleChangeHere.

Values
  • vcVisibleGeometry: Visible geometry (actual 3D shape) changed. It's not used when only light conditions, materials, textures and such changed.

    In practice, this means that the depth buffer from some point in space changed. Which means that shadow maps should be regenerated.

  • vcVisibleNonGeometry: Something visible, but not the geometry shape, changes. For example, material or texture on a visible surface changed.
TVisibleChanges = set of TVisibleChange;
 
TVisibleChangeEvent = procedure (const Sender: T3D; const Changes: TVisibleChanges) of object;
 
TPrepareResourcesOption = (...);

Various things that T3D.PrepareResources may prepare.

Values
  • prRender
  • prBackground
  • prBoundingBox
  • prShadowVolume
  • prSpatial: Prepare octrees (determined by things like TCastleSceneCore.Spatial).
  • prScreenEffects
TPrepareResourcesOptions = set of TPrepareResourcesOption;
 
PRayCollisionNode = ˆTRayCollisionNode;
 
PCollisionDetailsItem = ˆTCollisionDetailsItem;

Triangle: P3DTriangle;

TAbstractLightInstancesList = TFPSList;

List of lights. Always TLightInstancesList, but we cannot declare it here as such.

TRenderingPass = 0..1;
 
TRemoveType = (...);
 
Values
  • rtNone
  • rtRemove
  • rtRemoveAndFree
TOrientationType = (...);
 
Values
  • otUpYDirectionMinusZ: Sensible for worlds oriented around Y axis. That is when gravity pulls in -Y and GravityUp vector is +Y. Transformation makes -Z and +Y match (respectively) Direction and Up.

    This matches default direction/up of OpenGL and VRML/X3D cameras.

    For example, using this value for T3DOrient.Orientation (or even T3DOrient.DefaultOrientation) is sensible if you use default Blender X3D exporter, and you let the exporter to make a transformation (to make +Z up into +Y up). This is the default setting. Then you can follow the standard Blender view names ("front", "top" and such) when modelling, and Blender tools like "X-axis mirror" will work best.

  • otUpZDirectionMinusY: Sensible for worlds oriented around Z axis. Transformation makes -Y and +Z match (respectively) Direction and Up.

    Using this value for T3DOrient.Orientation (or even T3DOrient.DefaultOrientation) is sensible if you export your models from Blender without transforming them during export. Note that this is not the default Blender X3D exporter behavior. But you can configure the exporter to work like this (not transform), and then you can follow the standard Blender view names ("front", "top" and such) when modelling.

  • otUpZDirectionX:

    Warning: this symbol is deprecated.

    Up in +Z (like otUpZDirectionMinusY) and direction in +X. Should not be used in new models.
T3DExistsEvent = function(const Item: T3D): boolean of object;
 

Constants

MaxSingle = Math.MaxSingle;
 
DefaultFallMinHeightToDamage = 5.0;

Default values common to TPlayer and TCreature classes.

Note that FallMinHeightToSound is usually better to be larger for player, to avoid making "fall" sound when player merely jumps or walks down a steep hill. No such need for creature.

DefaultFallDamageScaleMin = 0.8;
 
DefaultFallDamageScaleMax = 1.2;
 
DefaultCreatureFallMinHeightToSound = 1.0;
 
DefaultPlayerFallMinHeightToSound = 4.0;
 
DefaultCreatureFallSoundName = 'creature_fall';
 
DefaultPlayerFallSoundName = 'player_fall';
 
DirectionFromOrientation: array [TOrientationType] of TVector3Single = ( (0, 0, -1), (0, -1, 0), (1, 0, 0) );
 
UpFromOrientation: array [TOrientationType] of TVector3Single = ( (0, 1, 0), (0, 0, 1), (0, 0, 1) );
 

Variables

RenderDebug3D: boolean = false;

Creatures, items and possibly other 3D stuff may look at these variables to display additional features of 3D objects, helpful to debug collisions, AI and other things.

RenderDebugCaptions: boolean = false;
 
LogShadowVolumes: boolean = false;

Log shadow volume information.

Meaningful only if you initialized log (see CastleLog unit) by InitializeLog first.


Generated by PasDoc 0.14.0.