понедельник, 5 марта 2012 г.

About TGLBaseSceneObject from source code

TGLBaseSceneObject = class(TGLCoordinatesUpdateAbleComponent)
Base class for all scene objects. A scene object is part of scene hierarchy (each scene object can have multiple children), this hierarchy primarily defines transformations (each child coordinates are relative to its parent), but is also used for depth-sorting, bounding and visibility culling purposes. Subclasses implement either visual scene objects (that are made to be visible at runtime, like a Cube) or structural objects (that influence rendering or are used for varied structural manipulations, like the ProxyObject). To add children at runtime, use the AddNewChild method of TGLBaseSceneObject; other children manipulations methods and properties are provided (to browse, move and delete them). Using the regular TComponent methods is not encouraged.


Matrixes:
property LocalMatrix: PMatrix read FlocalMatrix;
Holds the local transformation (relative to parent). If you're not *sure* the local matrix is up-to-date, use Matrix property.
procedure ForceLocalMatrix(const aMatrix: Tmatrix);
Forces the local matrix to the specified value. AbsoluteMatrix, InverseMatrix, etc. will honour that change, but may become invalid if the specified matrix isn't orthonormal (can be used for specific rendering or projection effects). The local matrix will be reset by the next TransformationChanged, position or attitude change.
property DirectAbsoluteMatrix: PMatrix read FabsoluteMatrix;
Holds the absolute transformation matrix. If you're not *sure* the absolute matrix is up-to-date, use the AbsoluteMatrix property, this one may be nil.
function InvAbsoluteMatrix: Tmatrix;
Calculates the object's absolute inverse matrix Multiplying an absolute coordinate with this matrix gives a local coordinate. The current implem uses transposition(AbsoluteMatrix), which is true unless you're using some scaling.
property AbsoluteMatrix: TMatrix read GetAbsoluteMatrix write SetAbsoluteMatrix;
The object's absolute matrix by composing all local matrices. Multiplying a local coordinate with this matrix gives an absolute coordinate.
property Matrix: TMatrix read GetMatrix write SetMatrix;
The local transformation (relative to parent). If you're *sure* the local matrix is up-to-date, you may use LocalMatrix for quicker access.

Orientation and Scale:
property Position: TGLCoordinates read FPosition write SetPosition;
property Direction: TGLCoordinates read FDirection write SetDirection;
property Up: TGLCoordinates read FUp write SetUp;
property Scale: TGLCoordinates read FScaling write SetScaling;
Basic orienation and scale properies.
property AbsoluteDirection: TVector read GetAbsoluteDirection write SetAbsoluteDirection;
property AbsoluteAffineDirection: TAffineVector read GetAbsoluteAffineDirection write SetAbsoluteAffineDirection;
Direction vector in absolute coordinates.
property AbsoluteScale: TVector read GetAbsoluteScale write SetAbsoluteScale;
property AbsoluteAffineScale: TAffineVector read GetAbsoluteAffineScale write SetAbsoluteAffineScale;
Scale vector in absolute coordinates.
Warning: SetAbsoluteScale() does not work correctly at the moment.
property AbsoluteUp: TVector read GetAbsoluteUp write SetAbsoluteUp;
property AbsoluteAffineUp: TAffineVector read GetAbsoluteAffineUp write SetAbsoluteAffineUp;
Up vector in absolute coordinates.
function AbsoluteRight: TVector;
Calculate the right vector in absolute coordinates.
function AbsoluteLeft: TVector;
Calculate the left vector in absolute coordinates.
property AbsolutePosition: TVector read GetAbsolutePosition write SetAbsolutePosition;
property AbsoluteAffinePosition: TAffineVector read GetAbsoluteAffinePosition write SetAbsoluteAffinePosition;
function AbsolutePositionAsAddress: PVector;
Computes and allows to set the object's absolute coordinates.
function AbsoluteXVector: TVector;
function AbsoluteYVector: TVector;
function AbsoluteZVector: TVector;
Returns the Absolute X, Y, Z Vector expressed in local coordinates.
function Right: Tvector;
Returns the Right vector (based on Up and Direction)
function LeftVector: Tvector;
Returns the Left vector (based on Up and Direction)
function AffineRight: TaffineVector;
Returns the Right vector (based on Up and Direction)
function AffineLeftVector: TaffineVector;
Returns the Left vector (based on Up and Direction)
Functions:
function SqrDistanceTo(anObject: TGLBaseSceneObject): Single; overload;
function SqrDistanceTo(const pt: TVector): Single; overload;
function SqrDistanceTo(const pt: TAffineVector): Single; overload;
Calculates the object's square distance to a point/object. pt is assumed to be in absolute coordinates, AbsolutePosition is considered as being the object position.
Functions:
function DistanceTo(anObject: TGLBaseSceneObject): Single; overload;
function DistanceTo(const pt: TAffineVector): Single; overload;
function DistanceTo(const pt: TVector): Single; overload;
Computes the object's distance to a point/object. Only objects AbsolutePositions are considered.
function BarycenterAbsolutePosition: TVector; virtual;
Calculates the object's barycenter in absolute coordinates. Default behaviour is to consider Barycenter=AbsolutePosition (whatever the number of children). SubClasses where AbsolutePosition is not the barycenter should override this method as it is used for distance calculation, during rendering for instance, and may lead to visual inconsistencies.
function BarycenterSqrDistanceTo(const pt: TVector): Single;
Calculates the object's barycenter distance to a point.
function AxisAlignedDimensions: TVector;
function AxisAlignedDimensionsUnscaled: TVector; virtual;
Shall returns the object's axis aligned extensions. The dimensions are measured from object center and are expressed with scale accounted for, in the object's coordinates (not in absolute coordinates). Default value is half the object's Scale.
procedure ResetRotations;
Sets all rotations to zero and restores default Direction/Up. Using this function then applying roll/pitch/turn in the order that suits you, you can give an "absolute" meaning to rotation angles (they are still applied locally though). Scale and Position are not affected.
procedure ResetAndPitchTurnRoll(const degX, degY, degZ: Single);
Reset rotations and applies them back in the specified order.
procedure RotateAbsolute(const rx, ry, rz: Single); overload;
Applies rotations around absolute X, Y and Z axis.
procedure RotateAbsolute(const axis: TAffineVector; angle: Single); overload;
Applies rotations around the absolute given vector (angle in degrees).
function PointInObject(const point: TVector): Boolean; virtual;
Indicates if a point is within an object. Given coordinate is an absolute coordinate. Linear or surfacic objects shall always return False Default value is based on AxisAlignedDimension and a cube bounding.
function RayCastIntersect(const rayStart, rayVector: Tvector; intersectPoint: PVector = nil; intersectNormal: PVector = nil): Boolean; virtual;
Request to determine an intersection with a casted ray. Given coordinates & vector are in absolute coordinates, rayVector must be normalized.
- rayStart may be a point inside the object, allowing retrieval of the multiple intersects of the ray. When intersectXXX parameters are nil (default) implementation should take advantage of this to optimize calculus, if not, and an intersect is found, non nil parameters should be defined.
- The intersectNormal needs NOT be normalized by the implementations. Default value is based on bounding sphere.
procedure PointTo(const ATargetObject: TGLBaseSceneObject; const AupVector: TVector); overload;
Orients the object toward a target object
procedure PointTo(const AAbsolutePosition, AUpVector: TVector); overload;
Orients the object toward a target absolute position

BoundingBox and Other:
property Visible: Boolean read FVisible write SetVisible default True;
property Pickable: Boolean read FPickable write SetPickable default True;
property ObjectsSorting: TGLObjectsSorting read FObjectsSorting write SetObjectsSorting default osInherited;
property VisibilityCulling: TGLVisibilityCulling read FvisibilityCulling write SetVisibilityCulling default vcInherited;
property Behaviours: TGLBehaviours read GetBehaviours write SetBehaviours stored False;
property Effects: TGLObjectEffects read GetEffects write SetEffects stored False;
function GenerateSilhouette(const silhouetteParameters: TGLSilhouetteParameters): TGLSilhouette; virtual;
Request to generate silhouette outlines. Default implementation assumes the objects is a sphere of AxisAlignedDimensionUnscaled size. Subclasses may choose to return nil instead, which will be understood as an empty silhouette.
procedure Lift(ADistance: Single);
Moves the object along the Up vector (move up/down)
procedure Slide(ADistance: Single);
Moves camera along the right vector (move left and right)
function AxisAlignedBoundingBox(const AIncludeChilden: Boolean = True): TAABB;
function AxisAlignedBoundingBoxUnscaled(const AIncludeChilden: Boolean = True): TAABB;
function AxisAlignedBoundingBoxAbsolute(const AIncludeChilden: Boolean = True; const AUseBaryCenter: Boolean = False): TAABB;
Calculates and return the AABB for the object. The AABB is currently calculated from the BB. There is no caching scheme for them.
function AxisAlignedBoundingBoxEx: TAABB;
function AxisAlignedBoundingBoxAbsoluteEx: TAABB;
Advanced AABB functions that use a caching scheme. Also they include children and use BaryCenter.
function BoundingBox(const AIncludeChilden: Boolean = True; const AUseBaryCenter: Boolean = False): ThmgBoundingBox;
function BoundingBoxUnscaled(const AIncludeChilden: Boolean = True; const AUseBaryCenter: Boolean = False): ThmgBoundingBox;
function BoundingBoxAbsolute(const AIncludeChilden: Boolean = True; const AUseBaryCenter: Boolean = False): THmgBoundingBox;
Calculates and return the Bounding Box for the object. The BB is calculated each time this method is invoked, based on the AxisAlignedDimensions of the object and that of itschildren. There is no caching scheme for them.
function BoundingBoxPersonalUnscaledEx: ThmgBoundingBox;
function BoundingBoxOfChildrenEx: ThmgBoundingBox;
function BoundingBoxIncludingChildrenEx: THmgBoundingBox;
Advanced BB functions that use a caching scheme. Also they include children and use BaryCenter.
function BoundingSphereRadius: Single;
function BoundingSphereRadiusUnscaled: Single;
Max distance of corners of the BoundingBox.
property ObjectStyle: TGLObjectStyles read FObjectStyle write FobjectStyle;
Controls and adjusts internal optimizations based on object's style. Advanced user only.
TGLObjectStyles = set of TGLObjectStyle;
 TGLObjectStyle = (osDirectDraw, osIgnoreDepthBuffer, osNoVisibilityCulling);

Комментариев нет:

Отправить комментарий