Documentation
¶
Index ¶
- func DecodePackedNormal(v uint32) (normal, tangent, bitangent mgl32.Vec3)
- func LoadMeshes(gpuR io.ReadSeeker, info *Info, idsToLoad []uint32) (map[uint32]Mesh, error)
- type Bone
- type Header
- type Info
- type JointListHeader
- type JointMapEntry
- type JointTransform
- type LODEntry
- type LODFooter
- type LODGroup
- type LODOther
- type Light
- type LightArray
- type Mesh
- type MeshGroup
- type MeshHeader
- type MeshHeaderType
- type MeshInfo
- type MeshLayout
- type MeshLayoutItemFormat
- type MeshLayoutItemType
- type RemapItem
- type SkeletonMap
- type UnitLightType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodePackedNormal ¶ added in v0.7.0
func LoadMeshes ¶ added in v0.3.2
idsToLoad contains the mesh IDs (=indices) of the meshes which should be loaded. To load all meshes, pass a slice with value {0,1,...,info.NumMeshes-1}.
Types ¶
type Bone ¶ added in v0.3.2
type Bone struct {
NameHash stingray.ThinHash
Index uint32
ParentIndex uint32
Increment uint32
Transform JointTransform
Matrix mgl32.Mat4
Children []uint32
}
func (*Bone) RecursiveCalcLocalTransforms ¶ added in v0.3.2
type Header ¶
type Header struct {
Unk00 [8]byte
Bones stingray.Hash
GeometryGroup stingray.Hash
UnkHash00 stingray.Hash
StateMachine stingray.Hash
Unk02 [8]byte
LODGroupListOffset uint32
JointListOffset uint32
LightListOffset uint32
UnkOffset02 uint32
Unk03 [12]byte
UnkOffset03 uint32
UnkOffset04 uint32
Unk04 [4]byte
SkeletonMapListOffset uint32
MeshLayoutListOffset uint32
MeshDataOffset uint32
MeshInfoListOffset uint32
Unk05 [8]byte
MaterialListOffset uint32
}
type Info ¶ added in v0.3.2
type Info struct {
BonesHash stingray.Hash
StateMachine stingray.Hash
GeometryGroup stingray.Hash
LODGroups []LODGroup
SkeletonMaps []SkeletonMap
Bones []Bone
JointTransformMatrices [][4][4]float32
Lights []Light
Materials map[stingray.ThinHash]stingray.Hash
NumMeshes uint32
MeshInfos []MeshInfo
GroupBones []stingray.ThinHash
MeshLayouts []MeshLayout
}
type JointListHeader ¶
type JointMapEntry ¶ added in v0.3.2
type JointTransform ¶
type Light ¶ added in v0.7.0
type Light struct {
NameHash stingray.ThinHash
BoneIndex uint32
Color [3]float32
Intensity float32
FalloffStart float32
FalloffEnd float32
FalloffExponent float32
SpotInnerAngle float32
SpotOuterAngle float32
Unknown0 float32
ShadowBias float32
Unknown1 float32
Unknown2 float32
Unknown3 float32
Unknown4 float32
Unknown5 float32
Flags uint32
Type UnitLightType
UnknownData [8]float32
}
type LightArray ¶ added in v0.7.0
type MeshHeader ¶
type MeshHeader struct {
Unk00 [8]byte
AABB struct {
Min [3]float32
Max [3]float32
}
UnkFloat00 float32
MeshType MeshHeaderType
GroupBoneHash stingray.ThinHash
AABBTransformIndex uint32
TransformIdx uint32
UnkInt03 uint32
SkeletonMapIdx int32
LayoutIdx int32
Unk01 [40]byte
NumMaterials uint32
MaterialOffset uint32
Unk02 [8]byte
NumGroups uint32
GroupOffset uint32
}
type MeshHeaderType ¶ added in v0.4.0
type MeshHeaderType uint32
const ( MeshTypeUnknown00 MeshHeaderType = 0x000 MeshTypeUnknown01 MeshHeaderType = 0x10a MeshTypeUnknown02 MeshHeaderType = 0x189 )
func (*MeshHeaderType) String ¶ added in v0.4.0
func (m *MeshHeaderType) String() string
type MeshInfo ¶
type MeshInfo struct {
Header MeshHeader
Materials []stingray.ThinHash
Groups []MeshGroup
}
type MeshLayout ¶
type MeshLayout struct {
MagicNum0 [4]byte
Unk00 [4]byte
Items [16]struct {
Type MeshLayoutItemType
Format MeshLayoutItemFormat
Layer uint32
Unk00 [8]byte
}
NumItems uint32
Unk01 [4]byte
MagicNum1 [4]byte
Unk02 [12]byte
NumVertices uint32
VertexStride uint32
Unk03 [16]byte
MagicNum2 [4]byte
Unk04 [12]byte
NumIndices uint32
Unk05 [20]byte
VertexOffset uint32
PositionsSize uint32
IndexOffset uint32
IndicesSize uint32
Unk06 [16]byte
}
type MeshLayoutItemFormat ¶
type MeshLayoutItemFormat uint32
const ( FormatF32 MeshLayoutItemFormat = 0 FormatVec2F MeshLayoutItemFormat = 1 FormatVec3F MeshLayoutItemFormat = 2 FormatVec4F MeshLayoutItemFormat = 3 FormatS32 MeshLayoutItemFormat = 4 FormatU32 MeshLayoutItemFormat = 17 FormatVec2U32 MeshLayoutItemFormat = 18 FormatVec3U32 MeshLayoutItemFormat = 19 FormatVec4U32 MeshLayoutItemFormat = 20 FormatS8 MeshLayoutItemFormat = 21 FormatVec2S8 MeshLayoutItemFormat = 22 FormatVec3S8 MeshLayoutItemFormat = 23 FormatVec4S8 MeshLayoutItemFormat = 24 FormatVec4R10G10B10A2_TYPELESS MeshLayoutItemFormat = 25 FormatVec4R10G10B10A2_UNORM MeshLayoutItemFormat = 26 FormatF16 MeshLayoutItemFormat = 28 FormatVec2F16 MeshLayoutItemFormat = 29 FormatVec3F16 MeshLayoutItemFormat = 30 FormatVec4F16 MeshLayoutItemFormat = 31 )
func (MeshLayoutItemFormat) ComponentType ¶ added in v0.5.14
func (v MeshLayoutItemFormat) ComponentType() gltf.ComponentType
func (MeshLayoutItemFormat) Size ¶ added in v0.5.14
func (v MeshLayoutItemFormat) Size() int
func (MeshLayoutItemFormat) String ¶
func (v MeshLayoutItemFormat) String() string
func (MeshLayoutItemFormat) Type ¶ added in v0.5.14
func (v MeshLayoutItemFormat) Type() gltf.AccessorType
type MeshLayoutItemType ¶
type MeshLayoutItemType uint32
const ( ItemPosition MeshLayoutItemType = 0 ItemNormal MeshLayoutItemType = 1 ItemUVCoords MeshLayoutItemType = 4 ItemBoneIdx MeshLayoutItemType = 6 ItemBoneWeight MeshLayoutItemType = 7 )
func (MeshLayoutItemType) String ¶
func (v MeshLayoutItemType) String() string
type SkeletonMap ¶ added in v0.3.2
type UnitLightType ¶ added in v0.7.0
type UnitLightType uint32
const ( LightOmni UnitLightType = iota LightSpot LightBox LightDirectional )
func (UnitLightType) ToGLTF ¶ added in v0.7.0
func (l UnitLightType) ToGLTF() string
Click to show internal directories.
Click to hide internal directories.