Gorilla.DefTypes
Unit Gorilla.DefTypes.pasClasses
- TGorillaBitmapCacheEntry = class ( TCollectionItem )
- TGorillaBitmapCache = class ( TOwnedCollection )
- TCacheList`1 = class ( TObject )
- TCustomDef = class ( TObject )
- TMetaDef = class ( TCustomDef )
- TModelMetaDef = class ( TMetaDef )
- 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 )
- TSegmentDef = class ( TTransformDef )
- TArmatureDef = class ( TTransformDef )
- 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 )
- TVertexGroupDef = class ( TMeshDef )
- TLightDef = class ( TTransformDef )
- TCameraDef = class ( TTransformDef )
- TModelDef = class ( TMeshDef )
- TVertexCache = class ( TObject )
Records
- record TGorillaFileInfo
- record TGorillaLoadStorage
- record TGorillaLoadOptions
- record TFaceIndex
- record TVertexIDTextures
- record TVertexIDColors
- record TVertexID
- record TVertexData
- record TPolygon3D
- record TMeshDefVertexSmoothNormalInfo
- record TVertexJoints
- record TRegisteredTransformClasses
Enumerations
- enum TGorillaFileOpenFormat = ( fofLocal, fofDownload ) ;
- enum TAnimationCachingFlag = ( AllAttributes, Compressed, VertexPosition ) ;
- enum TFaceIndexKind = ( Triangle, Quad, Polygon ) ;
- enum TVertexDataFlag = ( CalcNormals, CalcTangents, CalcTexCoords ) ;
- enum TVertexOrder = ( CW, CCW ) ;
- enum TFaceOrientation = ( FrontFace, BackFace, TwoFace ) ;
- enum TMeshDefCalculateNormalMethod = ( cnmDefault, cnmFastest, cnmSlowest ) ;
- enum TJSONVertexDataType = ( jvdtBinary, jvdtValues ) ;
- enum TColorChannelDef = ( Diffuse, Ambient, Emissive, Specular, Normal, Opacity, Reflection, Refraction, Environment, Lightmap, Displacement, Metalness, Roughness, AO, HeightMap ) ;
- enum TTextureFlipping = ( Vertical, Horizontal ) ;
- enum TMaterialDefKind = ( mkDefault, mkColor, mkLambert, mkPhong, mkBlinnPhong, mkNormalMap, mkBumpMap, mkLayered, mkVertexColor, mkCustom, mkPBR ) ;
- enum TGorillaShadingModel = ( smLambert, smPhong, smBlinnPhong, smPBR ) ;
- enum TAnimationKeyInterpolationType = ( Linear, Quadratic, Cubic, Quartic, Quintic, Sinusoidal, Exponential, Circular, Elastic, Back, Bounce ) ;
- enum TKeyUnifyFlag = ( AbsoluteKeyTransform, EqualBaseTransformCheck, InverseTransform, InverseBaseTransform, EvaluateGlobalTransform ) ;
- enum TAnimationBufferingState = ( None, Started, Caching, Cached, Ready ) ;
- enum TUnifyInterpolatorOption = ( EulerXYZ, EulerYXZ, EulerZXY, EulerZYX, EulerYZX, EulerXZY ) ;
- enum TCopyVertexOption = ( ExchangeYZ, ExchangeYX, ExchangeXZ ) ;
- enum TCameraType = ( PerspectiveCamera, OrthographicCamera ) ;
Constants
- const GORILLA_POLYGON_MAXSIZE : Integer = $C;
- const GORILLA_ARRAY_TEXTURE_MAX : Integer = $20;
- const GORILLA_ARRAY_COLOR_MAX : Integer = $4;
- const GORILLA_MAX_JOINTS_PER_VERTEX : Integer = $10;
- 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_SEGMENT_ID_FORMAT : string = "%%s_Seg";
- const GORILLA_ANIMATION_CACHING_DEFAULT : TAnimationCachingFlags = ;
- const GORILLA_ANIMATION_CACHING_COMPRESSEDEX : TAnimationCachingFlags = ;
- const NullVertexID : TVertexID = ;
- const GORILLA_TRANSFORM_CLASSES : :04 = ;
Mics. types
- type TFloatType = Float;
- type TIndexType = word;
- type TTriangleID = array [0..2] of TVertexID;
- type TPolygonID = array of TVertexID;
- type T3DPolygon = array of TPoint3D;
- 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 TTransformDefClass = class of TTransformDef;
- type TJointRefDefClass = class of TJointRefDef;
- type PVertexJoints = pointer to TVertexJoints;
- type TMeshDefClass = class of TMeshDef;
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 ;
TGorillaFileOpenFormat
Defines the way Gorilla3D opens the file. fofLocal - this is the default value, if the file should be loaded from local harddrive. fofDownload - use this mode for download formats like sketchfab. the format itself will after the download open the file from cache or harddrive.
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.TVertexOrder
Defines the order vertices are added to triangles or polygons.
Remarks
CW - Clockwise Vertex Order = [0, 2, 1]
CCW - Counter Clockwise Vertex Order = [1, 2, 0]
TFaceOrientation
Defines which face orientation should be rendered.
TColorChannelDef
Color Channel definition diffuse, ambient, emissive, specular, normal
TKeyUnifyFlag
Temporary interpolator unification flags. Due to some formats like FBX, where different versions need different unification treatment, we need some further information on how to unify.
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
TUnifyInterpolatorOption
Available options to auto-modify transformations in UnifyInterpolators() method.
TGorillaLoadOptions
Fields
- public FileInfo :
TGorillaFileInfo
- public Package :
TObject
- public Asset :
TObject
- public ImportLights :
Boolean
- public ImportCameras :
Boolean
- public ImportAnimations :
Boolean
- public AdditionalAnimations :
TArray<System.string>
- public Caching :
TAnimationCachingFlags
- public OnStatus :
TGorillaLoadingStatus
- public ExtractDirectory :
string
- public BitmapCache :
TGorillaBitmapCache
- public TextureLimits :
TPoint
- public Storage :
TArray<Gorilla.DefTypes.TGorillaLoadStorage>
Methods
- public constructor Create ( APathOrUID : string; APackage : TObject = nil ; AAsset : TObject = nil ) ; public constructor Create ( APathOrUID : string; AExt : string; APackage : TObject = nil ; AAsset : TObject = nil ) ; public constructor Create ( APathOrUID : string; ACaching : TAnimationCachingFlags; APackage : TObject = nil ; AAsset : TObject = nil ) ; public constructor Create ( APathOrUID : string; ACaching : TAnimationCachingFlags; AOnStatus : TGorillaLoadingStatus = nil ; APackage : TObject = nil ; AAsset : TObject = nil ) ;
- public function GetExtension ( ) : string ;
- public function AddAnimation ( const AFilename : string ) : Integer ;
- public function AddStorage ( const AName : string; const AStream : TStream ) : Integer ;
- public function GetStorage ( const AName : string ) : TStream ;
TVertexData
TVertexJoints
Fields
Methods
TGorillaBitmapCacheEntry
Ancestors
Members
Fields
Methods
- public constructor Create ( ACollection : TCollection ) ;
- public destructor Destroy ( ) ;
- protected function GetBitmap ( ) : TBitmap ;
- protected procedure SetBitmap ( const AValue : TBitmap ) ;
- protected function GetFileName ( ) : string ;
- protected procedure SetFileName ( const AValue : string ) ;
- protected procedure AssignTo ( Dest : TPersistent ) ; override;
- public procedure SetBitmapReference
(
const
AFilename :
string; AReference :
TBitmap
)
;
This should be called by TModelDef/TMaterialDef instances on loading modal / material data.
Properties
- public IsOnlyRef : Boolean
Returns if the containing TBitmap instance is only a referenced bitmap from another instance.
read FIsOnlyRef
write FIsOnlyRef - published Filename : string
- published Bitmap : TBitmap
TGorillaBitmapCache
Defines a storage for texture bitmaps. This can be applied when loading at designtime without any assets package.
Ancestors
Members
TCacheList`1
Ancestors
Members
Fields
Methods
- public constructor Create ( ) ;
- public destructor Destroy ( ) ;
- protected function GetItem ( AIndex : Integer ) : T ;
- protected procedure SetItem ( AIndex : Integer; AValue : T ) ;
- protected procedure AdjustSize ( ANewItems : Integer = $1 ) ;
- public function Add ( AValue : T ) : Integer ;
- public procedure AddRange ( AArray : :1 ) ;
- public procedure Clear ( ) ;
- public function ToArray ( ) ;
- public function GetMemorySize ( ) : Int64 ;
Properties
TCustomDef
default definition type as basis for all other types
Ancestors
Members
Fields
Methods
- public constructor Create ( ) ;
- public destructor Destroy ( ) ;
- protected function ReadOptionalJsonValue ( AJson : TJSONObject; AProp : string; ADefault : string ) : string ;
- protected function ReadOptionalJsonString ( AJson : TJSONObject; AProp : string; ADefault : string ) : string ;
- protected function ReadOptionalJsonDouble ( AJson : TJSONObject; AProp : string; ADefault : Double ) : Double ;
- protected function ReadOptionalJsonInteger ( AJson : TJSONObject; AProp : string; ADefault : Integer ) : Integer ;
- protected function ReadOptionalJsonBoolean ( AJson : TJSONObject; AProp : string; ADefault : Boolean ) : Boolean ;
- protected function ReadOptionalJsonPoint3D ( AJson : TJSONObject; AProp : string; ADefault : TPoint3D ) : TPoint3D ;
- protected function ReadOptionalJsonMatrix3D ( AJson : TJSONObject; AProp : string; ADefault : TMatrix3D ) : TMatrix3D ;
- protected function ReadOptionalJsonColorF ( AJson : TJSONObject; AProp : string; ADefault : TAlphaColorF ) : TAlphaColorF ;
- protected function ReadOptionalJsonGUID ( AJson : TJSONObject; AProp : string; ADefault : TGUID ) : TGUID ;
- protected function JsonPropertyAvailable ( AJson : TJSONObject; AProp : string ) : Boolean ;
- protected function JsonPropertyTypeAvailable ( AJson : TJSONObject; AProp : string; AType : TClass ) : Boolean ;
- public function GetSize ( ) : Int64 ; virtual;
- public function GetAssetsPackage ( ) : TObject ; virtual;
- public function ToJSON ( ) : TJSONObject ; virtual;
- public procedure FromJSON ( const AModel : TModelDef; const AValue : TJSONObject ) ; virtual;
- public function LateResolveFromJSON ( const AModel : TModelDef; const AValue : TJSONObject ) : Boolean ; virtual;
Properties
TMetaDef
Ancestors
Members
Fields
Methods
- public constructor Create ( ) ;
- public destructor Destroy ( ) ;
- protected function GetTag ( AIndex : string ) : TValue ;
- protected procedure SetTag ( AIndex : string; const AValue : TValue ) ;
- protected function GetTagAsString ( AIndex : string ) : string ;
- protected procedure SetTagAsString ( AIndex : string; const AValue : string ) ;
- protected function GetTagAsInt ( AIndex : string ) : NativeInt ;
- protected procedure SetTagAsInt ( AIndex : string; const AValue : NativeInt ) ;
- protected function GetTagAsFloat ( AIndex : string ) : Double ;
- protected procedure SetTagAsFloat ( AIndex : string; const AValue : Double ) ;
- protected function GetTagAsBool ( AIndex : string ) : Boolean ;
- protected procedure SetTagAsBool ( AIndex : string; const AValue : Boolean ) ;
- public procedure Clear ( ) ;
- public procedure FromJSON ( const AModel : TModelDef; const AValue : TJSONObject ) ; override;
- public function ToJSON ( ) : TJSONObject ; override;
Properties
TModelMetaDef
Ancestors
Members
Methods
- protected function GetTitle ( ) : string ;
- protected procedure SetTitle ( const AValue : string ) ;
- protected function GetDescr ( ) : string ;
- protected procedure SetDescr ( const AValue : string ) ;
- protected function GetAuthor ( ) : string ;
- protected procedure SetAuthor ( const AValue : string ) ;
- protected function GetLicense ( ) : string ;
- protected procedure SetLicense ( const AValue : string ) ;
- protected function GetPolygons ( ) : NativeInt ;
- protected procedure SetPolygons ( const AValue : NativeInt ) ;
- protected function GetVertices ( ) : NativeInt ;
- protected procedure SetVertices ( const AValue : NativeInt ) ;
- protected function GetMobileSuitable ( ) : Boolean ;
- protected procedure SetMobileSuitable ( const AValue : Boolean ) ;
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 FAssetRef :
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 ( ) ;
- protected function GetAssetRefObj ( ) : TObject ;
- protected procedure SetAssetRefObj ( AValue : TObject ) ;
- protected procedure SetAssetRefObjDrectly ( AValue : TObject ) ;
- protected function TryGetAssetsRef ( AValue : TObject ) : TObject ;
- public function GetAssetBitmapInstance ( ADoClone : Boolean = False ) : TBitmap ;
- public function GetSize ( ) : Int64 ; override;
- public function GetAssetsPackage ( ) : TObject ; override;
- public function ToJSON ( ) : TJSONObject ; override;
- public procedure FromJSON ( const AModel : TModelDef; 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 AssetRef : 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 FShadingModel :
TGorillaShadingModel
- protected FUseTexturing :
Boolean
- protected FUseTexture0 :
Boolean
- protected FUseLighting :
Boolean
- protected FUseVertexColor :
Boolean
- protected FUseSpecular :
Boolean
- protected FDiffuse :
TAlphaColorF
- protected FAmbient :
TAlphaColorF
- protected FEmissive :
TAlphaColorF
- protected FSpecular :
TAlphaColorF
- protected FSpecPow :
Single
- protected FReflectionColor :
TAlphaColorF
- protected FReflectionPower :
Single
- protected FUseReflection :
Boolean
- protected FRefractionColor :
TAlphaColorF
- protected FRefractionPower :
Single
- protected FUseRefraction :
Boolean
- protected FMetallic :
Single
- protected FRoughness :
Single
- protected FAO :
Single
- protected FUseClipping :
Boolean
- protected FClipping :
TAlphaColorF
- protected FUseAlphaCutoff :
Boolean
- protected FAlphaCutoff :
Single
- protected FTextures :
TTextureDefList
- protected FShaders :
TShaderDefList
- protected FMaterials :
TMaterialDefList
- protected FUseOpacity :
Boolean
- protected FOpacity :
Single
- protected FDoubleSided :
Boolean
Methods
- public constructor Create ( const AModel : TModelDef; const AId : string ) ;
- public destructor Destroy ( ) ;
- protected function GetModel ( ) : TModelDef ;
- 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 function TextureChannelExists ( const AChannel : TColorChannelDef ) : Boolean ;
- 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 AModel : TModelDef; const AValue : TJSONObject ) ; override;
Properties
- public Model : TModelDefread GetModel
- public Kind : TMaterialDefKind
- public ShadingModel : TGorillaShadingModel
- public UseTexturing : Boolean
- public UseTexture0 : Boolean
- public UseLighting : Boolean
- public UseVertexColor : Boolean
- public UseSpecular : Boolean
- public Diffuse : TAlphaColorF
- public Ambient : TAlphaColorF
- public Emissive : TAlphaColorF
- public Specular : TAlphaColorF
- public SpecPow : Single
- public ReflectionColor : TAlphaColorF
- public ReflectionPower : Single
- public UseReflection : Boolean
- public RefractionColor : TAlphaColorF
- public RefractionPower : Single
- public UseRefraction : Boolean
- public Metallic : Single
- public Roughness : Single
- public AO : Single
- public UseClipping : Boolean
- public Clipping : TAlphaColorF
- public UseAlphaCutoff : Boolean
- public AlphaCutoff : Single
- public Textures : TObjectList<Gorilla.DefTypes.TTextureDef>read FTextures
- public Shaders : TObjectList<Gorilla.DefTypes.TShaderDef>read FShaders
- public Materials : TObjectList<Gorilla.DefTypes.TMaterialDef>read FMaterials
- public UseOpacity : Boolean
If UseOpacity is set to TRUE, the mesh with this specific material will be rendered translucent. You can than control transparency by the opacity value.
read FUseOpacity
write FUseOpacity - public Opacity : Single
- public DoubleSided : Boolean
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 AModel : TModelDef; 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 : TFloatDynArray; const AKeyValues : ; const AIntVals : TAnimationKeyInterpolationDynArray ) ; virtual;
- public function GetSize ( ) : Int64 ; override;
- public function ToJSON ( ) : TJSONObject ; override;
- public procedure FromJSON ( const AModel : TModelDef; const AValue : TJSONObject ) ; override;
- public procedure NormalizeKeyTimeValues
(
)
;
This method normalizes key time-values to a relative time-range between 0.0 - 1.0. It also sets the Duration property to the real animation length. Firemonkey animations will only work correctly with relative / normalized timestamps.
- public function FindKeys
(
ADelta :
Single; out
AKeyStart :
; out
AKeyStop :
)
: Boolean
;
Tries to find a start and stop key referred to a submitted delta value (0.0 - 1.0). The method returns FALSE, if no valid keys can be found.
- public function ComputeInterpolatedKey
(
ADelta :
Single; var
AKey :
Single; var
AInterpolation :
TInterpolationType; var
AValue :
T
)
: Boolean
;
abstract virtual;
You can produce virtual keys by linear interpolation.
Properties
- public Stage : TAnimationStageDefread FStage
- public Duration : Single
- public Loop : Boolean
- public Path : string
- public Keys : TObjectList<System.TObject>
Normalized key values. Normalized means, that time values are in range from 0.0 - 1.0 in duration space. While the Duration property holds the length of animation in seconds, the key time-value holds a relative timestamp on that.
read FKeys
TPoint3DInterpolatorDef
position interpolation definition type by this type an interpolation of the coordinate position is described
Ancestors
Members
Methods
- public constructor Create ( const AStage : TAnimationStageDef ) ;
- protected function SerializeValue ( const AValue : TPoint3D ) : TJSONValue ;
- protected function UnserializeValue ( const AValue : TJSONValue ) : TPoint3D ;
- public function ComputeInterpolatedKey ( ADelta : Single; var AKey : Single; var AInterpolation : TInterpolationType; var AValue : TPoint3D ) : Boolean ; override;
TVector3DInterpolatorDef
orientation interpolation definition type by this type an interpolation of the coordinate rotation is described
Ancestors
Members
Methods
- public constructor Create ( const AStage : TAnimationStageDef ) ;
- protected function SerializeValue ( const AValue : TVector3D ) : TJSONValue ;
- protected function UnserializeValue ( const AValue : TJSONValue ) : TVector3D ;
- public function ComputeInterpolatedKey ( ADelta : Single; var AKey : Single; var AInterpolation : TInterpolationType; var AValue : TVector3D ) : Boolean ; override;
TQuaternion3DInterpolatorDef
rotation interpolation definition type by this type an interpolation of the coordinate rotation is described
Ancestors
Members
Methods
- public constructor Create ( const AStage : TAnimationStageDef ) ;
- protected function SerializeValue ( const AValue : TQuaternion3D ) : TJSONValue ;
- protected function UnserializeValue ( const AValue : TJSONValue ) : TQuaternion3D ;
- public function ComputeInterpolatedKey ( ADelta : Single; var AKey : Single; var AInterpolation : TInterpolationType; var AValue : TQuaternion3D ) : Boolean ; override;
TTransformationInterpolatorDef
transformation interpolation definition type by this type an interpolation of position, rotation and scaling is possible
Ancestors
Members
Methods
- public constructor Create ( const AStage : TAnimationStageDef ) ;
- protected function SerializeValue ( const AValue : TMatrix3D ) : TJSONValue ;
- protected function UnserializeValue ( const AValue : TJSONValue ) : TMatrix3D ;
- public function ComputeInterpolatedKey ( ADelta : Single; var AKey : Single; var AInterpolation : TInterpolationType; var AValue : TMatrix3D ) : Boolean ; override;
TMeshInterpolatorDef
vertex interpolation definition type by this type an interpolation of multiple coordinates are possible
Ancestors
Members
Methods
- public constructor Create ( const AStage : TAnimationStageDef ) ;
- protected function SerializeValue ( const AValue : TPoint3DDynArray ) : TJSONValue ;
- protected function UnserializeValue ( const AValue : TJSONValue ) : TPoint3DDynArray ;
- public function ComputeInterpolatedKey ( ADelta : Single; var AKey : Single; var AInterpolation : TInterpolationType; var AValue : TPoint3DDynArray ) : Boolean ; override;
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
- protected FKeyUnifyFlags :
TKeyUnifyFlags
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 AModel : TModelDef; 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 AModel : TModelDef; 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
(
AOptions :
TUnifyInterpolatorOptions
=
[]
; ACallback :
TUnifyInterpolatorTransformationProc
=
nil
)
;
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. This allows to reduce single animation instances to a minimum and increases runtime performance.
- public procedure Cache ( const ACache : TObject ) ;
- 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
Fields
- protected FOwnerId :
string
- protected FOwner :
TCustomDef
- protected FTransform :
TMatrix3D
- protected FChildren :
TTransformDefList
- protected FCopyCount :
Integer
Methods
- public constructor Create ( AOwner : TCustomDef ) ;
- public destructor Destroy ( ) ;
- protected procedure DoSetOwner ( AValue : TCustomDef ) ; virtual;
- protected function GetOwner ( ) : TTransformDef ; virtual;
- protected procedure SetOwner ( const AValue : TTransformDef ) ; virtual;
- public procedure IncCopyCount ( ) ;
- public function GetQualifiedComponentName ( ) : string ; virtual;
- public function GetModel ( ) : TModelDef ; virtual;
- public function GetOwnerRef ( ) : TCustomDef ; virtual;
- public procedure SetOwnerRef ( const AValue : TCustomDef ) ; virtual;
- public function AddChild ( ATransform : TTransformDef ) : Integer ; virtual;
- public procedure RemoveChild ( ATransform : TTransformDef ) ; virtual;
- public procedure ClearChildren ( ) ; virtual;
- public function FindChildById ( const AId : string; const AThrowException : Boolean ) : TTransformDef ; virtual;
- public procedure Traverse ( ADeepTraverse : Boolean; AProc : TTransformTraverseProc ) ;
- public procedure AddMesh ( const AMesh : TMeshDef ) ; virtual;
- public function GetAbsoluteTransformation ( ) : TMatrix3D ; virtual;
- public function EvaluateGlobalTransformation ( ) : TMatrix3D ; virtual;
- public function ToJSON ( ) : TJSONObject ; override;
- public procedure FromJSON ( const AModel : TModelDef; const AValue : TJSONObject ) ; override;
Properties
TSegmentDef
We need a placeholder definition in mesh hierarchy to allow meshes to be attached to joints or armatures.
Ancestors
Members
Fields
Methods
- public constructor Create ( const AOwner : TTransformDef ) ;
- public function ToJSON ( ) : TJSONObject ; override;
- public procedure FromJSON ( const AModel : TModelDef; const AValue : TJSONObject ) ; override;
Properties
- public ReferenceId : string
For late resolving we need this property to store the id of the reference.
read FReferenceId
write FReferenceId - public Reference : TTransformDef
TArmatureDef
Ancestors
Members
Fields
- protected FRoot :
TJointDef
- protected FControllers :
TControllerDefList
- protected FJointsCount :
Integer
Methods
- public constructor Create ( const AModel : TModelDef ) ;
- public destructor Destroy ( ) ;
- public function GetModel ( ) : TModelDef ; override;
- public procedure SetModel ( AValue : TModelDef ) ;
- public function ToJSON ( ) : TJSONObject ; override;
- public procedure FromJSON ( const AModel : TModelDef; const AValue : TJSONObject ) ; override;
- public function LateResolveFromJSON ( const AModel : TModelDef; const AValue : TJSONObject ) : Boolean ; override;
- public function FindJointById ( const AId : string ) : TJointDef ;
- public procedure AddController ( const ACtrl : TControllerDef ) ;
- public function FindControllerByTransform ( ATransform : TTransformDef ) : TControllerDef ;
Properties
THumanoidDef
Ancestors
Members
Fields
- protected FRoot :
TJointDef
- protected FControllers :
TControllerDefList
- protected FJointsCount :
Integer
Methods
- public constructor Create ( const AModel : TModelDef ) ;
- public destructor Destroy ( ) ;
- public function GetModel ( ) : TModelDef ; override;
- public procedure SetModel ( AValue : TModelDef ) ;
- public function ToJSON ( ) : TJSONObject ; override;
- public procedure FromJSON ( const AModel : TModelDef; const AValue : TJSONObject ) ; override;
- public function LateResolveFromJSON ( const AModel : TModelDef; const AValue : TJSONObject ) : Boolean ; override;
- public function FindJointById ( const AId : string ) : TJointDef ;
- public procedure AddController ( const ACtrl : TControllerDef ) ;
- public function FindControllerByTransform ( ATransform : TTransformDef ) : TControllerDef ;
Properties
TJointDef
Ancestors
Members
Fields
Methods
- public constructor Create ( const AArmature : TArmatureDef ) ;
- public destructor Destroy ( ) ;
- protected procedure SetArmature ( AValue : TArmatureDef ) ;
- protected function GetArmatureIndex ( ) : Integer ;
- protected procedure SetArmatureIndex ( AValue : Integer ) ;
- protected function GetHumanoid ( ) : TArmatureDef ;
- protected procedure SetHumanoid ( AValue : TArmatureDef ) ;
- protected function GetHumanoidIndex ( ) : Integer ;
- protected procedure SetHumanoidIndex ( AValue : Integer ) ;
- protected procedure DoOnJointsValueNotify ( ASender : TObject; const AItem : TJointDef; AAction : TCollectionNotification ) ;
- public function GetModel ( ) : TModelDef ; override;
- public function GetArmature ( ) : TArmatureDef ;
- public procedure AddJoint ( const AJoint : TJointDef ) ;
- public function FindJointById ( const AId : string ) : TJointDef ;
- public function JointsCount ( ) : Integer ;
- public function EvaluateGlobalTransformation ( ) : TMatrix3D ; override;
- public function GetSize ( ) : Int64 ; override;
- public function ToJSON ( ) : TJSONObject ; override;
- public procedure FromJSON ( const AModel : TModelDef; const AValue : TJSONObject ) ; virtual;
Properties
TJointRefDef
Ancestors
Members
Fields
- protected FLinkIndex :
Integer
- protected FIsStandalone :
Boolean
- protected FJoint :
TJointDef
- protected FController :
TControllerDef
- protected FWeights :
TFloatDynArray
- protected FIndices :
TIntegerDynArray
- protected FLowerLimit :
TFloatDynArray
- protected FUpperLimit :
TFloatDynArray
- 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 GetTarget ( ) : TTransformDef ;
- public function GetSize ( ) : Int64 ; override;
- public function ToJSON ( ) : TJSONObject ; override;
- public procedure FromJSON ( const AModel : TModelDef; const AValue : TJSONObject ) ; override;
- public function IsSkeletonRoot ( const ASkin : TSkinDef ) : Boolean ;
- public procedure ApplyBindPose ( const ASkin : TSkinDef ) ; virtual;
- public function IsInvBindMatrixAvailable ( ) : Boolean ;
- public function EvaluateGlobalTransformation ( ) : TMatrix3D ;
- public procedure ClearWeightsAndIndices ( ALength : Integer ) ;
- public procedure AdjustLengthOfWeightsAndIndices ( ALength : Integer ) ;
Properties
- public LinkIndex : Integer
The link index is set on calling LinkJoint() method and is not used for any identification. But it is very useful for lists to find a joint reference very fast.
read FLinkIndex - public IsStandalone : Booleanread FIsStandalone
- public Joint : TJointDefread FJoint
- public Controller : TControllerDefread FController
- public Target : TTransformDefread GetTarget
- 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 ( AController : TControllerDef; 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 FLinkedJoints :
TJointRefDefList
- protected FSkeletons :
TJointRefDefList
- protected FBindShapeMatrix :
TMatrix3D
- protected FBindPoses :
TMatrix3DDynArray
Methods
- public constructor Create ( AController : TControllerDef ) ;
- public destructor Destroy ( ) ;
- protected function GetController ( ) : TControllerDef ;
- protected procedure SetController ( AValue : TControllerDef ) ;
- protected function GetTarget ( ) : TTransformDef ;
- protected procedure SetTarget ( AValue : TTransformDef ) ;
- protected procedure DoOnVertexJointsListValueNotify ( ASender : TObject; const AItem : TVertexJoints; AAction : TCollectionNotification ) ;
- public procedure AdjustBindPosesArrayLength ( AIndex : Integer ) ;
- public procedure SetBindPosesArrayLength ( ACount : Integer ) ;
- public function GenerateVertexJoints ( const ABindShapeMatrix : TMatrix3D; AMeshDef : TMeshDef = nil ) : TVertexJointsList ;
- public procedure ApplyVertexJointsRelation ( AVertices : TVertexJointsList ) ;
- public function BindShapeMatrixIsIdentity ( ) : Boolean ;
- public procedure GetSkeletonJointTransformations ( var AJointTransfArr : TMatrix3DDynArray; const ATransform : TMatrix3D ) ;
- public procedure CalculateInverseBindTransformMatrix ( ABindShapeMatrix : TMatrix3D ) ;
- public procedure ApplyBindPoses ( ) ;
- 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 ; overload;
- public function GetJointIndex ( const AJoint : TJointDef ) : Integer ; overload;
- public function LinkedJointsToString ( ) : string ;
- public function GetSize ( ) : Int64 ; override;
- public function ToJSON ( ) : TJSONObject ; override;
- public procedure FromJSON ( const AModel : TModelDef; const AValue : TJSONObject ) ; override;
- public procedure NormalizeJointVertexWeights
(
AWeightTolerance :
Single
=
0.01
)
;
Some dirty file formats out there provide vertex weights unequal to a sum of 1.0. This routine runs over all vertices and their joint linking. sums up weights and if they are unequal to 1.0, it will normalize each value.
- public function CheckMeshVerticesToBeAttachedCorrectly
(
AWeightTolerance :
Single
=
0.1
)
: Integer
;
Use this method to check, if all mesh vertices are linked to at least joints and der total sum is equal to 1.0, which means correct weighting.
- public procedure DrawJointWeights ( AJointRef : TJointRefDef; ABitmap : TBitmap ) ;
- public procedure SaveJointWeightMaps
(
APath :
string; ASize :
Integer
=
$100
)
;
Helper function to create bitmaps for all linked joints in a skin. This method calls DrawJointWeights to render vertex weights of each joint reference in the skin depending on the linked mesh.
Properties
- public Controller : TControllerDef
- public Target : TTransformDef
- public LinkedJoints : TObjectList<Gorilla.DefTypes.TJointRefDef>read FLinkedJoints
- public Skeletons : TObjectList<Gorilla.DefTypes.TJointRefDef>read FSkeletons
- public BindShapeMatrix : TMatrix3D
The bind shape matrix describes how to transform skin shape geometry into the right coordinate system for use with the joints.
read FBindShapeMatrix
write FBindShapeMatrix - public BindPoses : TArray<System.Math.Vectors.TMatrix3D>
This source defines the inverse bind matrix for each joint, these are used to bring coordinates being skinned into the same space as each joint.
read FBindPoses
TControllerDef
controller definition type by this type we can manage a subset of animations
Ancestors
Members
Fields
Methods
- public constructor Create ( const ATarget : TTransformDef ) ;
- 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 AModel : TModelDef; 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 FVertexFormat :
TVertexFormats
- protected FIndexFormat :
TIndexFormat
- protected FFaceOrientation :
TFaceOrientation
- protected FIsStatic :
Boolean
- protected FBuffersLinked :
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 ( AOwner : TCustomDef ) ;
- public destructor Destroy ( ) ;
- protected procedure SetMaterial ( AValue : TMaterialRefDef ) ; virtual;
- protected procedure SetIsStatic ( AValue : Boolean ) ; virtual;
- protected function GetIndexSource ( ) : TIndexBuffer ; virtual;
- protected function GetVertexSource ( ) : TVertexBuffer ; virtual;
- protected procedure CalculateTriNormal ( var Av1 : TVertexData; var Av2 : TVertexData; var Av3 : TVertexData ) ;
- protected procedure DoAssignVertexMap ( ASrc : TVertexIndexMap; ADst : TVertexIndexMap; const AOffset : Integer ) ;
- public procedure BoundingBoxChanged ( ) ; virtual;
- public function GetBoundingBox
(
)
: TBoundingBox
;
virtual;
Computes a local bounding box from all vertices inside of the specific mesh. Sub-Meshes are ignored.
- public procedure SetVertexFormatByVertexData ( const AVertex : PVertexData ) ;
- public procedure CreateVertexSource ( AFormat : TVertexFormats ) ;
- public procedure CreateIndexSource ( AFormat : TIndexFormat ) ;
- public procedure SetVertices ( const AVertices : TVertexBuffer ) ; virtual;
- public procedure SetIndices ( const AIndices : TIndexBuffer ) ; virtual;
- public procedure AddVertices ( const AVertices : TVertexDataDynArray; const AIndex : Integer; const ACount : Integer ) ; virtual;
- public procedure AppendVertices ( 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 AppendIndices ( const AIndices : TIndexDataDynArray; const AIndex : Integer; const ACount : Integer; const AOffset : Integer = $0 ) ; overload virtual;
- public procedure AppendIndices ( const ATriangles : TTriangleIndexDynArray; const AIndex : Integer; const ACount : Integer; const AOffset : Integer = $0 ) ; overload virtual;
- public function GetVertexPositions ( ) : TPoint3DDynArray ; virtual;
- public procedure AddVertexIndexMap ( const AMap : TVertexIndexMap; const AOffset : Integer = $0 ) ; virtual;
- public procedure AppendVertexIndexMap ( const AMap : TVertexIndexMap; const AOffset : Integer = $0 ) ; virtual;
- public procedure ApplyTransformation ( const AMatrix : TMatrix3D ) ; virtual;
- public procedure SetMaterialReference ( const AMaterial : TMaterialDef ) ; virtual;
- public procedure RefreshMeshBuffer
(
ASync :
Boolean
)
;
This pushes vertices and indices again to mesh bufferobject without rebuilding the buffer.
- public procedure UpdateMeshBuffer
(
)
;
This method destroys a previous buffer, create a new one and pushes vertices and indices to it.
- public procedure LinkMeshBuffer
(
ABufferObject :
TMeshBufferObject; AVertices :
TVertexBuffer; AIndices :
TIndexBuffer
)
;
To allow mesh buffer linking between different meshdef's, you can use this method the necessary objects.
- public procedure UnlinkMeshBuffer ( ) ;
- public function GetSize ( ) : Int64 ; override;
- public function ToJSON ( ) : TJSONObject ; override;
- public procedure FromJSON ( const AModel : TModelDef; const AValue : TJSONObject ) ; override;
Properties
- public VertexFormat : TVertexFormats
- public IndexFormat : TIndexFormatread FIndexFormat
- public FaceOrientation : TFaceOrientation
- 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 ( AOwner : TCustomDef ) ;
- public destructor Destroy ( ) ;
- protected procedure SetIsStatic ( AValue : Boolean ) ; override;
- protected function GetMeshes ( ) : TTransformDefList ;
- protected function ContainsVertexGroups ( ) : Boolean ;
- public procedure AddMesh ( const AMesh : TMeshDef ) ; override;
- 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 ApplyToMeshDef ( const ADef : TMeshDef; AOptions : TCopyVertexOptions = [] ) ; virtual;
- public procedure CalcTextureCoordinates ( ) ; overload virtual;
- public procedure CalcTextureCoordinates ( AStartIdx : Integer; AStopIdx : Integer ) ; overload virtual;
- public procedure CalcTextureCoordinates ( AVertexBuffer : TVertexBuffer; ABoundingBox : TBoundingBox; AStartIdx : Integer; AStopIdx : Integer ) ; overload virtual;
- public procedure CalcFaceNormals ( const PropagateFaceNormalsToVertices : Boolean = True ; ASubMeshes : Boolean = True ) ; virtual;
- public procedure CalcSmoothNormals ( const Method : TMeshDefCalculateNormalMethod; const WeldEpsilon : Single = 0.001 ; ASubMeshes : Boolean = True ) ; virtual;
- public procedure CalcTangentBinormals ( ASubMeshes : Boolean = False ) ; overload virtual;
- public procedure CalcTangentBinormals ( const AData : TMeshData ) ; overload virtual;
- public function GetSize ( ) : Int64 ; override;
- public function ToJSON ( ) : TJSONObject ; override;
- public procedure FromJSON ( const AModel : TModelDef; const AValue : TJSONObject ) ; override;
- public function GetCombinedBoundingBox
(
)
: TBoundingBox
;
virtual;
Computes a local bounding box from all vertices inside of the specific mesh and all sub-meshes.
- 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; const
ATransform :
TMatrix3D; var
AIntersection :
TPoint3D; var
ANormal :
TPoint3D
)
: Boolean
;
virtual;
Perform a ray cast on the specific mesh. The method return if ray cast was successful. In that case AIntersection and ANormal return values are set.
- public function GetNormalVectorFromPoints ( const A : TPoint3D; const B : TPoint3D; const C : TPoint3D ) : TPoint3D ;
- public procedure AddPolygon ( const APoly : TPolygon ) ; overload virtual;
- public procedure AddPolygon
(
const
APoly :
T3DPolygon
)
;
overload virtual;
Add a 3D polygon to the current mesh.
- public procedure AddPolygon
(
const
APoly :
TPolygon; const
ATexCoords :
TPolygon; const
ANormals :
T3DPolygon
)
;
overload virtual;
Add a 2D polyon to the current mesh.
- public procedure AddPolygon
(
const
APoly :
T3DPolygon; const
ATexCoords :
TPolygon; const
ANormals :
T3DPolygon
)
;
overload virtual;
Add a 3D polygon to the current mesh.
- public procedure ApplyTransformationMatrixToVertices
(
ATransform :
TMatrix3D; const
AModfiyVertices :
Boolean
)
;
virtual;
A user helper function to apply the transformation matrix of meshes to vertices. If second parameter AModfiyVertices is set to TRUE, transformation matrices will be applied directly to all vertices, instead of applying the transformation during rendering. matrix.
- public procedure MoveVerticesToPivot
(
)
;
virtual;
The method modifies all vertices to move them relatively to the center of the model. The methods takes usage of ApplyTransformationMatrixToVertices() and replaces dynamic transformation matrices.
Properties
- public Model : TModelDefread GetModel
- public Meshes : TObjectList<Gorilla.DefTypes.TTransformDef>
- public BVH : PBVHGeometry
If a bounding volume hierarchy was acquired by calling AcquireBVH(), you will get the structure by this property. Otherwise it will return NIL.
read FBVH - public RenderByVertexGroups : Boolean
TVertexGroupDef
VertexGroups are helper structures referring to an owner mesh, which holds original vertex data and complete indices list, while this structure only holds a separated index source for partially rendering a mesh.
Remarks
VertexGroups are used f.e. in FBX format for rendering some triangles with a different material than others.Ancestors
Members
Methods
- public constructor Create ( AOwner : TCustomDef ) ;
- public destructor Destroy ( ) ;
- protected function GetVertexSource ( ) : TVertexBuffer ; override;
- public procedure FromJSON ( const AModel : TModelDef; const AValue : TJSONObject ) ; override;
- public procedure ApplyToMeshData
(
const
AData :
TMeshData
)
;
override;
For vertex groups we do not modify the vertices, because they are only a reference to the parent mesh vertices. So we need some special treatment here.
TLightDef
Ancestors
Members
Fields
- protected FLightType :
TLightType
- protected FDirection :
TPoint3D
- protected FDiffuse :
TAlphaColorF
- protected FAmbient :
TAlphaColorF
- protected FSpecular :
TAlphaColorF
- protected FIntensity :
Single
- protected FConstantAttenuation :
Single
- protected FLinearAttenuation :
Single
- protected FQuadraticAttenuation :
Single
- protected FScatteringIntensity :
Single
- protected FScatteringExposure :
Single
- protected FScatteringDecay :
Single
- protected FScatteringDensity :
Single
- protected FSpotCutOff :
Single
- protected FSpotExponent :
Single
Methods
- public constructor Create ( const AOwner : TTransformDef ) ;
- public destructor Destroy ( ) ;
- public function GetQualifiedComponentName ( ) : string ; override;
- public function GetSize ( ) : Int64 ; override;
- public function ToJSON ( ) : TJSONObject ; override;
- public procedure FromJSON ( const AModel : TModelDef; const AValue : TJSONObject ) ; override;
- public function LateResolveFromJSON ( const AModel : TModelDef; const AValue : TJSONObject ) : Boolean ; override;
Properties
- public Owner : TCustomDefread FOwner
- public Model : TModelDefread GetModel
- public LightType : TLightType
- public Direction : TPoint3D
- public Diffuse : TAlphaColorF
- public Ambient : TAlphaColorF
- public Specular : TAlphaColorF
- public Intensity : Single
- public ConstantAttenuation : Single
- public LinearAttenuation : Single
- public QuadraticAttenuation : Single
- public ScatteringIntensity : Single
- public ScatteringExposure : Single
- public ScatteringDecay : Single
- public ScatteringDensity : Single
- public SpotCutOff : Single
- public SpotExponent : Single
TCameraDef
Ancestors
Members
Fields
- protected FType :
TCameraType
- protected FTarget :
string
- protected FFOV :
Single
- protected FAspectRatio :
Single
- protected FNearPlane :
Single
- protected FFarPlane :
Single
Methods
- public constructor Create ( const AOwner : TTransformDef ) ;
- public destructor Destroy ( ) ;
- public function GetQualifiedComponentName ( ) : string ; override;
- public function GetSize ( ) : Int64 ; override;
- public function ToJSON ( ) : TJSONObject ; override;
- public procedure FromJSON ( const AModel : TModelDef; const AValue : TJSONObject ) ; override;
- public function LateResolveFromJSON ( const AModel : TModelDef; const AValue : TJSONObject ) : Boolean ; override;
Properties
TModelDef
internal model definition type by this type we can group mesh definitions
Ancestors
Members
Fields
- private FLateResolveList :
TDictionary<Gorilla.DefTypes.TCustomDef,System.JSON.TJSONObject>
- protected FPackage :
TObject
- protected FAsset :
TObject
- protected FIsStandalone :
Boolean
- protected FFilename :
string
- protected FTextureAssets :
TInterpolatorKeyDefList
- protected FMaterials :
TMaterialDefMap
- protected FLights :
TLightDefList
- protected FCameras :
TCameraDefList
- protected FArmatures :
TArmatureDefList
- protected FControllers :
TControllerDefList
- protected FAnimations :
TAnimationDefList
- protected FCurrentAnimation :
TAnimationDef
- protected FMetaData :
TModelMetaDef
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 ) ;
- protected function GetArmatureDefList ( ) : TArmatureDefList ;
- protected function GetHumanoidDefList ( ) : TArmatureDefList ;
- public procedure CalcFaceNormals ( const PropagateFaceNormalsToVertices : Boolean = True ) ; virtual;
- public procedure CalcSmoothNormals ( const Method : TMeshDefCalculateNormalMethod; const WeldEpsilon : Single = 0.001 ) ; virtual;
- public procedure CalcTangentBinormals ( ) ; virtual;
- public function TryGetTextureAsset ( const AAsset : TObject ) : TObject ;
- public function TextureAssetExists ( const AAsset : TObject ) : Boolean ;
- public procedure RegisterTextureAsset ( const AAsset : TObject ) ;
- public procedure ClearTextureAssets ( ) ;
- public procedure AddMaterial ( const AId : string; AMaterial : TMaterialDef ) ;
- public function GetMaterial ( const AId : string ) : TMaterialDef ;
- public function FindMaterialById ( const AId : string ) : TMaterialDef ;
- public procedure AddLight ( ALight : TLightDef ) ;
- public function GetLight ( AIndex : Integer ) : TLightDef ;
- public function FindLightById ( const AId : string ) : TLightDef ;
- public procedure AddCamera ( ACamera : TCameraDef ) ;
- public function GetCamera ( AIndex : Integer ) : TCameraDef ;
- public function FindCameraById ( const AId : string ) : TCameraDef ;
- public procedure AddController ( const AController : TControllerDef ) ;
- public procedure AddArmature ( const AArmature : TArmatureDef ) ;
- public function GetArmatureBySkeleton ( const ASkeletonJoint : TJointDef ) : TArmatureDef ;
- public function FindArmatureById ( const AId : string ) : TArmatureDef ;
- public procedure AddHumanoid ( const AHumanoid : TArmatureDef ) ;
- public function GetHumanoidBySkeleton ( const ASkeletonJoint : TJointDef ) : TArmatureDef ;
- public function FindHumanoidById ( const AId : string ) : TArmatureDef ;
- 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; const AThrowException : Boolean = True ) : TControllerDef ; virtual;
- public function FindControllerByTransform ( const ATransform : TTransformDef; const AThrowException : Boolean = True ) : TControllerDef ; virtual;
- public function FindJointById ( const AName : string ) : TJointDef ; virtual;
- public function FindAnimationById ( const AName : string ) : TAnimationDef ; virtual;
- public function FindDefById ( const AId : string ) : TCustomDef ; virtual;
- public function GetSize ( ) : Int64 ; override;
- public function ToJSON ( ) : TJSONObject ; override;
- public procedure FromJSON ( const AValue : TJSONObject ) ; virtual;
- public procedure RequestBitmapCache
(
ACache :
TGorillaBitmapCache
)
;
It will collect all bitmaps from TMaterialDef instances and add their bitmap data as references to the cache.
- public procedure ApplyBitmapCache
(
ACache :
TGorillaBitmapCache
)
;
The method will create a STANDALONE(!) texture asset for each bitmap cached. This means the texture asset has no reference to any assets package/group. Call this routine when loading model data from binary storage with a bitmap cache in DFM.
Properties
- public Package : TObject
- public Asset : TObject
- public IsStandalone : Boolean
- public Filename : string
- public Materials : TDictionary<System.string,Gorilla.DefTypes.TMaterialDef>read FMaterials
- public Lights : TObjectList<Gorilla.DefTypes.TLightDef>read FLights
- public Cameras : TObjectList<Gorilla.DefTypes.TCameraDef>read FCameras
- public Armatures : TObjectList<Gorilla.DefTypes.TArmatureDef>read GetArmatureDefList
- public Humanoids : TObjectList<Gorilla.DefTypes.TArmatureDef>read GetHumanoidDefList
- public Controllers : TObjectList<Gorilla.DefTypes.TControllerDef>read FControllers
- public Animations : TObjectList<Gorilla.DefTypes.TAnimationDef>read FAnimations
- public CurrentAnimation : TAnimationDef
- public MetaData : TModelMetaDefread FMetaData
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 :
- protected FColorSource :
- protected FIndexMap :
TVertexIndexMap
- protected FVertexMap :
TCachedVertexMap
- protected FVertexHashes :
TCachedVertexHashes
- 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 ClearMaps ( ) ; virtual;
- public procedure ClearVirtualData ( ) ; 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>; const
AVertexOrder :
TVertexOrder
=
CCW
)
: 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>; const
AVertexOrder :
TVertexOrder
=
CCW
)
: 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 ) ; overload;
- public procedure SetNormalSource ( const ASource : TSingleDynArray; ATransform : TMatrix3D ) ; overload;
- 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