Documentation
¶
Index ¶
- Constants
- func GetMaterialTextureCount(m *Material, texType TextureType) int
- type AABB
- type AnimMesh
- type Animation
- type Bone
- type Camera
- type EmbeddedTexture
- type Face
- type GetMatTexInfo
- type Light
- type MatPropertyTypeInfo
- type Material
- type MaterialProperty
- type Mesh
- type Metadata
- type MetadataEntry
- type MetadataType
- type MorphMethod
- type Node
- type PostProcess
- type PrimitiveType
- type Scene
- type SceneFlag
- type TextureType
- type VertexWeight
Constants ¶
View Source
const ( PrimitiveTypePoint = 1 << 0 PrimitiveTypeLine = 1 << 1 PrimitiveTypeTriangle = 1 << 2 PrimitiveTypePolygon = 1 << 3 )
View Source
const ( //Interpolation between morph targets MorphMethodVertexBlend = 0x1 //Normalized morphing between morph targets MorphMethodMorphNormalized = 0x2 //Relative morphing between morph targets MorphMethodMorphRelative = 0x3 )
View Source
const ( MaxColorSets = 8 MaxTexCoords = 8 )
Variables ¶
This section is empty.
Functions ¶
func GetMaterialTextureCount ¶
func GetMaterialTextureCount(m *Material, texType TextureType) int
Types ¶
type AnimMesh ¶
type AnimMesh struct { Name string /** Replacement for Mes.Vertices. If this array is non-NULL, * it *must* contain mNumVertices entries. The corresponding * array in the host mesh must be non-NULL as well - animation * meshes may neither add or nor remove vertex components (if * a replacement array is NULL and the corresponding source * array is not, the source data is taken instead)*/ Vertices []glm.Vec3 Normals []glm.Vec3 Tangents []glm.Vec3 BitTangents []glm.Vec3 Colors [MaxColorSets][]glm.Vec4 TexCoords [MaxTexCoords][]glm.Vec3 Weight float32 }
type Bone ¶
type Bone struct { Name string //The influence weights of this bone Weights []VertexWeight /** Matrix that transforms from bone space to mesh space in bind pose. * * This matrix describes the position of the mesh * in the local space of this bone when the skeleton was bound. * Thus it can be used directly to determine a desired vertex position, * given the world-space transform of the bone when animated, * and the position of the vertex in mesh space. * * It is sometimes called an inverse-bind matrix, * or inverse bind pose matrix. */ OffsetMatrix glm.Mat4 }
type EmbeddedTexture ¶
type EmbeddedTexture struct { /** Width of the texture, in pixels * * If mHeight is zero the texture is compressed in a format * like JPEG. In this case mWidth specifies the size of the * memory area pcData is pointing to, in bytes. */ Width uint /** Height of the texture, in pixels * * If this value is zero, pcData points to an compressed texture * in any format (e.g. JPEG). */ Height uint /** A hint from the loader to make it easier for applications * to determine the type of embedded textures. * * If Height != 0 this member is show how data is packed. Hint will consist of * two parts: channel order and channel bitness (count of the bits for every * color channel). For simple parsing by the viewer it's better to not omit * absent color channel and just use 0 for bitness. For example: * 1. Image contain RGBA and 8 bit per channel, achFormatHint == "rgba8888"; * 2. Image contain ARGB and 8 bit per channel, achFormatHint == "argb8888"; * 3. Image contain RGB and 5 bit for R and B channels and 6 bit for G channel, achFormatHint == "rgba5650"; * 4. One color image with B channel and 1 bit for it, achFormatHint == "rgba0010"; * If mHeight == 0 then achFormatHint is set set to '\\0\\0\\0\\0' if the loader has no additional * information about the texture file format used OR the * file extension of the format without a trailing dot. If there * are multiple file extensions for a format, the shortest * extension is chosen (JPEG maps to 'jpg', not to 'jpeg'). * E.g. 'dds\\0', 'pcx\\0', 'jpg\\0'. All characters are lower-case. * The fourth character will always be '\\0'. */ FormatHint string /** Data of the texture. * Points to an array of Width * Height (or just len=Width if Height=0, which happens when data is compressed, like if the data is a PNG). * The format of the texture data is always ARGB8888. */ Data []byte IsCompressed bool Filename string // contains filtered or unexported fields }
type GetMatTexInfo ¶
type GetMatTexInfo struct {
Path string
}
func GetMaterialTexture ¶
func GetMaterialTexture(m *Material, texType TextureType, texIndex uint) (*GetMatTexInfo, error)
type MatPropertyTypeInfo ¶
type MatPropertyTypeInfo int32
const ( MatPropTypeInfoFloat32 MatPropertyTypeInfo = iota + 1 MatPropTypeInfoFloat64 MatPropTypeInfoString MatPropTypeInfoInt32 //Simple binary buffer, content undefined. Not convertible to anything. MatPropTypeInfoBuffer )
func (MatPropertyTypeInfo) String ¶
func (mpti MatPropertyTypeInfo) String() string
type Material ¶
type Material struct { /** List of all material properties loaded. */ Properties []*MaterialProperty /** Storage allocated */ AllocatedStorage uint // contains filtered or unexported fields }
type MaterialProperty ¶
type MaterialProperty struct { /** Textures: Specifies their exact usage semantic. * For non-texture properties, this member is always 0 (aka TextureTypeNone). */ Semantic TextureType /** Textures: Specifies the index of the texture. * For non-texture properties, this member is always 0. */ Index uint /** Type information for the property. * * Defines the data layout inside the data buffer. This is used * by the library internally to perform debug checks and to * utilize proper type conversions. * (It's probably a hacky solution, but it works.) */ TypeInfo MatPropertyTypeInfo //Binary buffer to hold the property's value. Data []byte // contains filtered or unexported fields }
type Mesh ¶
type Mesh struct { //Bitwise combination of PrimitiveType enum PrimitiveTypes PrimitiveType Vertices []glm.Vec3 Normals []glm.Vec3 Tangents []glm.Vec3 BitTangents []glm.Vec3 //ColorSets vertex color sets where each set is either empty or has length=len(Vertices), with max number of sets=MaxColorSets ColorSets [MaxColorSets][]glm.Vec4 //TexCoords (aka UV channels) where each TexCoords[i] has NumUVComponents[i] channels, and is either empty or has length=len(Vertices), with max number of TexCoords per vertex = MaxTexCoords TexCoords [MaxTexCoords][]glm.Vec3 TexCoordChannelCount [MaxTexCoords]uint Faces []Face Bones []*Bone AnimMeshes []*AnimMesh AABB AABB MorphMethod MorphMethod MaterialIndex uint Name string }
type Metadata ¶
type Metadata struct { Type MetadataType Value interface{} }
type MetadataEntry ¶
type MetadataEntry struct {
Data []byte
}
type MetadataType ¶
type MetadataType int32
const ( MetadataTypeBool MetadataType = 0 MetadataTypeInt32 MetadataType = 1 MetadataTypeUint64 MetadataType = 2 MetadataTypeFloat32 MetadataType = 3 MetadataTypeFloat64 MetadataType = 4 MetadataTypeString MetadataType = 5 MetadataTypeVec3 MetadataType = 6 MetadataTypeMAX MetadataType = 7 )
type MorphMethod ¶
type MorphMethod int32
MorphMethod specifies the Supported methods of mesh morphing
type Node ¶
type Node struct { Name string //The transformation relative to the node's parent Transformation *glm.Mat4 //Parent node. NULL if this node is the root node Parent *Node //The child nodes of this node. NULL if mNumChildren is 0 Children []*Node //Each entry is an index into the mesh list of the scene MeshIndicies []uint /** Metadata associated with this node or NULL if there is no metadata. * Whether any metadata is generated depends on the source file format. See the * @link importer_notes @endlink page for more information on every source file * format. Importers that don't document any metadata don't write any. */ Metadata map[string]Metadata }
type PostProcess ¶
type PostProcess int64
PostProcess defines the flags for all possible post processing steps.
const ( PostProcessCalcTangentSpace PostProcess = 0x1 PostProcessJoinIdenticalVertices PostProcess = 0x2 PostProcessMakeLeftHanded PostProcess = 0x4 PostProcessTriangulate PostProcess = 0x8 PostProcessRemoveComponent PostProcess = 0x10 PostProcessGenNormals PostProcess = 0x20 PostProcessGenSmoothNormals PostProcess = 0x40 PostProcessSplitLargeMeshes PostProcess = 0x80 PostProcessPreTransformVertices PostProcess = 0x100 PostProcessLimitBoneWeights PostProcess = 0x200 PostProcessValidateDataStructure PostProcess = 0x400 PostProcessImproveCacheLocality PostProcess = 0x800 PostProcessRemoveRedundantMaterials PostProcess = 0x1000 PostProcessFixInfacingNormals PostProcess = 0x2000 PostProcessSortByPType PostProcess = 0x8000 PostProcessFindDegenerates PostProcess = 0x10000 PostProcessFindInvalidData PostProcess = 0x20000 PostProcessGenUVCoords PostProcess = 0x40000 PostProcessTransformUVCoords PostProcess = 0x80000 PostProcessFindInstances PostProcess = 0x100000 PostProcessOptimizeMeshes PostProcess = 0x200000 PostProcessOptimizeGraph PostProcess = 0x400000 PostProcessFlipUVs PostProcess = 0x800000 PostProcessFlipWindingOrder PostProcess = 0x1000000 PostProcessSplitByBoneCount PostProcess = 0x2000000 PostProcessDebone PostProcess = 0x4000000 PostProcessGlobalScale PostProcess = 0x8000000 PostProcessEmbedTextures PostProcess = 0x10000000 PostProcessForceGenNormals PostProcess = 0x20000000 PostProcessDropNormals PostProcess = 0x40000000 PostProcessGenBoundingBoxes PostProcess = 0x80000000 )
type PrimitiveType ¶
type PrimitiveType int32
aiGetErrorString specifies the types of primitives that can be present in a mesh
type Scene ¶
type Scene struct { Flags SceneFlag RootNode *Node Meshes []*Mesh Materials []*Material /** Helper structure to describe an embedded texture * * Normally textures are contained in external files but some file formats embed * them directly in the model file. There are two types of embedded textures: * 1. Uncompressed textures. The color data is given in an uncompressed format. * 2. Compressed textures stored in a file format like png or jpg. The raw file * bytes are given so the application must utilize an image decoder (e.g. DevIL) to * get access to the actual color data. * * Embedded textures are referenced from materials using strings like "*0", "*1", etc. * as the texture paths (a single asterisk character followed by the * zero-based index of the texture in the aiScene::mTextures array). */ Textures []*EmbeddedTexture // contains filtered or unexported fields }
func ImportFile ¶
func ImportFile(file string, postProcessFlags PostProcess) (s *Scene, release func(), err error)
type SceneFlag ¶
type SceneFlag int32
const ( /** * Specifies that the scene data structure that was imported is not complete. * This flag bypasses some internal validations and allows the import * of animation skeletons, material libraries or camera animation paths * using Assimp. Most applications won't support such data. */ SceneFlagIncomplete SceneFlag = 1 << 0 /** * This flag is set by the validation postprocess-step (PostProcessValidateDataStructure) * if the validation is successful. In a validated scene you can be sure that * any cross references in the data structure (e.g. vertex indices) are valid. */ SceneFlagValidated SceneFlag = 1 << 1 /** * This flag is set by the validation postprocess-step (PostProcessValidateDataStructure) * if the validation is successful but some issues have been found. * This can for example mean that a texture that does not exist is referenced * by a material or that the bone weights for a vertex don't sum to 1.0 ... . * In most cases you should still be able to use the import. This flag could * be useful for applications which don't capture Assimp's log output. */ SceneFlagValidationWarning SceneFlag = 1 << 2 /** * This flag is currently only set by the PostProcessJoinIdenticalVertices step. * It indicates that the vertices of the output meshes aren't in the internal * verbose format anymore. In the verbose format all vertices are unique, * no vertex is ever referenced by more than one face. */ SceneFlagNonVerboseFormat SceneFlag = 1 << 3 /** * Denotes pure height-map terrain data. Pure terrains usually consist of quads, * sometimes triangles, in a regular grid. The x,y coordinates of all vertex * positions refer to the x,y coordinates on the terrain height map, the z-axis * stores the elevation at a specific point. * * TER (Terragen) and HMP (3D Game Studio) are height map formats. * @note Assimp is probably not the best choice for loading *huge* terrains - * fully triangulated data takes extremely much free store and should be avoided * as long as possible (typically you'll do the triangulation when you actually * need to render it). */ SceneFlagTerrain SceneFlag = 1 << 4 SceneFlagAllowShared SceneFlag = 1 << 5 )
type TextureType ¶
type TextureType int32
const ( /** Dummy value. * * No texture, but the value to be used as 'texture semantic' * (MaterialProperty.Semantic) for all material properties * *not* related to textures. */ TextureTypeNone TextureType = 0 /** The texture is combined with the result of the diffuse * lighting equation. */ TextureTypeDiffuse TextureType = 1 /** The texture is combined with the result of the specular * lighting equation. */ TextureTypeSpecular TextureType = 2 /** The texture is combined with the result of the ambient * lighting equation. */ TextureTypeAmbient TextureType = 3 /** The texture is added to the result of the lighting * calculation. It isn't influenced by incoming light. */ TextureTypeEmissive TextureType = 4 /** The texture is a height map. * * By convention, higher gray-scale values stand for * higher elevations from the base height. */ TextureTypeHeight TextureType = 5 /** The texture is a (tangent space) normal-map. * * Agn, there are several conventions for tangent-space * normal maps. Assimp does (intentionally) not * distinguish here. */ TextureTypeNormal TextureType = 6 /** The texture defines the glossiness of the material. * * The glossiness is in fact the exponent of the specular * (phong) lighting equation. Usually there is a conversion * function defined to map the linear color values in the * texture to a suitable exponent. Have fun. */ TextureTypeShininess TextureType = 7 /** The texture defines per-pixel opacity. * * Usually 'white' means opaque and 'black' means * 'transparency'. Or quite the opposite. Have fun. */ TextureTypeOpacity TextureType = 8 /** Displacement texture * * The exact purpose and format is application-dependent. * Higher color values stand for higher vertex displacements. */ TextureTypeDisplacement TextureType = 9 /** Lightmap texture (aka Ambient Occlusion) * * Both 'Lightmaps' and dedicated 'ambient occlusion maps' are * covered by this material property. The texture contains a * scaling value for the final color value of a pixel. Its * intensity is not affected by incoming light. */ TextureTypeLightmap TextureType = 10 /** Reflection texture * * Contains the color of a perfect mirror reflection. * Rarely used, almost never for real-time applications. */ TextureTypeReflection TextureType = 11 /** Unknown texture * A texture reference that does not match any of the definitions * above is considered to be 'unknown'. It is still imported, * but is excluded from any further post-processing. */ TextureTypeUnknown TextureType = 18 )
const ( TextureTypeBaseColor TextureType = 12 TextureTypeNormalCamera TextureType = 13 TextureTypeEmissionColor TextureType = 14 TextureTypeMetalness TextureType = 15 TextureTypeDiffuseRoughness TextureType = 16 TextureTypeAmbientOcclusion TextureType = 17 )
* PBR Materials
- PBR definitions from maya and other modelling packages now use this standard.
- This was originally introduced around 2012.
- Support for this is in game engines like Godot, Unreal or Unity3D.
- Modelling packages which use this are very common now.
func (TextureType) String ¶
func (tp TextureType) String() string
type VertexWeight ¶
Click to show internal directories.
Click to hide internal directories.