mirror of
https://github.com/bloeys/assimp-go.git
synced 2025-12-29 08:28:20 +00:00
Stringer for some enums
This commit is contained in:
@ -12,6 +12,7 @@ package asig
|
||||
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 (
|
||||
|
||||
@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
)
|
||||
|
||||
21
main.go
21
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())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user