Assimp
v3.1.1 (June 2014)
|
Defines the material system of the library. More...
Classes | |
struct | aiMaterial |
Data structure for a material. More... | |
struct | aiUVTransform |
Defines how an UV channel is transformed. More... | |
Macros | |
#define | AI_DEFAULT_MATERIAL_NAME "DefaultMaterial" |
#define | AI_MATKEY_BLEND_FUNC "$mat.blend",0,0 |
#define | AI_MATKEY_BUMPSCALING "$mat.bumpscaling",0,0 |
#define | AI_MATKEY_COLOR_AMBIENT "$clr.ambient",0,0 |
#define | AI_MATKEY_COLOR_DIFFUSE "$clr.diffuse",0,0 |
#define | AI_MATKEY_COLOR_EMISSIVE "$clr.emissive",0,0 |
#define | AI_MATKEY_COLOR_REFLECTIVE "$clr.reflective",0,0 |
#define | AI_MATKEY_COLOR_SPECULAR "$clr.specular",0,0 |
#define | AI_MATKEY_COLOR_TRANSPARENT "$clr.transparent",0,0 |
#define | AI_MATKEY_ENABLE_WIREFRAME "$mat.wireframe",0,0 |
#define | AI_MATKEY_GLOBAL_BACKGROUND_IMAGE "?bg.global",0,0 |
#define | AI_MATKEY_MAPPING(type, N) _AI_MATKEY_MAPPING_BASE,type,N |
#define | AI_MATKEY_MAPPINGMODE_U(type, N) _AI_MATKEY_MAPPINGMODE_U_BASE,type,N |
#define | AI_MATKEY_MAPPINGMODE_V(type, N) _AI_MATKEY_MAPPINGMODE_V_BASE,type,N |
#define | AI_MATKEY_NAME "?mat.name",0,0 |
#define | AI_MATKEY_OPACITY "$mat.opacity",0,0 |
#define | AI_MATKEY_REFLECTIVITY "$mat.reflectivity",0,0 |
#define | AI_MATKEY_REFRACTI "$mat.refracti",0,0 |
#define | AI_MATKEY_SHADING_MODEL "$mat.shadingm",0,0 |
#define | AI_MATKEY_SHININESS "$mat.shininess",0,0 |
#define | AI_MATKEY_SHININESS_STRENGTH "$mat.shinpercent",0,0 |
#define | AI_MATKEY_TEXBLEND(type, N) _AI_MATKEY_TEXBLEND_BASE,type,N |
#define | AI_MATKEY_TEXFLAGS(type, N) _AI_MATKEY_TEXFLAGS_BASE,type,N |
#define | AI_MATKEY_TEXMAP_AXIS(type, N) _AI_MATKEY_TEXMAP_AXIS_BASE,type,N |
#define | AI_MATKEY_TEXOP(type, N) _AI_MATKEY_TEXOP_BASE,type,N |
#define | AI_MATKEY_TEXTURE(type, N) _AI_MATKEY_TEXTURE_BASE,type,N |
#define | AI_MATKEY_TWOSIDED "$mat.twosided",0,0 |
#define | AI_MATKEY_UVTRANSFORM(type, N) _AI_MATKEY_UVTRANSFORM_BASE,type,N |
#define | AI_MATKEY_UVWSRC(type, N) _AI_MATKEY_UVWSRC_BASE,type,N |
#define | AI_TEXTURE_TYPE_MAX aiTextureType_UNKNOWN |
Enumerations |
Functions | |
ASSIMP_API aiReturn | aiGetMaterialColor (const aiMaterial *pMat, const char *pKey, unsigned int type, unsigned int index, aiColor4D *pOut) |
__cplusplus More... | |
aiReturn | aiGetMaterialFloat (const aiMaterial *pMat, const char *pKey, unsigned int type, unsigned int index, float *pOut) |
Retrieve a single float property with a specific key from the material. More... | |
ASSIMP_API aiReturn | aiGetMaterialFloatArray (const aiMaterial *pMat, const char *pKey, unsigned int type, unsigned int index, float *pOut, unsigned int *pMax) |
Retrieve an array of float values with a specific key from the material. More... | |
aiReturn | aiGetMaterialInteger (const aiMaterial *pMat, const char *pKey, unsigned int type, unsigned int index, int *pOut) |
Retrieve an integer property with a specific key from a material. More... | |
ASSIMP_API aiReturn | aiGetMaterialIntegerArray (const aiMaterial *pMat, const char *pKey, unsigned int type, unsigned int index, int *pOut, unsigned int *pMax) |
__cplusplus More... | |
ASSIMP_API aiReturn | aiGetMaterialProperty (const aiMaterial *pMat, const char *pKey, unsigned int type, unsigned int index, const aiMaterialProperty **pPropOut) |
Retrieve a material property with a specific key from the material. More... | |
ASSIMP_API aiReturn | aiGetMaterialString (const aiMaterial *pMat, const char *pKey, unsigned int type, unsigned int index, aiString *pOut) |
Retrieve a string from the material property table. More... | |
ASSIMP_API aiReturn | aiGetMaterialTexture (const aiMaterial *mat, aiTextureType type, unsigned int index, aiString *path, aiTextureMapping *mapping=NULL, unsigned int *uvindex=NULL, float *blend=NULL, aiTextureOp *op=NULL, aiTextureMapMode *mapmode=NULL, unsigned int *flags=NULL) |
Helper function to get all values pertaining to a particular texture slot from a material structure. More... | |
ASSIMP_API unsigned int | aiGetMaterialTextureCount (const aiMaterial *pMat, aiTextureType type) |
Get the number of textures for a particular texture type. More... | |
ASSIMP_API aiReturn | aiGetMaterialUVTransform (const aiMaterial *pMat, const char *pKey, unsigned int type, unsigned int index, aiUVTransform *pOut) |
Retrieve a aiUVTransform value from the material property table. More... | |
Variables | |
struct aiUVTransform | PACK_STRUCT |
Detailed Description
Defines the material system of the library.
Macro Definition Documentation
#define AI_DEFAULT_MATERIAL_NAME "DefaultMaterial" |
#define AI_MATKEY_BLEND_FUNC "$mat.blend",0,0 |
#define AI_MATKEY_BUMPSCALING "$mat.bumpscaling",0,0 |
#define AI_MATKEY_COLOR_AMBIENT "$clr.ambient",0,0 |
#define AI_MATKEY_COLOR_DIFFUSE "$clr.diffuse",0,0 |
#define AI_MATKEY_COLOR_EMISSIVE "$clr.emissive",0,0 |
#define AI_MATKEY_COLOR_REFLECTIVE "$clr.reflective",0,0 |
#define AI_MATKEY_COLOR_SPECULAR "$clr.specular",0,0 |
#define AI_MATKEY_COLOR_TRANSPARENT "$clr.transparent",0,0 |
#define AI_MATKEY_ENABLE_WIREFRAME "$mat.wireframe",0,0 |
#define AI_MATKEY_GLOBAL_BACKGROUND_IMAGE "?bg.global",0,0 |
#define AI_MATKEY_MAPPING | ( | type, | |
N | |||
) | _AI_MATKEY_MAPPING_BASE,type,N |
#define AI_MATKEY_MAPPINGMODE_U | ( | type, | |
N | |||
) | _AI_MATKEY_MAPPINGMODE_U_BASE,type,N |
#define AI_MATKEY_MAPPINGMODE_V | ( | type, | |
N | |||
) | _AI_MATKEY_MAPPINGMODE_V_BASE,type,N |
#define AI_MATKEY_NAME "?mat.name",0,0 |
#define AI_MATKEY_OPACITY "$mat.opacity",0,0 |
#define AI_MATKEY_REFLECTIVITY "$mat.reflectivity",0,0 |
#define AI_MATKEY_REFRACTI "$mat.refracti",0,0 |
#define AI_MATKEY_SHADING_MODEL "$mat.shadingm",0,0 |
#define AI_MATKEY_SHININESS "$mat.shininess",0,0 |
#define AI_MATKEY_SHININESS_STRENGTH "$mat.shinpercent",0,0 |
#define AI_MATKEY_TEXBLEND | ( | type, | |
N | |||
) | _AI_MATKEY_TEXBLEND_BASE,type,N |
#define AI_MATKEY_TEXFLAGS | ( | type, | |
N | |||
) | _AI_MATKEY_TEXFLAGS_BASE,type,N |
#define AI_MATKEY_TEXMAP_AXIS | ( | type, | |
N | |||
) | _AI_MATKEY_TEXMAP_AXIS_BASE,type,N |
#define AI_MATKEY_TEXOP | ( | type, | |
N | |||
) | _AI_MATKEY_TEXOP_BASE,type,N |
#define AI_MATKEY_TEXTURE | ( | type, | |
N | |||
) | _AI_MATKEY_TEXTURE_BASE,type,N |
#define AI_MATKEY_TWOSIDED "$mat.twosided",0,0 |
#define AI_MATKEY_UVTRANSFORM | ( | type, | |
N | |||
) | _AI_MATKEY_UVTRANSFORM_BASE,type,N |
#define AI_MATKEY_UVWSRC | ( | type, | |
N | |||
) | _AI_MATKEY_UVWSRC_BASE,type,N |
#define AI_TEXTURE_TYPE_MAX aiTextureType_UNKNOWN |
Enumeration Type Documentation
enum aiBlendMode |
Defines alpha-blend flags.
If you're familiar with OpenGL or D3D, these flags aren't new to you. They define how the final color value of a pixel is computed, basing on the previous color at that pixel and the new color value from the material. The blend formula is:
where DestColor is the previous color in the framebuffer at this position and SourceColor is the material colro before the transparency calculation.
This corresponds to the AI_MATKEY_BLEND_FUNC property.
Enumerator | |
---|---|
aiBlendMode_Default |
Formula: |
aiBlendMode_Additive |
Additive blending. Formula: |
_aiBlendMode_Force32Bit |
enum aiShadingMode |
Defines all shading models supported by the library.
The list of shading modes has been taken from Blender. See Blender documentation for more information. The API does not distinguish between "specular" and "diffuse" shaders (thus the specular term for diffuse shading models like Oren-Nayar remains undefined).
Again, this value is just a hint. Assimp tries to select the shader whose most common implementation matches the original rendering results of the 3D modeller which wrote a particular model as closely as possible.
enum aiTextureFlags |
Defines some mixed flags for a particular texture.
Usually you'll instruct your cg artists how textures have to look like ... and how they will be processed in your application. However, if you use Assimp for completely generic loading purposes you might also need to process these flags in order to display as many 'unknown' 3D models as possible correctly.
This corresponds to the AI_MATKEY_TEXFLAGS property.
Enumerator | |
---|---|
aiTextureFlags_Invert |
The texture's color values have to be inverted (componentwise 1-n) |
aiTextureFlags_UseAlpha |
Explicit request to the application to process the alpha channel of the texture. Mutually exclusive with aiTextureFlags_IgnoreAlpha. These flags are set if the library can say for sure that the alpha channel is used/is not used. If the model format does not define this, it is left to the application to decide whether the texture alpha channel - if any - is evaluated or not. |
aiTextureFlags_IgnoreAlpha |
Explicit request to the application to ignore the alpha channel of the texture. Mutually exclusive with aiTextureFlags_UseAlpha. |
_aiTextureFlags_Force32Bit |
enum aiTextureMapMode |
Defines how UV coordinates outside the [0...1] range are handled.
Commonly refered to as 'wrapping mode'.
enum aiTextureMapping |
Defines how the mapping coords for a texture are generated.
Real-time applications typically require full UV coordinates, so the use of the aiProcess_GenUVCoords step is highly recommended. It generates proper UV channels for non-UV mapped objects, as long as an accurate description how the mapping should look like (e.g spherical) is given. See the AI_MATKEY_MAPPING property for more details.
Enumerator | |
---|---|
aiTextureMapping_UV |
The mapping coordinates are taken from an UV channel. The AI_MATKEY_UVWSRC key specifies from which UV channel the texture coordinates are to be taken from (remember, meshes can have more than one UV channel). |
aiTextureMapping_SPHERE |
Spherical mapping. |
aiTextureMapping_CYLINDER |
Cylindrical mapping. |
aiTextureMapping_BOX |
Cubic mapping. |
aiTextureMapping_PLANE |
Planar mapping. |
aiTextureMapping_OTHER |
Undefined mapping. Have fun. |
_aiTextureMapping_Force32Bit |
enum aiTextureOp |
Defines how the Nth texture of a specific type is combined with the result of all previous layers.
Example (left: key, right: value):
Written as equation, the final diffuse term for a specific pixel would be:
where 'diffContrib' is the intensity of the incoming light for that pixel.
enum aiTextureType |
Defines the purpose of a texture.
This is a very difficult topic. Different 3D packages support different kinds of textures. For very common texture types, such as bumpmaps, the rendering results depend on implementation details in the rendering pipelines of these applications. Assimp loads all texture references from the model file and tries to determine which of the predefined texture types below is the best choice to match the original use of the texture as closely as possible.
In content pipelines you'll usually define how textures have to be handled, and the artists working on models have to conform to this specification, regardless which 3D tool they're using.
Enumerator | |
---|---|
aiTextureType_NONE |
Dummy value. No texture, but the value to be used as 'texture semantic' (#aiMaterialProperty::mSemantic) for all material properties not related to textures. |
aiTextureType_DIFFUSE |
The texture is combined with the result of the diffuse lighting equation. |
aiTextureType_SPECULAR |
The texture is combined with the result of the specular lighting equation. |
aiTextureType_AMBIENT |
The texture is combined with the result of the ambient lighting equation. |
aiTextureType_EMISSIVE |
The texture is added to the result of the lighting calculation. It isn't influenced by incoming light. |
aiTextureType_HEIGHT |
The texture is a height map. By convention, higher gray-scale values stand for higher elevations from the base height. |
aiTextureType_NORMALS |
The texture is a (tangent space) normal-map. Again, there are several conventions for tangent-space normal maps. Assimp does (intentionally) not distinguish here. |
aiTextureType_SHININESS |
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. |
aiTextureType_OPACITY |
The texture defines per-pixel opacity. Usually 'white' means opaque and 'black' means 'transparency'. Or quite the opposite. Have fun. |
aiTextureType_DISPLACEMENT |
Displacement texture. The exact purpose and format is application-dependent. Higher color values stand for higher vertex displacements. |
aiTextureType_LIGHTMAP |
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. |
aiTextureType_REFLECTION |
Reflection texture. Contains the color of a perfect mirror reflection. Rarely used, almost never for real-time applications. |
aiTextureType_UNKNOWN |
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 postprocessing. |
_aiTextureType_Force32Bit |
Function Documentation
ASSIMP_API aiReturn aiGetMaterialColor | ( | const aiMaterial * | pMat, |
const char * | pKey, | ||
unsigned int | type, | ||
unsigned int | index, | ||
aiColor4D * | pOut | ||
) |
__cplusplus
Retrieve a color value from the material property table
See the sample for aiGetMaterialFloat for more information
|
inline |
Retrieve a single float property with a specific key from the material.
Pass one of the AI_MATKEY_XXX constants for the last three parameters (the example reads the AI_MATKEY_SHININESS_STRENGTH property of the first diffuse texture)
- Parameters
-
pMat Pointer to the input material. May not be NULL pKey Key to search for. One of the AI_MATKEY_XXX constants. pOut Receives the output float. type (see the code sample above) index (see the code sample above)
- Returns
- Specifies whether the key has been found. If not, the output float remains unmodified.
ASSIMP_API aiReturn aiGetMaterialFloatArray | ( | const aiMaterial * | pMat, |
const char * | pKey, | ||
unsigned int | type, | ||
unsigned int | index, | ||
float * | pOut, | ||
unsigned int * | pMax | ||
) |
Retrieve an array of float values with a specific key from the material.
Pass one of the AI_MATKEY_XXX constants for the last three parameters (the example reads the AI_MATKEY_UVTRANSFORM property of the first diffuse texture)
- Parameters
-
pMat Pointer to the input material. May not be NULL pKey Key to search for. One of the AI_MATKEY_XXX constants. pOut Pointer to a buffer to receive the result. pMax Specifies the size of the given buffer, in float's. Receives the number of values (not bytes!) read. type (see the code sample above) index (see the code sample above)
- Returns
- Specifies whether the key has been found. If not, the output arrays remains unmodified and pMax is set to 0.
|
inline |
Retrieve an integer property with a specific key from a material.
See the sample for aiGetMaterialFloat for more information.
ASSIMP_API aiReturn aiGetMaterialIntegerArray | ( | const aiMaterial * | pMat, |
const char * | pKey, | ||
unsigned int | type, | ||
unsigned int | index, | ||
int * | pOut, | ||
unsigned int * | pMax | ||
) |
__cplusplus
Retrieve an array of integer values with a specific key from a material
See the sample for aiGetMaterialFloatArray for more information.
ASSIMP_API aiReturn aiGetMaterialProperty | ( | const aiMaterial * | pMat, |
const char * | pKey, | ||
unsigned int | type, | ||
unsigned int | index, | ||
const aiMaterialProperty ** | pPropOut | ||
) |
Retrieve a material property with a specific key from the material.
- Parameters
-
pMat Pointer to the input material. May not be NULL pKey Key to search for. One of the AI_MATKEY_XXX constants. type Specifies the type of the texture to be retrieved ( e.g. diffuse, specular, height map ...) index Index of the texture to be retrieved. pPropOut Pointer to receive a pointer to a valid aiMaterialProperty structure or NULL if the key has not been found.
ASSIMP_API aiReturn aiGetMaterialString | ( | const aiMaterial * | pMat, |
const char * | pKey, | ||
unsigned int | type, | ||
unsigned int | index, | ||
aiString * | pOut | ||
) |
Retrieve a string from the material property table.
See the sample for aiGetMaterialFloat for more information.
ASSIMP_API aiReturn aiGetMaterialTexture | ( | const aiMaterial * | mat, |
aiTextureType | type, | ||
unsigned int | index, | ||
aiString * | path, | ||
aiTextureMapping * | mapping = NULL , |
||
unsigned int * | uvindex = NULL , |
||
float * | blend = NULL , |
||
aiTextureOp * | op = NULL , |
||
aiTextureMapMode * | mapmode = NULL , |
||
unsigned int * | flags = NULL |
||
) |
Helper function to get all values pertaining to a particular texture slot from a material structure.
This function is provided just for convenience. You could also read the texture by parsing all of its properties manually. This function bundles all of them in a huge function monster.
- Parameters
-
[in] mat Pointer to the input material. May not be NULL [in] type Specifies the texture stack to read from (e.g. diffuse, specular, height map ...). [in] index Index of the texture. The function fails if the requested index is not available for this texture type. aiGetMaterialTextureCount() can be used to determine the number of textures in a particular texture stack. [out] path Receives the output path This parameter must be non-null. mapping The texture mapping mode to be used. Pass NULL if you're not interested in this information. [out] uvindex For UV-mapped textures: receives the index of the UV source channel. Unmodified otherwise. Pass NULL if you're not interested in this information. [out] blend Receives the blend factor for the texture Pass NULL if you're not interested in this information. [out] op Receives the texture blend operation to be perform between this texture and the previous texture. Pass NULL if you're not interested in this information. [out] mapmode Receives the mapping modes to be used for the texture. Pass NULL if you're not interested in this information. Otherwise, pass a pointer to an array of two aiTextureMapMode's (one for each axis, UV order). [out] flags Receives the the texture flags.
- Returns
- AI_SUCCESS on success, otherwise something else. Have fun.
ASSIMP_API unsigned int aiGetMaterialTextureCount | ( | const aiMaterial * | pMat, |
aiTextureType | type | ||
) |
Get the number of textures for a particular texture type.
- Parameters
-
[in] pMat Pointer to the input material. May not be NULL type Texture type to check for
- Returns
- Number of textures for this type.
- Note
- A texture can be easily queried using aiGetMaterialTexture()
ASSIMP_API aiReturn aiGetMaterialUVTransform | ( | const aiMaterial * | pMat, |
const char * | pKey, | ||
unsigned int | type, | ||
unsigned int | index, | ||
aiUVTransform * | pOut | ||
) |
Retrieve a aiUVTransform value from the material property table.
See the sample for aiGetMaterialFloat for more information
Variable Documentation
struct aiUVTransform PACK_STRUCT |
Generated on Sun Feb 21 2016 19:42:29 for Assimp by 1.8.11