Merge branch 'master' into master
This commit is contained in:
@@ -144,7 +144,7 @@ enum aiTextureMapMode {
|
||||
enum aiTextureMapping {
|
||||
/** The mapping coordinates are taken from an UV channel.
|
||||
*
|
||||
* The #AI_MATKEY_UVWSRC key specifies from which UV channel
|
||||
* #AI_MATKEY_UVWSRC property specifies from which UV channel
|
||||
* the texture coordinates are to be taken from (remember,
|
||||
* meshes can have more than one UV channel).
|
||||
*/
|
||||
@@ -202,11 +202,15 @@ enum aiTextureType {
|
||||
|
||||
/** The texture is combined with the result of the diffuse
|
||||
* lighting equation.
|
||||
* OR
|
||||
* PBR Specular/Glossiness
|
||||
*/
|
||||
aiTextureType_DIFFUSE = 1,
|
||||
|
||||
/** The texture is combined with the result of the specular
|
||||
* lighting equation.
|
||||
* OR
|
||||
* PBR Specular/Glossiness
|
||||
*/
|
||||
aiTextureType_SPECULAR = 2,
|
||||
|
||||
@@ -288,6 +292,32 @@ enum aiTextureType {
|
||||
aiTextureType_DIFFUSE_ROUGHNESS = 16,
|
||||
aiTextureType_AMBIENT_OCCLUSION = 17,
|
||||
|
||||
/** PBR Material Modifiers
|
||||
* Some modern renderers have further PBR modifiers that may be overlaid
|
||||
* on top of the 'base' PBR materials for additional realism.
|
||||
* These use multiple texture maps, so only the base type is directly defined
|
||||
*/
|
||||
|
||||
/** Sheen
|
||||
* Generally used to simulate textiles that are covered in a layer of microfibers
|
||||
* eg velvet
|
||||
* https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_sheen
|
||||
*/
|
||||
aiTextureType_SHEEN = 19,
|
||||
|
||||
/** Clearcoat
|
||||
* Simulates a layer of 'polish' or 'laquer' layered on top of a PBR substrate
|
||||
* https://autodesk.github.io/standard-surface/#closures/coating
|
||||
* https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_clearcoat
|
||||
*/
|
||||
aiTextureType_CLEARCOAT = 20,
|
||||
|
||||
/** Transmission
|
||||
* Simulates transmission through the surface
|
||||
* May include further information such as wall thickness
|
||||
*/
|
||||
aiTextureType_TRANSMISSION = 21,
|
||||
|
||||
/** Unknown texture
|
||||
*
|
||||
* A texture reference that does not match any of the definitions
|
||||
@@ -309,7 +339,9 @@ ASSIMP_API const char *TextureTypeToString(enum aiTextureType in);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** @brief Defines all shading models supported by the library
|
||||
*
|
||||
*
|
||||
* Property: #AI_MATKEY_SHADING_MODEL
|
||||
*
|
||||
* 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
|
||||
@@ -318,6 +350,7 @@ ASSIMP_API const char *TextureTypeToString(enum aiTextureType in);
|
||||
* 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 modeler which wrote a particular model as closely as possible.
|
||||
*
|
||||
*/
|
||||
enum aiShadingMode {
|
||||
/** Flat shading. Shading is done on per-face base,
|
||||
@@ -364,13 +397,28 @@ enum aiShadingMode {
|
||||
aiShadingMode_CookTorrance = 0x8,
|
||||
|
||||
/** No shading at all. Constant light influence of 1.0.
|
||||
* Also known as "Unlit"
|
||||
*/
|
||||
aiShadingMode_NoShading = 0x9,
|
||||
aiShadingMode_Unlit = aiShadingMode_NoShading, // Alias
|
||||
|
||||
/** Fresnel shading
|
||||
*/
|
||||
aiShadingMode_Fresnel = 0xa,
|
||||
|
||||
/** Physically-Based Rendering (PBR) shading using
|
||||
* Bidirectional scattering/reflectance distribution function (BSDF/BRDF)
|
||||
* There are multiple methods under this banner, and model files may provide
|
||||
* data for more than one PBR-BRDF method.
|
||||
* Applications should use the set of provided properties to determine which
|
||||
* of their preferred PBR rendering methods are likely to be available
|
||||
* eg:
|
||||
* - If AI_MATKEY_METALLIC_FACTOR is set, then a Metallic/Roughness is available
|
||||
* - If AI_MATKEY_GLOSSINESS_FACTOR is set, then a Specular/Glossiness is available
|
||||
* Note that some PBR methods allow layering of techniques
|
||||
*/
|
||||
aiShadingMode_PBR_BRDF = 0xb,
|
||||
|
||||
#ifndef SWIG
|
||||
_aiShadingMode_Force32Bit = INT_MAX
|
||||
#endif
|
||||
@@ -922,12 +970,66 @@ extern "C" {
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PBR material support
|
||||
// --------------------
|
||||
// Properties defining PBR rendering techniques
|
||||
#define AI_MATKEY_USE_COLOR_MAP "$mat.useColorMap", 0, 0
|
||||
|
||||
// Metallic/Roughness Workflow
|
||||
// ---------------------------
|
||||
// Base RGBA color factor. Will be multiplied by final base color texture values if extant
|
||||
// Note: Importers may choose to copy this into AI_MATKEY_COLOR_DIFFUSE for compatibility
|
||||
// with renderers and formats that do not support Metallic/Roughness PBR
|
||||
#define AI_MATKEY_BASE_COLOR "$clr.base", 0, 0
|
||||
#define AI_MATKEY_BASE_COLOR_TEXTURE aiTextureType_BASE_COLOR, 0
|
||||
#define AI_MATKEY_USE_METALLIC_MAP "$mat.useMetallicMap", 0, 0
|
||||
// Metallic factor. 0.0 = Full Dielectric, 1.0 = Full Metal
|
||||
#define AI_MATKEY_METALLIC_FACTOR "$mat.metallicFactor", 0, 0
|
||||
#define AI_MATKEY_METALLIC_TEXTURE aiTextureType_METALNESS, 0
|
||||
#define AI_MATKEY_USE_ROUGHNESS_MAP "$mat.useRoughnessMap", 0, 0
|
||||
// Roughness factor. 0.0 = Perfectly Smooth, 1.0 = Completely Rough
|
||||
#define AI_MATKEY_ROUGHNESS_FACTOR "$mat.roughnessFactor", 0, 0
|
||||
#define AI_MATKEY_ROUGHNESS_TEXTURE aiTextureType_DIFFUSE_ROUGHNESS, 0
|
||||
|
||||
// Specular/Glossiness Workflow
|
||||
// ---------------------------
|
||||
// Diffuse/Albedo Color. Note: Pure Metals have a diffuse of {0,0,0}
|
||||
// AI_MATKEY_COLOR_DIFFUSE
|
||||
// Specular Color.
|
||||
// Note: Metallic/Roughness may also have a Specular Color
|
||||
// AI_MATKEY_COLOR_SPECULAR
|
||||
#define AI_MATKEY_SPECULAR_FACTOR "$mat.specularFactor", 0, 0
|
||||
// Glossiness factor. 0.0 = Completely Rough, 1.0 = Perfectly Smooth
|
||||
#define AI_MATKEY_GLOSSINESS_FACTOR "$mat.glossinessFactor", 0, 0
|
||||
|
||||
// Sheen
|
||||
// -----
|
||||
// Sheen base RGB color. Default {0,0,0}
|
||||
#define AI_MATKEY_SHEEN_COLOR_FACTOR "$clr.sheen.factor", 0, 0
|
||||
// Sheen Roughness Factor.
|
||||
#define AI_MATKEY_SHEEN_ROUGHNESS_FACTOR "$mat.sheen.roughnessFactor", 0, 0
|
||||
#define AI_MATKEY_SHEEN_COLOR_TEXTURE aiTextureType_SHEEN, 0
|
||||
#define AI_MATKEY_SHEEN_ROUGHNESS_TEXTURE aiTextureType_SHEEN, 1
|
||||
|
||||
// Clearcoat
|
||||
// ---------
|
||||
// Clearcoat layer intensity. 0.0 = none (disabled)
|
||||
#define AI_MATKEY_CLEARCOAT_FACTOR "$mat.clearcoat.factor", 0, 0
|
||||
#define AI_MATKEY_CLEARCOAT_ROUGHNESS_FACTOR "$mat.clearcoat.roughnessFactor", 0, 0
|
||||
#define AI_MATKEY_CLEARCOAT_TEXTURE aiTextureType_CLEARCOAT, 0
|
||||
#define AI_MATKEY_CLEARCOAT_ROUGHNESS_TEXTURE aiTextureType_CLEARCOAT, 1
|
||||
#define AI_MATKEY_CLEARCOAT_NORMAL_TEXTURE aiTextureType_CLEARCOAT, 2
|
||||
|
||||
// Transmission
|
||||
// ------------
|
||||
// https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_transmission
|
||||
// Base percentage of light transmitted through the surface. 0.0 = Opaque, 1.0 = Fully transparent
|
||||
#define AI_MATKEY_TRANSMISSION_FACTOR "$mat.transmission.factor", 0, 0
|
||||
// Texture defining percentage of light transmitted through the surface.
|
||||
// Multiplied by AI_MATKEY_TRANSMISSION_FACTOR
|
||||
#define AI_MATKEY_TRANSMISSION_TEXTURE aiTextureType_TRANSMISSION, 0
|
||||
|
||||
// Emissive
|
||||
// --------
|
||||
#define AI_MATKEY_USE_EMISSIVE_MAP "$mat.useEmissiveMap", 0, 0
|
||||
#define AI_MATKEY_EMISSIVE_INTENSITY "$mat.emissiveIntensity", 0, 0
|
||||
#define AI_MATKEY_USE_AO_MAP "$mat.useAOMap", 0, 0
|
||||
|
||||
@@ -50,32 +50,32 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#define AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_BASE_COLOR_FACTOR "$mat.gltf.pbrMetallicRoughness.baseColorFactor", 0, 0
|
||||
#define AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_METALLIC_FACTOR "$mat.gltf.pbrMetallicRoughness.metallicFactor", 0, 0
|
||||
#define AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_ROUGHNESS_FACTOR "$mat.gltf.pbrMetallicRoughness.roughnessFactor", 0, 0
|
||||
#define AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_BASE_COLOR_TEXTURE aiTextureType_DIFFUSE, 1
|
||||
//#define AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_BASE_COLOR_FACTOR "$mat.gltf.pbrMetallicRoughness.baseColorFactor", 0, 0
|
||||
//#define AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_METALLIC_FACTOR "$mat.gltf.pbrMetallicRoughness.metallicFactor", 0, 0
|
||||
//#define AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_ROUGHNESS_FACTOR "$mat.gltf.pbrMetallicRoughness.roughnessFactor", 0, 0
|
||||
//#define AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_BASE_COLOR_TEXTURE aiTextureType_DIFFUSE, 1
|
||||
#define AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_METALLICROUGHNESS_TEXTURE aiTextureType_UNKNOWN, 0
|
||||
#define AI_MATKEY_GLTF_ALPHAMODE "$mat.gltf.alphaMode", 0, 0
|
||||
#define AI_MATKEY_GLTF_ALPHACUTOFF "$mat.gltf.alphaCutoff", 0, 0
|
||||
#define AI_MATKEY_GLTF_PBRSPECULARGLOSSINESS "$mat.gltf.pbrSpecularGlossiness", 0, 0
|
||||
#define AI_MATKEY_GLTF_PBRSPECULARGLOSSINESS_GLOSSINESS_FACTOR "$mat.gltf.pbrMetallicRoughness.glossinessFactor", 0, 0
|
||||
#define AI_MATKEY_GLTF_UNLIT "$mat.gltf.unlit", 0, 0
|
||||
#define AI_MATKEY_GLTF_MATERIAL_SHEEN "$mat.gltf.materialSheen", 0, 0
|
||||
#define AI_MATKEY_GLTF_MATERIAL_SHEEN_COLOR_FACTOR "$mat.gltf.materialSheen.sheenColorFactor", 0, 0
|
||||
#define AI_MATKEY_GLTF_MATERIAL_SHEEN_ROUGHNESS_FACTOR "$mat.gltf.materialSheen.sheenRoughnessFactor", 0, 0
|
||||
#define AI_MATKEY_GLTF_MATERIAL_SHEEN_COLOR_TEXTURE aiTextureType_UNKNOWN, 1
|
||||
#define AI_MATKEY_GLTF_MATERIAL_SHEEN_ROUGHNESS_TEXTURE aiTextureType_UNKNOWN, 2
|
||||
#define AI_MATKEY_GLTF_MATERIAL_CLEARCOAT "$mat.gltf.materialClearcoat", 0, 0
|
||||
#define AI_MATKEY_GLTF_MATERIAL_CLEARCOAT_FACTOR "$mat.gltf.materialClearcoat.clearcoatFactor", 0, 0
|
||||
#define AI_MATKEY_GLTF_MATERIAL_CLEARCOAT_ROUGHNESS_FACTOR "$mat.gltf.materialClearcoat.clearcoatRoughnessFactor", 0, 0
|
||||
#define AI_MATKEY_GLTF_MATERIAL_CLEARCOAT_TEXTURE aiTextureType_UNKNOWN, 3
|
||||
#define AI_MATKEY_GLTF_MATERIAL_CLEARCOAT_ROUGHNESS_TEXTURE aiTextureType_UNKNOWN, 4
|
||||
#define AI_MATKEY_GLTF_MATERIAL_CLEARCOAT_NORMAL_TEXTURE aiTextureType_NORMALS, 1
|
||||
#define AI_MATKEY_GLTF_MATERIAL_TRANSMISSION "$mat.gltf.materialTransmission", 0, 0
|
||||
#define AI_MATKEY_GLTF_MATERIAL_TRANSMISSION_FACTOR "$mat.gltf.materialTransmission.transmissionFactor", 0, 0
|
||||
#define AI_MATKEY_GLTF_MATERIAL_TRANSMISSION_TEXTURE aiTextureType_UNKNOWN, 5
|
||||
//#define AI_MATKEY_GLTF_PBRSPECULARGLOSSINESS "$mat.gltf.pbrSpecularGlossiness", 0, 0
|
||||
//#define AI_MATKEY_GLTF_PBRSPECULARGLOSSINESS_GLOSSINESS_FACTOR "$mat.gltf.pbrMetallicRoughness.glossinessFactor", 0, 0
|
||||
//#define AI_MATKEY_GLTF_UNLIT "$mat.gltf.unlit", 0, 0
|
||||
//#define AI_MATKEY_GLTF_MATERIAL_SHEEN "$mat.gltf.materialSheen", 0, 0
|
||||
//#define AI_MATKEY_GLTF_MATERIAL_SHEEN_COLOR_FACTOR "$mat.gltf.materialSheen.sheenColorFactor", 0, 0
|
||||
//#define AI_MATKEY_GLTF_MATERIAL_SHEEN_ROUGHNESS_FACTOR "$mat.gltf.materialSheen.sheenRoughnessFactor", 0, 0
|
||||
//#define AI_MATKEY_GLTF_MATERIAL_SHEEN_COLOR_TEXTURE aiTextureType_UNKNOWN, 1
|
||||
//#define AI_MATKEY_GLTF_MATERIAL_SHEEN_ROUGHNESS_TEXTURE aiTextureType_UNKNOWN, 2
|
||||
//#define AI_MATKEY_GLTF_MATERIAL_CLEARCOAT "$mat.gltf.materialClearcoat", 0, 0
|
||||
//#define AI_MATKEY_GLTF_MATERIAL_CLEARCOAT_FACTOR "$mat.gltf.materialClearcoat.clearcoatFactor", 0, 0
|
||||
//#define AI_MATKEY_GLTF_MATERIAL_CLEARCOAT_ROUGHNESS_FACTOR "$mat.gltf.materialClearcoat.clearcoatRoughnessFactor", 0, 0
|
||||
//#define AI_MATKEY_GLTF_MATERIAL_CLEARCOAT_TEXTURE aiTextureType_UNKNOWN, 3
|
||||
//#define AI_MATKEY_GLTF_MATERIAL_CLEARCOAT_ROUGHNESS_TEXTURE aiTextureType_UNKNOWN, 4
|
||||
//#define AI_MATKEY_GLTF_MATERIAL_CLEARCOAT_NORMAL_TEXTURE aiTextureType_NORMALS, 1
|
||||
//#define AI_MATKEY_GLTF_MATERIAL_TRANSMISSION "$mat.gltf.materialTransmission", 0, 0
|
||||
//#define AI_MATKEY_GLTF_MATERIAL_TRANSMISSION_FACTOR "$mat.gltf.materialTransmission.transmissionFactor", 0, 0
|
||||
//#define AI_MATKEY_GLTF_MATERIAL_TRANSMISSION_TEXTURE aiTextureType_UNKNOWN, 5
|
||||
|
||||
#define _AI_MATKEY_GLTF_TEXTURE_TEXCOORD_BASE "$tex.file.texCoord"
|
||||
//#define _AI_MATKEY_GLTF_TEXTURE_TEXCOORD_BASE "$tex.file.texCoord"
|
||||
#define _AI_MATKEY_GLTF_MAPPINGNAME_BASE "$tex.mappingname"
|
||||
#define _AI_MATKEY_GLTF_MAPPINGID_BASE "$tex.mappingid"
|
||||
#define _AI_MATKEY_GLTF_MAPPINGFILTER_MAG_BASE "$tex.mappingfiltermag"
|
||||
@@ -83,7 +83,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#define _AI_MATKEY_GLTF_SCALE_BASE "$tex.scale"
|
||||
#define _AI_MATKEY_GLTF_STRENGTH_BASE "$tex.strength"
|
||||
|
||||
#define AI_MATKEY_GLTF_TEXTURE_TEXCOORD(type, N) _AI_MATKEY_GLTF_TEXTURE_TEXCOORD_BASE, type, N
|
||||
//#define AI_MATKEY_GLTF_TEXTURE_TEXCOORD(type, N) _AI_MATKEY_GLTF_TEXTURE_TEXCOORD_BASE, type, N
|
||||
#define AI_MATKEY_GLTF_MAPPINGNAME(type, N) _AI_MATKEY_GLTF_MAPPINGNAME_BASE, type, N
|
||||
#define AI_MATKEY_GLTF_MAPPINGID(type, N) _AI_MATKEY_GLTF_MAPPINGID_BASE, type, N
|
||||
#define AI_MATKEY_GLTF_MAPPINGFILTER_MAG(type, N) _AI_MATKEY_GLTF_MAPPINGFILTER_MAG_BASE, type, N
|
||||
|
||||
@@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
|
||||
|
||||
Copyright (c) 2006-2021, assimp team
|
||||
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
@@ -397,22 +395,35 @@ struct aiScene
|
||||
|
||||
//! Returns an embedded texture
|
||||
const aiTexture* GetEmbeddedTexture(const char* filename) const {
|
||||
return GetEmbeddedTextureAndIndex(filename).first;
|
||||
}
|
||||
|
||||
//! Returns an embedded texture and its index
|
||||
std::pair<const aiTexture*, int> GetEmbeddedTextureAndIndex(const char* filename) const {
|
||||
if(nullptr==filename) {
|
||||
return std::make_pair(nullptr, -1);
|
||||
}
|
||||
// lookup using texture ID (if referenced like: "*1", "*2", etc.)
|
||||
if ('*' == *filename) {
|
||||
int index = std::atoi(filename + 1);
|
||||
if (0 > index || mNumTextures <= static_cast<unsigned>(index))
|
||||
return nullptr;
|
||||
return mTextures[index];
|
||||
if (0 > index || mNumTextures <= static_cast<unsigned>(index)) {
|
||||
return std::make_pair(nullptr, -1);
|
||||
}
|
||||
return std::make_pair(mTextures[index], index);
|
||||
}
|
||||
// lookup using filename
|
||||
const char* shortFilename = GetShortFilename(filename);
|
||||
if (nullptr == shortFilename) {
|
||||
return std::make_pair(nullptr, -1);
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < mNumTextures; i++) {
|
||||
const char* shortTextureFilename = GetShortFilename(mTextures[i]->mFilename.C_Str());
|
||||
if (strcmp(shortTextureFilename, shortFilename) == 0) {
|
||||
return mTextures[i];
|
||||
return std::make_pair(mTextures[i], i);
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
return std::make_pair(nullptr, -1);
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
Reference in New Issue
Block a user