From 32c5def7877731c456be7704f96fb55a469a0da2 Mon Sep 17 00:00:00 2001 From: bloeys Date: Fri, 19 Nov 2021 14:58:59 +0400 Subject: [PATCH] Stringer for some enums --- asig/asig.go | 759 ++++++++++++++++++++++++----------------------- asig/enums.go | 76 +++++ asig/material.go | 12 - main.go | 21 +- 4 files changed, 464 insertions(+), 404 deletions(-) diff --git a/asig/asig.go b/asig/asig.go index 0cc28be..c46c44f 100755 --- a/asig/asig.go +++ b/asig/asig.go @@ -1,379 +1,380 @@ -package asig - -/* -#cgo CFLAGS: -I . -#cgo LDFLAGS: -L ./libs -l assimp_windows_amd64 -l IrrXML_windows_amd64 -l zlib_windows_amd64 - -#include //Needed for C.free - -#include - -//Functions -struct aiScene* aiImportFile(const char* pFile, unsigned int pFlags); -void aiReleaseImport(const struct aiScene* pScene); -const char* aiGetErrorString(); -*/ -import "C" -import ( - "errors" - "unsafe" - - "github.com/bloeys/gglm/gglm" -) - -type Node struct { -} - -type Animation struct { -} - -type Texture struct { -} - -type Light struct { -} - -type Camera struct { -} - -type Metadata struct { -} - -type Scene struct { - Flags SceneFlag - - RootNode *Node - Meshes []*Mesh - Materials []*Material - Animations []*Animation - Textures []*Texture - Lights []*Light - Cameras []*Camera -} - -func ImportFile(file string, postProcessFlags PostProcess) (*Scene, error) { - - cstr := C.CString(file) - defer C.free(unsafe.Pointer(cstr)) - - cs := C.aiImportFile(cstr, C.uint(postProcessFlags)) - if cs == nil { - return nil, getAiErr() - } - defer C.aiReleaseImport(cs) - - return parseScene(cs), nil -} - -func getAiErr() error { - return errors.New("asig error: " + C.GoString(C.aiGetErrorString())) -} - -func parseScene(cs *C.struct_aiScene) *Scene { - - s := &Scene{} - s.Flags = SceneFlag(cs.mFlags) - s.Meshes = parseMeshes(cs.mMeshes, uint(cs.mNumMeshes)) - s.Materials = parseMaterials(cs.mMaterials, uint(cs.mNumMaterials)) - - return s -} - -func parseMeshes(cm **C.struct_aiMesh, count uint) []*Mesh { - - if cm == nil { - return []*Mesh{} - } - - meshes := make([]*Mesh, count) - cmeshes := unsafe.Slice(cm, count) - - for i := 0; i < int(count); i++ { - - m := &Mesh{} - - cmesh := cmeshes[i] - vertCount := uint(cmesh.mNumVertices) - - m.Vertices = parseVec3s(cmesh.mVertices, vertCount) - m.Normals = parseVec3s(cmesh.mNormals, vertCount) - m.Tangents = parseVec3s(cmesh.mTangents, vertCount) - m.BitTangents = parseVec3s(cmesh.mBitangents, vertCount) - - //Color sets - m.ColorSets = parseColorSet(cmesh.mColors, vertCount) - - //Tex coords - m.TexCoords = parseTexCoords(cmesh.mTextureCoords, vertCount) - m.TexCoordChannelCount = [8]uint{} - for j := 0; j < len(cmesh.mTextureCoords); j++ { - - //If a color set isn't available then it is nil - if cmesh.mTextureCoords[j] == nil { - continue - } - - m.TexCoordChannelCount[j] = uint(cmeshes[j].mNumUVComponents[j]) - } - - //Faces - cFaces := unsafe.Slice(cmesh.mFaces, cmesh.mNumFaces) - m.Faces = make([]Face, cmesh.mNumFaces) - for j := 0; j < len(m.Faces); j++ { - - m.Faces[j] = Face{ - Indices: parseUInts(cFaces[j].mIndices, uint(cFaces[j].mNumIndices)), - } - } - - //Other - m.Bones = parseBones(cmesh.mBones, uint(cmesh.mNumBones)) - m.AnimMeshes = parseAnimMeshes(cmesh.mAnimMeshes, uint(cmesh.mNumAnimMeshes)) - m.AABB = AABB{ - Min: parseVec3(&cmesh.mAABB.mMin), - Max: parseVec3(&cmesh.mAABB.mMax), - } - - m.MorphMethod = MorphMethod(cmesh.mMethod) - m.MaterialIndex = uint(cmesh.mMaterialIndex) - m.Name = parseAiString(cmesh.mName) - - meshes[i] = m - } - - return meshes -} - -func parseVec3(cv *C.struct_aiVector3D) gglm.Vec3 { - - if cv == nil { - return gglm.Vec3{} - } - - return gglm.Vec3{ - Data: [3]float32{ - float32(cv.x), - float32(cv.y), - float32(cv.z), - }, - } -} - -func parseAnimMeshes(cam **C.struct_aiAnimMesh, count uint) []*AnimMesh { - - if cam == nil { - return []*AnimMesh{} - } - - animMeshes := make([]*AnimMesh, count) - cAnimMeshes := unsafe.Slice(cam, count) - - for i := 0; i < int(count); i++ { - - m := cAnimMeshes[i] - animMeshes[i] = &AnimMesh{ - Name: parseAiString(m.mName), - Vertices: parseVec3s(m.mVertices, uint(m.mNumVertices)), - Normals: parseVec3s(m.mNormals, uint(m.mNumVertices)), - Tangents: parseVec3s(m.mTangents, uint(m.mNumVertices)), - BitTangents: parseVec3s(m.mBitangents, uint(m.mNumVertices)), - Colors: parseColorSet(m.mColors, uint(m.mNumVertices)), - TexCoords: parseTexCoords(m.mTextureCoords, uint(m.mNumVertices)), - Weight: float32(m.mWeight), - } - } - - return animMeshes -} - -func parseTexCoords(ctc [MaxTexCoords]*C.struct_aiVector3D, vertCount uint) [MaxTexCoords][]gglm.Vec3 { - - texCoords := [MaxTexCoords][]gglm.Vec3{} - - for j := 0; j < len(ctc); j++ { - - //If a color set isn't available then it is nil - if ctc[j] == nil { - continue - } - - texCoords[j] = parseVec3s(ctc[j], vertCount) - } - - return texCoords -} - -func parseColorSet(cc [MaxColorSets]*C.struct_aiColor4D, vertCount uint) [MaxColorSets][]gglm.Vec4 { - - colorSet := [MaxColorSets][]gglm.Vec4{} - for j := 0; j < len(cc); j++ { - - //If a color set isn't available then it is nil - if cc[j] == nil { - continue - } - - colorSet[j] = parseColors(cc[j], vertCount) - } - - return colorSet -} - -func parseBones(cbs **C.struct_aiBone, count uint) []*Bone { - - if cbs == nil { - return []*Bone{} - } - - bones := make([]*Bone, count) - cbones := unsafe.Slice(cbs, count) - - for i := 0; i < int(count); i++ { - - cBone := cbones[i] - bones[i] = &Bone{ - Name: parseAiString(cBone.mName), - Weights: parseVertexWeights(cBone.mWeights, uint(cBone.mNumWeights)), - OffsetMatrix: parseMat4(&cBone.mOffsetMatrix), - } - } - - return bones -} - -func parseMat4(cm4 *C.struct_aiMatrix4x4) gglm.Mat4 { - - if cm4 == nil { - return gglm.Mat4{} - } - - return gglm.Mat4{ - Data: [4][4]float32{ - {float32(cm4.a1), float32(cm4.b1), float32(cm4.c1), float32(cm4.d1)}, - {float32(cm4.a2), float32(cm4.b2), float32(cm4.c2), float32(cm4.d2)}, - {float32(cm4.a3), float32(cm4.b3), float32(cm4.c3), float32(cm4.d3)}, - {float32(cm4.a4), float32(cm4.b4), float32(cm4.c4), float32(cm4.d4)}, - }, - } -} - -func parseVertexWeights(cWeights *C.struct_aiVertexWeight, count uint) []VertexWeight { - - if cWeights == nil { - return []VertexWeight{} - } - - vw := make([]VertexWeight, count) - cvw := unsafe.Slice(cWeights, count) - - for i := 0; i < int(count); i++ { - - vw[i] = VertexWeight{ - VertIndex: uint(cvw[i].mVertexId), - Weight: float32(cvw[i].mWeight), - } - } - - return vw -} - -func parseAiString(aiString C.struct_aiString) string { - return C.GoStringN(&aiString.data[0], C.int(aiString.length)) -} - -func parseUInts(cui *C.uint, count uint) []uint { - - if cui == nil { - return []uint{} - } - - uints := make([]uint, count) - cUInts := unsafe.Slice(cui, count) - for i := 0; i < len(cUInts); i++ { - uints[i] = uint(cUInts[i]) - } - - return uints -} - -func parseVec3s(cv *C.struct_aiVector3D, count uint) []gglm.Vec3 { - - if cv == nil { - return []gglm.Vec3{} - } - - carr := unsafe.Slice(cv, count) - verts := make([]gglm.Vec3, count) - - for i := 0; i < int(count); i++ { - verts[i] = gglm.Vec3{ - Data: [3]float32{ - float32(carr[i].x), - float32(carr[i].y), - float32(carr[i].z), - }, - } - } - - return verts -} - -func parseColors(cv *C.struct_aiColor4D, count uint) []gglm.Vec4 { - - if cv == nil { - return []gglm.Vec4{} - } - - carr := unsafe.Slice(cv, count) - verts := make([]gglm.Vec4, count) - - for i := 0; i < int(count); i++ { - verts[i] = gglm.Vec4{ - Data: [4]float32{ - float32(carr[i].r), - float32(carr[i].g), - float32(carr[i].b), - float32(carr[i].a), - }, - } - } - - return verts -} - -func parseMaterials(cMatsIn **C.struct_aiMaterial, count uint) []*Material { - - mats := make([]*Material, count) - cMats := unsafe.Slice(cMatsIn, count) - - for i := 0; i < int(count); i++ { - - mats[i] = &Material{ - Properties: parseMatProperties(cMats[i].mProperties, uint(cMats[i].mNumProperties)), - AllocatedStorage: uint(cMats[i].mNumAllocated), - } - } - - return mats -} - -func parseMatProperties(cMatPropsIn **C.struct_aiMaterialProperty, count uint) []*MaterialProperty { - - matProps := make([]*MaterialProperty, count) - cMatProps := unsafe.Slice(cMatPropsIn, count) - - for i := 0; i < int(count); i++ { - - cmp := cMatProps[i] - - matProps[i] = &MaterialProperty{ - name: parseAiString(cmp.mKey), - Semantic: TextureType(cmp.mSemantic), - Index: uint(cmp.mIndex), - TypeInfo: MatPropertyTypeInfo(cmp.mType), - Data: C.GoBytes(unsafe.Pointer(cmp.mData), C.int(cmp.mDataLength)), - } - } - - return matProps -} +package asig + +/* +#cgo CFLAGS: -I . +#cgo LDFLAGS: -L ./libs -l assimp_windows_amd64 -l IrrXML_windows_amd64 -l zlib_windows_amd64 + +#include //Needed for C.free + +#include + +//Functions +struct aiScene* aiImportFile(const char* pFile, unsigned int pFlags); +void aiReleaseImport(const struct aiScene* pScene); +const char* aiGetErrorString(); +unsigned int aiGetMaterialTextureCount(const struct aiMaterial* pMat, enum aiTextureType type); +*/ +import "C" +import ( + "errors" + "unsafe" + + "github.com/bloeys/gglm/gglm" +) + +type Node struct { +} + +type Animation struct { +} + +type Texture struct { +} + +type Light struct { +} + +type Camera struct { +} + +type Metadata struct { +} + +type Scene struct { + Flags SceneFlag + + RootNode *Node + Meshes []*Mesh + Materials []*Material + Animations []*Animation + Textures []*Texture + Lights []*Light + Cameras []*Camera +} + +func ImportFile(file string, postProcessFlags PostProcess) (*Scene, error) { + + cstr := C.CString(file) + defer C.free(unsafe.Pointer(cstr)) + + cs := C.aiImportFile(cstr, C.uint(postProcessFlags)) + if cs == nil { + return nil, getAiErr() + } + defer C.aiReleaseImport(cs) + + return parseScene(cs), nil +} + +func getAiErr() error { + return errors.New("asig error: " + C.GoString(C.aiGetErrorString())) +} + +func parseScene(cs *C.struct_aiScene) *Scene { + + s := &Scene{} + s.Flags = SceneFlag(cs.mFlags) + s.Meshes = parseMeshes(cs.mMeshes, uint(cs.mNumMeshes)) + s.Materials = parseMaterials(cs.mMaterials, uint(cs.mNumMaterials)) + + return s +} + +func parseMeshes(cm **C.struct_aiMesh, count uint) []*Mesh { + + if cm == nil { + return []*Mesh{} + } + + meshes := make([]*Mesh, count) + cmeshes := unsafe.Slice(cm, count) + + for i := 0; i < int(count); i++ { + + m := &Mesh{} + + cmesh := cmeshes[i] + vertCount := uint(cmesh.mNumVertices) + + m.Vertices = parseVec3s(cmesh.mVertices, vertCount) + m.Normals = parseVec3s(cmesh.mNormals, vertCount) + m.Tangents = parseVec3s(cmesh.mTangents, vertCount) + m.BitTangents = parseVec3s(cmesh.mBitangents, vertCount) + + //Color sets + m.ColorSets = parseColorSet(cmesh.mColors, vertCount) + + //Tex coords + m.TexCoords = parseTexCoords(cmesh.mTextureCoords, vertCount) + m.TexCoordChannelCount = [8]uint{} + for j := 0; j < len(cmesh.mTextureCoords); j++ { + + //If a color set isn't available then it is nil + if cmesh.mTextureCoords[j] == nil { + continue + } + + m.TexCoordChannelCount[j] = uint(cmeshes[j].mNumUVComponents[j]) + } + + //Faces + cFaces := unsafe.Slice(cmesh.mFaces, cmesh.mNumFaces) + m.Faces = make([]Face, cmesh.mNumFaces) + for j := 0; j < len(m.Faces); j++ { + + m.Faces[j] = Face{ + Indices: parseUInts(cFaces[j].mIndices, uint(cFaces[j].mNumIndices)), + } + } + + //Other + m.Bones = parseBones(cmesh.mBones, uint(cmesh.mNumBones)) + m.AnimMeshes = parseAnimMeshes(cmesh.mAnimMeshes, uint(cmesh.mNumAnimMeshes)) + m.AABB = AABB{ + Min: parseVec3(&cmesh.mAABB.mMin), + Max: parseVec3(&cmesh.mAABB.mMax), + } + + m.MorphMethod = MorphMethod(cmesh.mMethod) + m.MaterialIndex = uint(cmesh.mMaterialIndex) + m.Name = parseAiString(cmesh.mName) + + meshes[i] = m + } + + return meshes +} + +func parseVec3(cv *C.struct_aiVector3D) gglm.Vec3 { + + if cv == nil { + return gglm.Vec3{} + } + + return gglm.Vec3{ + Data: [3]float32{ + float32(cv.x), + float32(cv.y), + float32(cv.z), + }, + } +} + +func parseAnimMeshes(cam **C.struct_aiAnimMesh, count uint) []*AnimMesh { + + if cam == nil { + return []*AnimMesh{} + } + + animMeshes := make([]*AnimMesh, count) + cAnimMeshes := unsafe.Slice(cam, count) + + for i := 0; i < int(count); i++ { + + m := cAnimMeshes[i] + animMeshes[i] = &AnimMesh{ + Name: parseAiString(m.mName), + Vertices: parseVec3s(m.mVertices, uint(m.mNumVertices)), + Normals: parseVec3s(m.mNormals, uint(m.mNumVertices)), + Tangents: parseVec3s(m.mTangents, uint(m.mNumVertices)), + BitTangents: parseVec3s(m.mBitangents, uint(m.mNumVertices)), + Colors: parseColorSet(m.mColors, uint(m.mNumVertices)), + TexCoords: parseTexCoords(m.mTextureCoords, uint(m.mNumVertices)), + Weight: float32(m.mWeight), + } + } + + return animMeshes +} + +func parseTexCoords(ctc [MaxTexCoords]*C.struct_aiVector3D, vertCount uint) [MaxTexCoords][]gglm.Vec3 { + + texCoords := [MaxTexCoords][]gglm.Vec3{} + + for j := 0; j < len(ctc); j++ { + + //If a color set isn't available then it is nil + if ctc[j] == nil { + continue + } + + texCoords[j] = parseVec3s(ctc[j], vertCount) + } + + return texCoords +} + +func parseColorSet(cc [MaxColorSets]*C.struct_aiColor4D, vertCount uint) [MaxColorSets][]gglm.Vec4 { + + colorSet := [MaxColorSets][]gglm.Vec4{} + for j := 0; j < len(cc); j++ { + + //If a color set isn't available then it is nil + if cc[j] == nil { + continue + } + + colorSet[j] = parseColors(cc[j], vertCount) + } + + return colorSet +} + +func parseBones(cbs **C.struct_aiBone, count uint) []*Bone { + + if cbs == nil { + return []*Bone{} + } + + bones := make([]*Bone, count) + cbones := unsafe.Slice(cbs, count) + + for i := 0; i < int(count); i++ { + + cBone := cbones[i] + bones[i] = &Bone{ + Name: parseAiString(cBone.mName), + Weights: parseVertexWeights(cBone.mWeights, uint(cBone.mNumWeights)), + OffsetMatrix: parseMat4(&cBone.mOffsetMatrix), + } + } + + return bones +} + +func parseMat4(cm4 *C.struct_aiMatrix4x4) gglm.Mat4 { + + if cm4 == nil { + return gglm.Mat4{} + } + + return gglm.Mat4{ + Data: [4][4]float32{ + {float32(cm4.a1), float32(cm4.b1), float32(cm4.c1), float32(cm4.d1)}, + {float32(cm4.a2), float32(cm4.b2), float32(cm4.c2), float32(cm4.d2)}, + {float32(cm4.a3), float32(cm4.b3), float32(cm4.c3), float32(cm4.d3)}, + {float32(cm4.a4), float32(cm4.b4), float32(cm4.c4), float32(cm4.d4)}, + }, + } +} + +func parseVertexWeights(cWeights *C.struct_aiVertexWeight, count uint) []VertexWeight { + + if cWeights == nil { + return []VertexWeight{} + } + + vw := make([]VertexWeight, count) + cvw := unsafe.Slice(cWeights, count) + + for i := 0; i < int(count); i++ { + + vw[i] = VertexWeight{ + VertIndex: uint(cvw[i].mVertexId), + Weight: float32(cvw[i].mWeight), + } + } + + return vw +} + +func parseAiString(aiString C.struct_aiString) string { + return C.GoStringN(&aiString.data[0], C.int(aiString.length)) +} + +func parseUInts(cui *C.uint, count uint) []uint { + + if cui == nil { + return []uint{} + } + + uints := make([]uint, count) + cUInts := unsafe.Slice(cui, count) + for i := 0; i < len(cUInts); i++ { + uints[i] = uint(cUInts[i]) + } + + return uints +} + +func parseVec3s(cv *C.struct_aiVector3D, count uint) []gglm.Vec3 { + + if cv == nil { + return []gglm.Vec3{} + } + + carr := unsafe.Slice(cv, count) + verts := make([]gglm.Vec3, count) + + for i := 0; i < int(count); i++ { + verts[i] = gglm.Vec3{ + Data: [3]float32{ + float32(carr[i].x), + float32(carr[i].y), + float32(carr[i].z), + }, + } + } + + return verts +} + +func parseColors(cv *C.struct_aiColor4D, count uint) []gglm.Vec4 { + + if cv == nil { + return []gglm.Vec4{} + } + + carr := unsafe.Slice(cv, count) + verts := make([]gglm.Vec4, count) + + for i := 0; i < int(count); i++ { + verts[i] = gglm.Vec4{ + Data: [4]float32{ + float32(carr[i].r), + float32(carr[i].g), + float32(carr[i].b), + float32(carr[i].a), + }, + } + } + + return verts +} + +func parseMaterials(cMatsIn **C.struct_aiMaterial, count uint) []*Material { + + mats := make([]*Material, count) + cMats := unsafe.Slice(cMatsIn, count) + + for i := 0; i < int(count); i++ { + + mats[i] = &Material{ + Properties: parseMatProperties(cMats[i].mProperties, uint(cMats[i].mNumProperties)), + AllocatedStorage: uint(cMats[i].mNumAllocated), + } + } + + return mats +} + +func parseMatProperties(cMatPropsIn **C.struct_aiMaterialProperty, count uint) []*MaterialProperty { + + matProps := make([]*MaterialProperty, count) + cMatProps := unsafe.Slice(cMatPropsIn, count) + + for i := 0; i < int(count); i++ { + + cmp := cMatProps[i] + + matProps[i] = &MaterialProperty{ + name: parseAiString(cmp.mKey), + Semantic: TextureType(cmp.mSemantic), + Index: uint(cmp.mIndex), + TypeInfo: MatPropertyTypeInfo(cmp.mType), + Data: C.GoBytes(unsafe.Pointer(cmp.mData), C.int(cmp.mDataLength)), + } + } + + return matProps +} diff --git a/asig/enums.go b/asig/enums.go index 176c5fb..6d22e82 100755 --- a/asig/enums.go +++ b/asig/enums.go @@ -226,3 +226,79 @@ const ( TextureTypeDiffuseRoughness TextureType = 16 TextureTypeAmbientOcclusion TextureType = 17 ) + +func (tp TextureType) String() string { + + switch tp { + case TextureTypeNone: + return "None" + case TextureTypeDiffuse: + return "Diffuse" + case TextureTypeSpecular: + return "Specular" + case TextureTypeAmbient: + return "Ambient" + case TextureTypeAmbientOcclusion: + return "AmbientOcclusion" + case TextureTypeBaseColor: + return "BaseColor" + case TextureTypeDiffuseRoughness: + return "DiffuseRoughness" + case TextureTypeDisplacement: + return "Displacement" + case TextureTypeEmissionColor: + return "EmissionColor" + case TextureTypeEmissive: + return "Emissive" + case TextureTypeHeight: + return "Height" + case TextureTypeLightmap: + return "Lightmap" + case TextureTypeMetalness: + return "Metalness" + case TextureTypeNormal: + return "Normal" + case TextureTypeNormalCamera: + return "NormalCamera" + case TextureTypeOpacity: + return "Opacity" + case TextureTypeReflection: + return "Reflection" + case TextureTypeShininess: + return "Shininess" + case TextureTypeUnknown: + return "Unknown" + default: + return "Invalid" + } +} + +type MatPropertyTypeInfo int32 + +const ( + MatPropTypeInfoFloat32 MatPropertyTypeInfo = iota + 1 + MatPropTypeInfoFloat64 + MatPropTypeInfoString + MatPropTypeInfoInt32 + + //Simple binary buffer, content undefined. Not convertible to anything. + MatPropTypeInfoBuffer +) + +func (mpti MatPropertyTypeInfo) String() string { + + switch mpti { + case MatPropTypeInfoFloat32: + return "Float32" + case MatPropTypeInfoFloat64: + return "Float64" + case MatPropTypeInfoString: + return "String" + case MatPropTypeInfoInt32: + return "Int32" + case MatPropTypeInfoBuffer: + return "Buffer" + default: + return "Unknown" + } +} diff --git a/asig/material.go b/asig/material.go index 38246bf..aa73d53 100755 --- a/asig/material.go +++ b/asig/material.go @@ -38,15 +38,3 @@ type MaterialProperty struct { */ Data []byte } - -type MatPropertyTypeInfo int32 - -const ( - MatPropTypeInfoFloat32 MatPropertyTypeInfo = iota + 1 - MatPropTypeInfoFloat64 - MatPropTypeInfoString - MatPropTypeInfoInt32 - - //Simple binary buffer, content undefined. Not convertible to anything. - MatPropTypeInfoBuffer -) diff --git a/main.go b/main.go index 1903f1e..81a0357 100755 --- a/main.go +++ b/main.go @@ -8,7 +8,7 @@ import ( func main() { - scene, err := asig.ImportFile("obj.obj", asig.PostProcessTriangulate) + scene, err := asig.ImportFile("tex-cube.fbx", asig.PostProcessTriangulate) if err != nil { panic(err) } @@ -21,18 +21,13 @@ func main() { } } - // verts := meshes.Get(0).MVertices() - // for i := 0; i < int(verts.Size()); i++ { - // v := verts.Get(i) - // fmt.Printf("V%v: (%v, %v, %v)\n", i, v.GetX(), v.GetY(), v.GetZ()) - // } + for i := 0; i < len(scene.Materials); i++ { - // scene = asig.AiImportFile("obj.fbx", uint(0)) - // meshes = scene.MMeshes() + println("Mesh:", i, "; Props:", len(scene.Materials[i].Properties)) + for j := 0; j < len(scene.Materials[i].Properties); j++ { - // verts = meshes.Get(0).MVertices() - // for i := 0; i < int(verts.Size()); i++ { - // v := verts.Get(i) - // fmt.Printf("V%v: (%v, %v, %v)\n", i, v.GetX(), v.GetY(), v.GetZ()) - // } + p := scene.Materials[i].Properties[j] + fmt.Printf("Data Type: %v; Len Bytes: %v; Texture Type: %v\n", p.TypeInfo.String(), len(p.Data), p.Semantic.String()) + } + } }