Gorilla.DefTypes
Unit Gorilla.DefTypes.pasClasses
- TCustomDef = class ( TObject )
- TRefDef`1 = class ( TCustomDef )
- TImageDef = class ( TCustomDef )
- TSamplerDef = class ( TCustomDef )
- TTextureDef = class ( TCustomDef )
- TShaderDef = class ( TCustomDef )
- TMaterialRefDef = class ( {Gorilla.DefTypes}TRefDef<Gorilla.DefTypes.TMaterialDef> )
- TMaterialDef = class ( TCustomDef )
- TInterpolatorKeyDef`1 = class ( TObject )
- TInterpolatorDef`1 = class ( TCustomDef )
- TPoint3DInterpolatorDef = class ( {Gorilla.DefTypes}TInterpolatorDef<System.Math.Vectors.TPoint3D> )
- TVector3DInterpolatorDef = class ( {Gorilla.DefTypes}TInterpolatorDef<System.Math.Vectors.TVector3D> )
- TQuaternion3DInterpolatorDef = class ( {Gorilla.DefTypes}TInterpolatorDef<System.Math.Vectors.TQuaternion3D> )
- TTransformationInterpolatorDef = class ( {Gorilla.DefTypes}TInterpolatorDef<System.Math.Vectors.TMatrix3D> )
- TMeshInterpolatorDef = class ( {Gorilla.DefTypes}TInterpolatorDef<System.TArray<System.Math.Vectors.TPoint3D>> )
- TAnimationStageDef = class ( TCustomDef )
- TAnimationBuffer = class ( TObject )
- TAnimationDef = class ( TCustomDef )
- TTransformDef = class ( TCustomDef )
- THumanoidDef = class ( TTransformDef )
- TJointDef = class ( TTransformDef )
- TJointRefDef = class ( TCustomDef )
- TVertexJointsList = class ( TObject )
- TSkinDef = class ( TTransformDef )
- TControllerDef = class ( TCustomDef )
- TVertexIndexMap = class ( {System.Generics.Collections}TDictionary<System.Word,System.TArray<System.Word>> )
- TCustomMeshDef = class ( TTransformDef )
- TMeshDef = class ( TCustomMeshDef )
- TModelDef = class ( TMeshDef )
- TVertexCache = class ( TObject )
Records
- record TFaceIndex
- record TVertexIDTextures
- record TVertexIDColors
- record TVertexID
- record TVertexData
- record TPolygon3D
- record TMeshDefVertexSmoothNormalInfo
- record TVertexJoints
Enumerations
- enum TFaceIndexKind = ( Triangle, Quad, Polygon ) ;
- enum TVertexDataFlag = ( CalcNormals ) ;
- enum TMeshDefCalculateNormalMethod = ( cnmDefault, cnmFastest, cnmSlowest ) ;
- enum TJSONVertexDataType = ( jvdtBinary, jvdtValues ) ;
- enum TAnimationCachingFlag = ( AllAttributes, Compressed, VertexPosition ) ;
- enum TColorChannelDef = ( Diffuse, Ambient, Emissive, Specular, Normal ) ;
- enum TTextureFlipping = ( Vertical, Horizontal ) ;
- enum TMaterialDefKind = ( Default, Color, Lambert, Phong, BlinnPhong, NormalMap, BumpMap, Layered ) ;
- enum TAnimationKeyInterpolationType = ( Linear, Quadratic, Cubic, Quartic, Quintic, Sinusoidal, Exponential, Circular, Elastic, Back, Bounce ) ;
- enum TAnimationBufferingState = ( None, Started, Caching, Cached, Ready ) ;
Constants
- const GORILLA_POLYGON_MAXSIZE : Integer = $C;
- const GORILLA_ARRAY_TEXTURE_MAX : Integer = $20;
- const GORILLA_ARRAY_COLOR_MAX : Integer = $4;
- const GORILLA_ANIMATION_CACHE_FRAMERATE_24 : Integer = $18;
- const GORILLA_ANIMATION_CACHE_FRAMERATE_30 : Integer = $1E;
- const GORILLA_ANIMATION_CACHE_FRAMERATE_60 : Integer = $3C;
- const GORILLA_ANIMATION_CACHE_FRAMERATE : Integer = $18;
- const GORILLA_INDEX_FORMAT : TIndexFormat = UInt16;
- const GORILLA_ANIMATION_CACHING_DEFAULT : TAnimationCachingFlags = ;
- const GORILLA_ANIMATION_CACHING_COMPRESSEDEX : TAnimationCachingFlags = ;
- const NullVertexID : TVertexID = ;
Mics. types
- type TFloatType = Float;
- type TIndexType = word;
- type TTriangleID = array [0..2] of TVertexID;
- type TPolygonID = array of TVertexID;
- type TTriangleIndex = array [0..2] of Word;
- type PVertexData = pointer to TVertexData;
- type TVertexTriangle = array [0..2] of TVertexData;
- type PPolygon3D = pointer to TPolygon3D;
- type TCustomDefClass = class of TCustomDef;
- type TAnimationKeyInterpolationDynArray = array of TInterpolationType;
- type TJointRefDefClass = class of TJointRefDef;
- type PVertexJoints = pointer to TVertexJoints;
Functions / Procedures
- public function FloatStringsToSingleDynArray ( const AStr : string ) : TSingleDynArray ;
- public function StringsToStringDynArray ( const AStr : string ) : TStringDynArray ; overload;
- public function IntStringsToIntegerDynArray ( const AStr : string ) : TIntegerDynArray ; overload;
- public function SetLocalPath ( const APath : string; var AFileName : string ) : Boolean ;
TAnimationCachingFlag
Configuring caching mechanism. By these flags you can define the kind of caching used.
By default it's recommend to use TAnimationCachingFlag.VertexPosition only. This will only cache the vertex position in every frame directly inside of your GPU. This method is the fastest cache mechanism and will later only need a framebuffer switch while rendering. When having a lot of large animations this will stress GPU memory a lot. So its recommend for small animations which need fast switching and playback.
Compressed caching is recommend for large models and long animations, but will not create a framebuffer directly in GPU memory! Instead, on rendering time the cache will be decompressed and pushes afterwards data to the GPU memory. This is still much faster than animate a skin on runtime.
Remarks
AllAttributes - Caching all attributes of each vertex. This may be the fastest method, but memory usage is enormous! If possible use TAnimationCachingFlag.VertexPosition instead.
Compressed - Cached frames will be compressed inside the application memory. On MSWINDOWS x86 we use LZ4 compression for enourmous performance boost. On all other platforms we use ZLib compression algorithms by default.
VertexPosition - Cached frames will ONLY contain the vertex position. The other vertex data components will come from the static mesh buffer. This is the recommend setting for caching, because in 95%% of all cases you only need to transform vertex position on animation skin.
If "TAnimationCachingFlag.VertexPosition" option is set, the caching mechanism will create temporary mesh-vertexbuffers only with position data, instead of using the meshdata itself. So caching can push vertexbuffer directly to GPU memory, instead of extracting the VertexPosition from each vertex.TColorChannelDef
Color Channel definition diffuse, ambient, emissive, specular, normal
TAnimationBufferingState
frame buffering states: "Started" - Framebuffer recording was started "Recording" - at least one frame was recorded "Buffered" - the framerate was reached and buffering is complete "Stopped" - recording process was stopped
TVertexData
TCustomDef
default definition type as basis for all other types
Ancestors
Members
Fields
Methods
- public constructor Create ( ) ;
- public destructor Destroy ( ) ;
- public function GetSize ( ) : Int64 ; virtual;
- public function GetAssetsPackage ( ) : TObject ; virtual;
- public function ToJSON ( ) : TJSONObject ; virtual;
- public procedure FromJSON ( const AValue : TJSONObject ) ; virtual;
Properties
TRefDef`1
Ancestors
Members
TImageDef
Not implemented yet! This should be used in future to define texture images abstractly.
Ancestors
Members
TSamplerDef
Not implemented yet! This should be used in future to set texture formats, wrapping and so on...
Ancestors
Members
TTextureDef
Ancestors
Members
Fields
- private FFlipState :
TTextureFlippings
- protected FMaterial :
TMaterialDef
- protected FChannel :
TColorChannelDef
- protected FIsAssetOwner :
Boolean
- protected FAsset :
TObject
- protected FFlipping :
TTextureFlippings
- protected FWrapS :
TGorillaTextureWrap
- protected FWrapT :
TGorillaTextureWrap
Methods
- public constructor Create ( const AMaterial : TMaterialDef; const AChannel : TColorChannelDef; const AAsset : TObject; const AIsAssetOwner : Boolean = False ) ;
- public destructor Destroy ( ) ;
- public function GetAssetBitmapInstance ( const ADoClone : Boolean = False ) : TBitmap ;
- public function GetSize ( ) : Int64 ; override;
- public function GetAssetsPackage ( ) : TObject ; override;
- public function ToJSON ( ) : TJSONObject ; override;
- public procedure FromJSON ( const AValue : TJSONObject ) ; override;
Properties
- public Material : TMaterialDef
- public Channel : TColorChannelDef
- public Flipping : TTextureFlippings
- public WrapS : TGorillaTextureWrap
- public WrapT : TGorillaTextureWrap
- public IsAssetOwner : Boolean
Defines if this texture owns the linked asset. By default the asset is handled by the AssetsManager. But there are some cases, where is just a temporary asset. If "IsAssetOwner" == true, the asset will be destroyed on destruction of this texture definition.
read FIsAssetOwner
write FIsAssetOwner - public Asset : TObject
TShaderDef
internal shader definition type by this type shader information can be stored
Ancestors
Members
TMaterialRefDef
internal material reference definition type by this type a reference to a specific material is handled
Ancestors
Members
TMaterialDef
internal material definition type by this type material information can be stored
Ancestors
Members
Fields
- protected FModel :
TModelDef
- protected FKind :
TMaterialDefKind
- protected FDiffuse :
TAlphaColorF
- protected FAmbient :
TAlphaColorF
- protected FEmissive :
TAlphaColorF
- protected FSpecular :
TAlphaColorF
- protected FSpecPow :
Single
- protected FClipping :
TAlphaColorF
- protected FTextures :
TTextureDefList
- protected FShaders :
TShaderDefList
- protected FMaterials :
TMaterialDefList
Methods
- public constructor Create ( const AModel : TModelDef; const AId : string ) ;
- public destructor Destroy ( ) ;
- public function AddTexture ( const ATexDef : TTextureDef ) : TTextureDef ; overload;
- public function AddTexture ( const AChannel : TColorChannelDef; const AAsset : TObject; const AIsAssetOwner : Boolean ) : TTextureDef ; overload;
- public function GetTexture ( const AChannel : TColorChannelDef ) : TTextureDef ;
- public procedure AddLayeredMaterial ( const AMaterial : TMaterialDef ) ; virtual;
- public procedure ClearLayeredMaterials ( ) ; virtual;
- public function GetSize ( ) : Int64 ; override;
- public function ToJSON ( ) : TJSONObject ; override;
- public procedure FromJSON ( const AValue : TJSONObject ) ; override;
Properties
- public Model : TModelDefread FModel
- public Kind : TMaterialDefKind
- public Diffuse : TAlphaColorF
- public Ambient : TAlphaColorF
- public Emissive : TAlphaColorF
- public Specular : TAlphaColorF
- public SpecPow : Single
- public Clipping : TAlphaColorF
- public Textures : TObjectList<Gorilla.DefTypes.TTextureDef>read FTextures
- public Shaders : TObjectList<Gorilla.DefTypes.TShaderDef>read FShaders
- public Materials : TObjectList<Gorilla.DefTypes.TMaterialDef>read FMaterials
TInterpolatorKeyDef`1
Ancestors
Members
Fields
Methods
- public constructor Create ( ) ;
- public constructor Create ( const AKey : Single; const AValue : T; const AInterpolation : TInterpolationType = Linear ) ;
- public function GetSize ( ) : Int64 ; virtual;
- public function ToJSON ( const ASerializeFunc : ) : TJSONObject ; virtual;
- public procedure FromJSON ( const AValue : TJSONObject; const AUnserializeFunc : ) ; virtual;
Properties
TInterpolatorDef`1
Ancestors
Members
Fields
- protected FStage :
TAnimationStageDef
- protected FDuration :
Single
- protected FLoop :
Boolean
- protected FPath :
string
- protected FKeys :
TInterpolatorKeyDefList
- protected FSerialize :
- protected FUnserialize :
Methods
- public constructor Create ( const AStage : TAnimationStageDef ) ;
- public destructor Destroy ( ) ;
- public function AddKey ( const AKey : Single; const AValue : T; const AInterpolation : TInterpolationType ) : ;
- public function AddEmptyKey ( ) : ;
- public procedure AddKeys ( const AKeyTimes : :1; const AKeyValues : ; const AIntVals : TAnimationKeyInterpolationDynArray ) ; virtual;
- public function GetSize ( ) : Int64 ; override;
- public function ToJSON ( ) : TJSONObject ; override;
- public procedure FromJSON ( const AValue : TJSONObject ) ; override;
Properties
TPoint3DInterpolatorDef
position interpolation definition type by this type an interpolation of the coordinate position is described
Ancestors
Members
TVector3DInterpolatorDef
orientation interpolation definition type by this type an interpolation of the coordinate rotation is described
Ancestors
Members
TQuaternion3DInterpolatorDef
rotation interpolation definition type by this type an interpolation of the coordinate rotation is described
Ancestors
Members
TTransformationInterpolatorDef
transformation interpolation definition type by this type an interpolation of position, rotation and scaling is possible
Ancestors
Members
TMeshInterpolatorDef
vertex interpolation definition type by this type an interpolation of multiple coordinates are possible
Ancestors
Members
TAnimationStageDef
internal animation stage definition type by this type animation stage information can be stored
Ancestors
Members
Fields
- protected FAnimation :
TAnimationDef
- protected FReference :
TCustomDef
- protected FInterpolators :
TInterpolatorDefList
Methods
- public constructor Create ( const AAnimation : TAnimationDef ) ;
- public destructor Destroy ( ) ;
- protected procedure SetReference ( const AValue : TCustomDef ) ; virtual;
- public procedure AddInterpolator ( const AInter : TCustomDef ) ; virtual;
- public function FindInterpolatorById ( const AName : string ) : TCustomDef ; virtual;
- public function GetDurationInSeconds ( ) : Single ;
- public function GetSize ( ) : Int64 ; override;
- public function ToJSON ( ) : TJSONObject ; override;
- public procedure FromJSON ( const AValue : TJSONObject ) ; override;
Properties
TAnimationBuffer
Ancestors
Members
Fields
- protected FMesh :
TMeshDef
- protected FAnimation :
TAnimationDef
- protected FIsBuffered :
Boolean
- protected FFrames :
TAnimationBufferFrames
- protected FBufferedFrames :
Integer
Methods
- public constructor Create ( const AMesh : TMeshDef; const AAnim : TAnimationDef ) ;
- public destructor Destroy ( ) ;
- public procedure SetFrameCount
(
const
AFrameCount :
Integer
)
;
Apply a number of frames to this buffer. If AFrameCount is equal to the current number of frames nothing will change. If the count differs, the method will reinitialize Frames and set to IsBuffered = false
Properties
TAnimationDef
internal animation definition type by this type animation information can be stored an animation represents a group of stages (TAnimationStageDef) and can be seen as a grouping object for easy access
Ancestors
Members
Fields
- protected FModel :
TModelDef
- protected FStages :
TAnimationStageDefList
- protected FCachingFlags :
TAnimationCachingFlags
- protected FBufferingState :
TAnimationBufferingState
- protected FBuffers :
TAnimationBufferMap
- protected FFrameRate :
Integer
- protected FFrameCount :
Integer
- protected FDuration :
Double
Methods
- public constructor Create ( const AModel : TModelDef ) ;
- public destructor Destroy ( ) ;
- protected procedure DoOnBufferValueNotify ( ASender : TObject; const AItem : TAnimationBuffer; AAction : TCollectionNotification ) ;
- protected procedure SetFrameRate ( AValue : Integer ) ;
- protected function GetIsCached ( ) : Boolean ;
- protected function GetIsCacheable ( ) : Boolean ;
- public function GetSize ( ) : Int64 ; override;
- public function ToJSON ( ) : TJSONObject ; override;
- public procedure FromJSON ( const AValue : TJSONObject ) ; override;
- public procedure AddStage
(
const
AStage :
TAnimationStageDef
)
;
Adds an existing animation stage definition to a specific animation.
- public function FindStageById
(
const
AId :
string
)
: TAnimationStageDef
;
Trys to find an animation stage by its ID and returns those. If a specific stage could not be found, the method returns NIL
- public function GetDurationInSeconds
(
)
: Double
;
Checks all animations stages and interpolators and returns the max. duration time in seconds.
- public function GetDurationInMilliseconds
(
)
: Int64
;
Checks all animations stages and interpolators and returns the max. duration time in milliseconds. This method uses the GetDurationInSeconds() method and converts to ordinal milliseconds (rounding problems may occur).
- public procedure PrepareAnimationData
(
)
;
Prepare internal animation data, like framecount and duration
- public function ComputeFrameCount
(
const
ADurationInSeconds :
Double
)
: Integer
;
overload;
Computes the maximum number of frames for this animation.
- public function ComputeFrameCount ( const ADurationInMS : Int64 ) : Integer ; overload;
- public function ComputeFrameCount ( ) : Integer ; overload;
- public procedure UnifyInterpolators
(
)
;
virtual;
To optimize animation performance, this method will summarize singleton position-, scale- and rotation interpolators into a single transformation interpolator represented by a matrices, instead of vector values.
- public procedure Cache
(
const
ACache :
TObject
)
;
This method executes background caching if not already done for this animation.
- public procedure InitializeCaching
(
const
AMesh :
TMeshDef
)
;
Initializes a TAnimationBuffer instance for each mesh in a supplied mesh.
- public procedure FinalizeCaching
(
)
;
Finalizes the caching mechanism and sets the animation definition to Ready.
- public function StartCaching
(
const
AMesh :
TMeshDef
)
: TAnimationBuffer
;
Starts the caching mechanism and returns the used animation buffer. The method returns NIL, if the animation for a specific mesh is already cached. If new caching routine was started, the method will set the buffering state to "Started".
- public procedure CacheFrame
(
const
ABuffer :
TAnimationBuffer; const
AVertices :
TVertexBuffer; const
AIndices :
TIndexBuffer; const
AFlags :
TAnimationCachingFlags
)
;
Caches a current vertex- and indexbuffer of a specific mesh inside a specific animation buffer. The method will set the buffering state to "Caching". The method will not cache the mesh data if the max. number of frames is reached. In that case the method will set buffering state to "Cached"
- public procedure StopCaching
(
const
ABuffer :
TAnimationBuffer
)
;
Stops the caching for a specific mesh. The method will set the buffering state to "Ready".
- public function GetNextCacheFrame
(
AMesh :
TMeshDef; AFrame :
Integer
)
: TMeshBufferObject
;
Returns the next cache frame. This is used by the shape renderer, which sets the current buffer inside of the rendering context.
Properties
- public Model : TModelDefread FModel
- public Stages : TObjectList<Gorilla.DefTypes.TAnimationStageDef>read FStages
- public Buffers : TDictionary<Gorilla.DefTypes.TMeshDef,Gorilla.DefTypes.TAnimationBuffer>read FBuffers
- public BufferingState : TAnimationBufferingStateread FBufferingState
- public FrameRate : Integer
- public FrameCount : Integerread FFrameCount
- public Duration : Doubleread FDuration
- public IsCached : Booleanread GetIsCached
- public IsCacheable : Booleanread GetIsCacheable
- public CachingFlags : TAnimationCachingFlagsread FCachingFlags
TTransformDef
Basic transformation definition with a transform matrix property
Ancestors
Members
THumanoidDef
Ancestors
Members
Fields
- protected FModel :
TModelDef
- protected FRoot :
TJointDef
- protected FControllers :
TControllerDefList
- protected FJointsCount :
Integer
Methods
- public constructor Create ( const AModel : TModelDef ) ;
- public destructor Destroy ( ) ;
- public function ToJSON ( ) : TJSONObject ; override;
- public procedure FromJSON ( const AValue : TJSONObject ) ; override;
- public function FindJointById ( const AId : string ) : TJointDef ;
- public procedure AddController ( const ACtrl : TControllerDef ) ;
Properties
TJointDef
Ancestors
Members
Fields
- protected FHumanoid :
THumanoidDef
- protected FParent :
TJointDef
- protected FJoints :
TJointDefMap
- protected FHumanoidIndex :
Integer
Methods
- public constructor Create ( const AHumanoid : THumanoidDef ) ;
- public destructor Destroy ( ) ;
- protected function GetModel ( ) : TModelDef ;
- protected procedure DoOnJointsValueNotify ( ASender : TObject; const AItem : TJointDef; AAction : TCollectionNotification ) ;
- public procedure AddJoint ( const AJoint : TJointDef ) ;
- public function FindJointById ( const AId : string ) : TJointDef ;
- public function GetSize ( ) : Int64 ; override;
- public function ToJSON ( ) : TJSONObject ; override;
- public procedure FromJSON ( const AValue : TJSONObject ) ; virtual;
Properties
TJointRefDef
Ancestors
Members
Fields
- protected FIsStandalone :
Boolean
- protected FJoint :
TJointDef
- protected FController :
TControllerDef
- protected FWeights :
TArray<System.Single>
- protected FIndices :
TIntegerDynArray
- protected FLowerLimit :
TArray<System.Single>
- protected FUpperLimit :
TArray<System.Single>
- protected FInvBindMatrix :
TMatrix3D
- protected FInvBindMatAvail :
Boolean
Methods
- public constructor Create ( const AJoint : TJointDef; const AController : TControllerDef; const AIsStandalone : Boolean ) ;
- public destructor Destroy ( ) ;
- protected function GetIndex ( Index : Integer ) : Integer ;
- protected function GetLowerLimit ( Index : Integer ) : Single ;
- protected function GetUpperLimit ( Index : Integer ) : Single ;
- protected function GetWeight ( Index : Integer ) : Single ;
- protected procedure SetInvBindMatrix ( AValue : TMatrix3D ) ;
- protected function GetMesh ( ) : TMeshDef ;
- public function GetSize ( ) : Int64 ; override;
- public function ToJSON ( ) : TJSONObject ; override;
- public procedure FromJSON ( const AValue : TJSONObject ) ; override;
- public function IsSkeletonRoot ( const ASkin : TSkinDef ) : Boolean ;
- public procedure ApplyBindPose ( const ASkin : TSkinDef ) ; virtual;
- public function IsInvBindMatrixAvailable ( ) : Boolean ;
Properties
- public IsStandalone : Booleanread FIsStandalone
- public Joint : TJointDefread FJoint
- public Controller : TControllerDefread FController
- public Mesh : TMeshDefread GetMesh
- public Weights : TArray<System.Single>
- public Indices : TArray<System.Integer>
- public LowerLimit : TArray<System.Single>
- public UpperLimit : TArray<System.Single>
- public InvBindMatrix : TMatrix3D
TVertexJointsList
Ancestors
Members
Fields
Methods
- public constructor Create ( const ACapacity : Integer ) ;
- public destructor Destroy ( ) ;
- protected function GetItemPtr ( AIndex : Integer ) : PVertexJoints ;
- protected function GetItem ( AIndex : Integer ) : TVertexJoints ;
- public procedure SetItem ( const AIndex : Integer; const AValue : TVertexJoints ) ;
- public procedure Clear ( ) ;
- public function Count ( ) : Integer ;
Properties
TSkinDef
skin definition type
Ancestors
Members
Fields
- protected FController :
TControllerDef
- protected FLinkedJoints :
TJointRefDefList
- protected FSkeleton :
TJointRefDef
- protected FBindShapeMatrix :
TMatrix3D
- protected FBindPoses :
TMatrix3DDynArray
Methods
- public constructor Create ( AController : TControllerDef ) ;
- public destructor Destroy ( ) ;
- protected function GetMesh ( ) : TMeshDef ;
- protected procedure SetMesh ( AValue : TMeshDef ) ;
- protected procedure DoOnVertexJointsListValueNotify ( ASender : TObject; const AItem : TVertexJoints; AAction : TCollectionNotification ) ;
- public function GenerateVertexJoints ( const ABindShapeMatrix : TMatrix3D ) : TVertexJointsList ;
- public function BindShapeMatrixIsIdentity ( ) : Boolean ;
- public function LinkJoint ( const AJointRef : TJointRefDef ) : TJointRefDef ; overload;
- public function LinkJoint ( const AJoint : TJointDef; const ARefClass : TJointRefDefClass = nil ) : TJointRefDef ; overload;
- public function GetJointRef ( const AId : string ) : TJointRefDef ; overload;
- public function GetJointRef ( const AJoint : TJointDef ) : TJointRefDef ; overload;
- public function GetJointIndex ( const AId : string ) : Integer ;
- public function LinkedJointsToString ( ) : string ;
- public function GetSize ( ) : Int64 ; override;
- public function ToJSON ( ) : TJSONObject ; override;
- public procedure FromJSON ( const AValue : TJSONObject ) ; override;
Properties
TControllerDef
controller definition type by this type we can manage a subset of animations
Ancestors
Members
Fields
Methods
- public constructor Create ( const AMesh : TMeshDef ) ;
- public destructor Destroy ( ) ;
- public function GetJointRef ( const AId : string ) : TJointRefDef ; overload;
- public function GetJointRef ( const AJoint : TJointDef ) : TJointRefDef ; overload;
- public function GetSize ( ) : Int64 ; override;
- public function ToJSON ( ) : TJSONObject ; override;
- public procedure FromJSON ( const AValue : TJSONObject ) ; override;
Properties
TVertexIndexMap
TVertexIndexMap is a helper hash map for summarizing vertices with the same original index. Needed for example: triangulation happend on face-imports, order of vertices changed
Ancestors
Members
TCustomMeshDef
custom mesh definition type defines the basic information for a mesh or model
Ancestors
Members
Fields
- protected FOwner :
TMeshDef
- protected FVertexFormat :
TVertexFormats
- protected FIndexFormat :
TIndexFormat
- protected FIsStatic :
Boolean
- protected FBufferObject :
TMeshBufferObject
- protected FBoundingBoxUpdateNeeded :
Boolean
- protected FBoundingBox :
TBoundingBox
- protected FFaceNormals :
TPoint3DDynArray
- protected FVertexSource :
TVertexBuffer
- protected FIndexSource :
TIndexBuffer
- protected FVertexIndexMap :
TVertexIndexMap
- protected FMaterial :
TMaterialRefDef
Methods
- public constructor Create ( const AOwner : TMeshDef ) ;
- public destructor Destroy ( ) ;
- protected procedure SetMaterial ( AValue : TMaterialRefDef ) ; virtual;
- protected procedure SetIsStatic ( AValue : Boolean ) ; virtual;
- protected function GetIndexSource ( ) : TIndexBuffer ;
- protected function GetVertexSource ( ) : TVertexBuffer ;
- protected procedure CalculateTriNormal ( var Av1 : TVertexData; var Av2 : TVertexData; var Av3 : TVertexData ) ;
- public procedure BoundingBoxChanged ( ) ; virtual;
- public function GetBoundingBox ( ) : TBoundingBox ; virtual;
- public procedure SetVertexFormatByVertexData ( const AVertex : PVertexData ) ;
- public procedure SetVertices ( const AVertices : TVertexBuffer ) ;
- public procedure SetIndices ( const AIndices : TIndexBuffer ) ;
- public procedure AddVertices ( const AVertices : TVertexDataDynArray; const AIndex : Integer; const ACount : Integer ) ; virtual;
- public procedure AddIndices ( const AIndices : TIndexDataDynArray; const AIndex : Integer; const ACount : Integer; const AOffset : Integer = $0 ) ; overload virtual;
- public procedure AddIndices ( const ATriangles : TTriangleIndexDynArray; const AIndex : Integer; const ACount : Integer; const AOffset : Integer = $0 ) ; overload virtual;
- public procedure AddVertexIndexMap ( const AMap : TVertexIndexMap ) ; virtual;
- public procedure ApplyTransformation ( const AMatrix : TMatrix3D ) ; virtual;
- public function GetAbsoluteTransformation ( ) : TMatrix3D ; virtual;
- public procedure SetMaterialReference ( const AMaterial : TMaterialDef ) ; virtual;
- public function GetSize ( ) : Int64 ; override;
- public function ToJSON ( ) : TJSONObject ; override;
- public procedure FromJSON ( const AValue : TJSONObject ) ; override;
Properties
- public Owner : TMeshDef
- public VertexFormat : TVertexFormats
- public IndexFormat : TIndexFormatread FIndexFormat
- public IsStatic : Boolean
- public BufferObject : TMeshBufferObject
If there is a buffer object is used for buffering vertices & indices inside the graphics card, this object is available especially used for large models like terrains
read FBufferObject - public VertexSource : TVertexBuffer
Vertices buffer object where all vertex data is stored in a structure memory area
read GetVertexSource - public IndexSource : TIndexBuffer
Indices buffer object where all indices are stored in a list of integers (uint16 or uint32 - depending on platform settings)
read GetIndexSource - public VertexIndexMap : TVertexIndexMap
A map between original import format index and indices of vertex clones this is f.e. necessary when importing faces which will automatically be triangulated for OpenGLES. Therefor the vertices are used multiple times
read FVertexIndexMap - public Material : TMaterialRefDef
A possibly used material definition. This is just a reference to this specific material definition. Because in some import formats, like OBJ materials will be loaded afterwards the meshes. Therefor we need an ID for referencing.
read FMaterial
write SetMaterial
TMeshDef
internal mesh definition type by this type we can store vertex information, materials and shaders
Ancestors
Members
Fields
Methods
- public constructor Create ( const AOwner : TMeshDef ) ;
- public destructor Destroy ( ) ;
- protected procedure SetIsStatic ( AValue : Boolean ) ; override;
- protected function GetModel ( ) : TModelDef ;
- public procedure AddMesh ( const AMesh : TMeshDef ) ; virtual;
- public procedure RemoveMesh ( const AMesh : TMeshDef ) ; virtual;
- public function FindMeshById ( const AName : string; const AThrowException : Boolean ) : TMeshDef ; virtual;
- public procedure ApplyToMeshData ( const AData : TMeshData ) ; virtual;
- public procedure ApplyFromMeshData ( const AData : TMeshData ) ; virtual;
- public procedure CalcFaceNormals ( const PropagateFaceNormalsToVertices : Boolean = True ) ; virtual;
- public procedure CalcSmoothNormals ( const Method : TMeshDefCalculateNormalMethod; const WeldEpsilon : Single = 0.001 ) ; virtual;
- public procedure CalcTangentBinormals ( ) ; overload virtual;
- public procedure CalcTangentBinormals ( const AData : TMeshData ) ; overload virtual;
- public function GetSize ( ) : Int64 ; override;
- public function ToJSON ( ) : TJSONObject ; override;
- public procedure FromJSON ( const AValue : TJSONObject ) ; override;
- public procedure AcquireBVH
(
)
;
virtual;
Create bounding volume hierarchy from current mesh vertices. If the BVH was already created, the method exits. Use UpdateBVH to destroy the an existing BVH and create a new one.
- public procedure UpdateBVH
(
)
;
virtual;
Destroys an eventually created BVH and creates a new one.
- public procedure ReleaseBVH
(
)
;
virtual;
Destroy a previously created bounding volume hierarchy.
- public function RayCastIntersect ( const ARayPos : TPoint3D; const ARayDir : TPoint3D; var AIntersection : TPoint3D; var ANormal : TPoint3D ) : Boolean ; virtual;
Properties
TModelDef
internal model definition type by this type we can group mesh definitions
Ancestors
Members
Fields
- protected FPackage :
TObject
- protected FFilename :
string
- protected FMaterials :
TMaterialDefMap
- protected FHumanoids :
THumanoidDefList
- protected FControllers :
TControllerDefList
- protected FAnimations :
TAnimationDefList
- protected FCurrentAnimation :
TAnimationDef
Methods
- public constructor Create ( const AOwner : TMeshDef; const APackage : TObject ) ;
- public destructor Destroy ( ) ;
- protected procedure DoOnMaterialNotify ( ASender : TObject; const AItem : TMaterialDef; AAction : TCollectionNotification ) ;
- protected procedure DoOnJointNotify ( ASender : TObject; const AItem : TJointDef; AAction : TCollectionNotification ) ;
- public procedure CalcFaceNormals ( const PropagateFaceNormalsToVertices : Boolean = True ) ; override;
- public procedure CalcSmoothNormals ( const Method : TMeshDefCalculateNormalMethod; const WeldEpsilon : Single = 0.001 ) ; override;
- public procedure CalcTangentBinormals ( ) ; overload override;
- public procedure AddMaterial ( const AId : string; AMaterial : TMaterialDef ) ;
- public function GetMaterial ( const AId : string ) : TMaterialDef ;
- public procedure AddController ( const AController : TControllerDef ) ;
- public procedure AddHumanoid ( const AHumanoid : THumanoidDef ) ;
- public function GetHumanoidBySkeleton ( const ASkeletonJoint : TJointDef ) : THumanoidDef ;
- public procedure AddAnimation ( const AAnimation : TAnimationDef ) ;
- public function AddEmptyAnimation ( const AId : string ) : TAnimationDef ;
- public procedure CacheAnimations ( const ASelected : array of TVarRec; const AFlags : TAnimationCachingFlags = [] ; const AModel : TComponent = nil ) ;
- public function FindControllerById ( const AName : string ) : TControllerDef ; virtual;
- public function FindControllerByMesh ( const AMesh : TMeshDef ) : TControllerDef ; virtual;
- public function FindJointById ( const AName : string ) : TJointDef ; virtual;
- public function FindAnimationById ( const AName : string ) : TAnimationDef ; virtual;
- public function GetSize ( ) : Int64 ; override;
- public function ToJSON ( ) : TJSONObject ; override;
- public procedure FromJSON ( const AValue : TJSONObject ) ; override;
Properties
- public Package : TObject
- public Filename : string
- public Materials : TDictionary<System.string,Gorilla.DefTypes.TMaterialDef>read FMaterials
- public Humanoids : TObjectList<Gorilla.DefTypes.THumanoidDef>read FHumanoids
- public Controllers : TObjectList<Gorilla.DefTypes.TControllerDef>read FControllers
- public Animations : TObjectList<Gorilla.DefTypes.TAnimationDef>read FAnimations
- public CurrentAnimation : TAnimationDef
TVertexCache
Ancestors
Members
Fields
- protected FDestroyed :
Boolean
- protected FPositionSource :
TList<System.Math.Vectors.TPoint3D>
- protected FNormalSource :
TList<System.Math.Vectors.TPoint3D>
- protected FBiNormalSource :
TList<System.Math.Vectors.TPoint3D>
- protected FTangentSource :
TList<System.Math.Vectors.TPoint3D>
- protected FTextureSource :
:TVertexCache.:1
- protected FColorSource :
:TVertexCache.:2
- protected FIndexMap :
TVertexIndexMap
- protected FVertexMap :
TCachedVertexMap
- protected FVertices :
TVertexDataList
- protected FIndices :
TList<Gorilla.DefTypes.TTriangleIndex>
- protected FUseBuffersAsArray :
Boolean
Methods
- public constructor Create ( ) ;
- public destructor Destroy ( ) ;
- protected function GetTextureSourceArray ( AIndex : Integer ) : TList<System.Types.TPointF> ;
- protected function GetColorSourceArray ( AIndex : Integer ) : TList<System.UITypes.TAlphaColorF> ;
- public procedure ClearAll ( ) ; virtual;
- public procedure DoOnCreateSubMesh ( AMesh : TMeshDef; ASubMesh : TMeshDef ) ; virtual;
- public function DoOnCreateDefaultMaterial ( AMesh : TMeshDef ) : TMaterialDef ; virtual;
- public function DoOnCreateMaterialRef ( AMesh : TMeshDef; AMaterial : TMaterialDef ) : TMaterialRefDef ; virtual;
- public function GetVertex
(
const
AVertex :
TVertexID
)
: TVertexData
;
Fills up VertexData record based on PositionSource, NormalSource, ... by submitted VertexID values
- public function AddTriangle
(
const
AIndexOffset :
Integer; const
ATriangle :
TTriangleID; const
AVertices :
TVertexDataList; const
AIndices :
TList<Gorilla.DefTypes.TTriangleIndex>
)
: Integer
;
Adds triangle vertices and indices to AVertices and AIndices based on the index values inside of TTriangleID VertexData values are taken from Cache.PositionSource and so on...
- public function AddPolygon
(
const
AIndexOffset :
Integer; const
APolygon :
TPolygonID; const
AVertices :
TVertexDataList; const
AIndices :
TList<Gorilla.DefTypes.TTriangleIndex>
)
: Integer
;
Adds polygon vertices and indices to AVertices and AIndices based on the index values inside of TPolygonID VertexData values are taken from Cache.PositionSource and so on... CAUTION: this method triangulates the polygon automatically! f.e. a face-poly will produce two triangles
- public procedure SetPositionSource ( const ASource : TSingleDynArray ) ;
- public procedure SetNormalSource ( const ASource : TSingleDynArray ) ;
- public procedure SetTextureSource ( AIndex : Integer; const ASource : TSingleDynArray; const AConvertToUV : Boolean; AStride : Integer = $2 ) ;
- public procedure SetBiNormalSource ( const ASource : TSingleDynArray ) ;
- public procedure SetTangentSource ( const ASource : TSingleDynArray ) ;
- public procedure SetColorSource ( AIndex : Integer; const ASource : TSingleDynArray ) ;
- public function AddPositionSource ( const ASource : TSingleDynArray ) : Integer ; overload;
- public function AddPositionSource ( const ASource : TPoint3D ) : Integer ; overload;
- public function AddNormalSource ( const ASource : TSingleDynArray ) : Integer ; overload;
- public function AddNormalSource ( const ASource : TPoint3D ) : Integer ; overload;
- public function AddBinormalSource ( const ASource : TSingleDynArray ) : Integer ; overload;
- public function AddBinormalSource ( const ASource : TPoint3D ) : Integer ; overload;
- public function AddTangentSource ( const ASource : TSingleDynArray ) : Integer ; overload;
- public function AddTangentSource ( const ASource : TVector3DDynArray ) : Integer ; overload;
- public function AddTangentSource ( const ASource : TPoint3D ) : Integer ; overload;
- public function AddTextureSource ( AIndex : Integer; const ASource : TSingleDynArray; const AConvertToUV : Boolean ) : Integer ; overload;
- public function AddTextureSource ( AIndex : Integer; const ASource : TPointF; const AConvertToUV : Boolean ) : Integer ; overload;
- public function AddColorSource ( AIndex : Integer; const ASource : TSingleDynArray ) : Integer ; overload;
- public function AddColorSource ( AIndex : Integer; const ASource : TAlphaColorF ) : Integer ; overload;
Properties
- public Destroyed : Booleanread FDestroyed
- public UseBuffersAsArray : Boolean
- public PositionSource : TList<System.Math.Vectors.TPoint3D>read FPositionSource
- public NormalSource : TList<System.Math.Vectors.TPoint3D>read FNormalSource
- public BinormalSource : TList<System.Math.Vectors.TPoint3D>read FBiNormalSource
- public TangentSource : TList<System.Math.Vectors.TPoint3D>read FTangentSource
- public TextureSource[Index] : :1
- public ColorSource[Index] : :1read GetColorSourceArray
- public IndexMap : TVertexIndexMapread FIndexMap
- public Vertices : TList<Gorilla.DefTypes.TVertexData>read FVertices
- public Indices : TList<Gorilla.DefTypes.TTriangleIndex>read FIndices