Getters for Model type added

This commit is contained in:
JupiterRider 2023-10-17 20:16:43 +02:00
parent 429cdff4ee
commit a6238d7cd6

View file

@ -854,15 +854,51 @@ type MaterialMap struct {
// Model is struct of model, meshes, materials and animation data // Model is struct of model, meshes, materials and animation data
type Model struct { type Model struct {
// Local transform matrix // Local transform matrix
Transform Matrix Transform Matrix
MeshCount int32 // Number of meshes
MeshCount int32
// Number of materials
MaterialCount int32 MaterialCount int32
Meshes *Mesh // Meshes array (c array)
Materials *Material //
MeshMaterial *int32 // Use Model.GetMeshes instead (go slice)
BoneCount int32 Meshes *Mesh
Bones *BoneInfo // Materials array (c array)
BindPose *Transform //
// Use Model.GetMaterials instead (go slice)
Materials *Material
// Mesh material number
MeshMaterial *int32
// Number of bones
BoneCount int32
// Bones information (skeleton) (c array)
//
// Use Model.GetBones instead (go slice)
Bones *BoneInfo
// Bones base transformation (pose) (c array)
//
// Use Model.GetBindPose instead (go slice)
BindPose *Transform
}
// GetMeshes returns the meshes of a model as go slice
func (m Model) GetMeshes() []Mesh {
return unsafe.Slice(m.Meshes, m.MeshCount)
}
// GetMaterials returns the materials of a model as go slice
func (m Model) GetMaterials() []Material {
return unsafe.Slice(m.Materials, m.MaterialCount)
}
// GetBones returns the bones information (skeleton) of a model as go slice
func (m Model) GetBones() []BoneInfo {
return unsafe.Slice(m.Bones, m.BoneCount)
}
// GetBindPose returns the bones base transformation of a model as go slice
func (m Model) GetBindPose() []Transform {
return unsafe.Slice(m.BindPose, m.BoneCount)
} }
// newModelFromPointer - Returns new Model from pointer // newModelFromPointer - Returns new Model from pointer