|
|
|||
File indexing completed on 2026-09-22 08:20:42
0001 /* 0002 --------------------------------------------------------------------------- 0003 Open Asset Import Library (assimp) 0004 --------------------------------------------------------------------------- 0005 0006 Copyright (c) 2006-2025, assimp team 0007 0008 All rights reserved. 0009 0010 Redistribution and use of this software in source and binary forms, 0011 with or without modification, are permitted provided that the following 0012 conditions are met: 0013 0014 * Redistributions of source code must retain the above 0015 copyright notice, this list of conditions and the 0016 following disclaimer. 0017 0018 * Redistributions in binary form must reproduce the above 0019 copyright notice, this list of conditions and the 0020 following disclaimer in the documentation and/or other 0021 materials provided with the distribution. 0022 0023 * Neither the name of the assimp team, nor the names of its 0024 contributors may be used to endorse or promote products 0025 derived from this software without specific prior 0026 written permission of the assimp team. 0027 0028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 0029 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 0030 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 0031 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 0032 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 0033 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 0034 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 0035 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 0036 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 0037 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 0038 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 0039 --------------------------------------------------------------------------- 0040 */ 0041 0042 /** @file material.h 0043 * @brief Defines the material system of the library 0044 */ 0045 #pragma once 0046 #ifndef AI_MATERIAL_H_INC 0047 #define AI_MATERIAL_H_INC 0048 0049 #ifdef __GNUC__ 0050 #pragma GCC system_header 0051 #endif 0052 0053 #include <assimp/types.h> 0054 0055 #ifdef __cplusplus 0056 extern "C" { 0057 #endif 0058 0059 // Name for default materials (2nd is used if meshes have UV coords) 0060 #define AI_DEFAULT_MATERIAL_NAME "DefaultMaterial" 0061 0062 // --------------------------------------------------------------------------- 0063 /** @brief Defines how the Nth texture of a specific type is combined with 0064 * the result of all previous layers. 0065 * 0066 * Example (left: key, right: value): <br> 0067 * @code 0068 * DiffColor0 - gray 0069 * DiffTextureOp0 - aiTextureOpMultiply 0070 * DiffTexture0 - tex1.png 0071 * DiffTextureOp0 - aiTextureOpAdd 0072 * DiffTexture1 - tex2.png 0073 * @endcode 0074 * Written as equation, the final diffuse term for a specific pixel would be: 0075 * @code 0076 * diffFinal = DiffColor0 * sampleTex(DiffTexture0,UV0) + 0077 * sampleTex(DiffTexture1,UV0) * diffContrib; 0078 * @endcode 0079 * where 'diffContrib' is the intensity of the incoming light for that pixel. 0080 */ 0081 enum aiTextureOp { 0082 /** T = T1 * T2 */ 0083 aiTextureOp_Multiply = 0x0, 0084 0085 /** T = T1 + T2 */ 0086 aiTextureOp_Add = 0x1, 0087 0088 /** T = T1 - T2 */ 0089 aiTextureOp_Subtract = 0x2, 0090 0091 /** T = T1 / T2 */ 0092 aiTextureOp_Divide = 0x3, 0093 0094 /** T = (T1 + T2) - (T1 * T2) */ 0095 aiTextureOp_SmoothAdd = 0x4, 0096 0097 /** T = T1 + (T2-0.5) */ 0098 aiTextureOp_SignedAdd = 0x5, 0099 0100 #ifndef SWIG 0101 _aiTextureOp_Force32Bit = INT_MAX 0102 #endif 0103 }; 0104 0105 // --------------------------------------------------------------------------- 0106 /** @brief Defines how UV coordinates outside the [0...1] range are handled. 0107 * 0108 * Commonly referred to as 'wrapping mode'. 0109 */ 0110 enum aiTextureMapMode { 0111 /** A texture coordinate u|v is translated to u%1|v%1 0112 */ 0113 aiTextureMapMode_Wrap = 0x0, 0114 0115 /** Texture coordinates outside [0...1] 0116 * are clamped to the nearest valid value. 0117 */ 0118 aiTextureMapMode_Clamp = 0x1, 0119 0120 /** If the texture coordinates for a pixel are outside [0...1] 0121 * the texture is not applied to that pixel 0122 */ 0123 aiTextureMapMode_Decal = 0x3, 0124 0125 /** A texture coordinate u|v becomes u%1|v%1 if (u-(u%1))%2 is zero and 0126 * 1-(u%1)|1-(v%1) otherwise 0127 */ 0128 aiTextureMapMode_Mirror = 0x2, 0129 0130 #ifndef SWIG 0131 _aiTextureMapMode_Force32Bit = INT_MAX 0132 #endif 0133 }; 0134 0135 // --------------------------------------------------------------------------- 0136 /** @brief Defines how the mapping coords for a texture are generated. 0137 * 0138 * Real-time applications typically require full UV coordinates, so the use of 0139 * the aiProcess_GenUVCoords step is highly recommended. It generates proper 0140 * UV channels for non-UV mapped objects, as long as an accurate description 0141 * how the mapping should look like (e.g spherical) is given. 0142 * See the #AI_MATKEY_MAPPING property for more details. 0143 */ 0144 enum aiTextureMapping { 0145 /** The mapping coordinates are taken from an UV channel. 0146 * 0147 * #AI_MATKEY_UVWSRC property specifies from which UV channel 0148 * the texture coordinates are to be taken from (remember, 0149 * meshes can have more than one UV channel). 0150 */ 0151 aiTextureMapping_UV = 0x0, 0152 0153 /** Spherical mapping */ 0154 aiTextureMapping_SPHERE = 0x1, 0155 0156 /** Cylindrical mapping */ 0157 aiTextureMapping_CYLINDER = 0x2, 0158 0159 /** Cubic mapping */ 0160 aiTextureMapping_BOX = 0x3, 0161 0162 /** Planar mapping */ 0163 aiTextureMapping_PLANE = 0x4, 0164 0165 /** Undefined mapping. Have fun. */ 0166 aiTextureMapping_OTHER = 0x5, 0167 0168 #ifndef SWIG 0169 _aiTextureMapping_Force32Bit = INT_MAX 0170 #endif 0171 }; 0172 0173 // --------------------------------------------------------------------------- 0174 /** @brief Defines the purpose of a texture 0175 * 0176 * This is a very difficult topic. Different 3D packages support different 0177 * kinds of textures. For very common texture types, such as bumpmaps, the 0178 * rendering results depend on implementation details in the rendering 0179 * pipelines of these applications. Assimp loads all texture references from 0180 * the model file and tries to determine which of the predefined texture 0181 * types below is the best choice to match the original use of the texture 0182 * as closely as possible.<br> 0183 * 0184 * In content pipelines you'll usually define how textures have to be handled, 0185 * and the artists working on models have to conform to this specification, 0186 * regardless which 3D tool they're using. 0187 */ 0188 enum aiTextureType { 0189 /** Dummy value. 0190 * 0191 * No texture, but the value to be used as 'texture semantic' 0192 * (#aiMaterialProperty::mSemantic) for all material properties 0193 * *not* related to textures. 0194 */ 0195 aiTextureType_NONE = 0, 0196 0197 /** LEGACY API MATERIALS 0198 * Legacy refers to materials which 0199 * Were originally implemented in the specifications around 2000. 0200 * These must never be removed, as most engines support them. 0201 */ 0202 0203 /** The texture is combined with the result of the diffuse 0204 * lighting equation. 0205 * OR 0206 * PBR Specular/Glossiness 0207 */ 0208 aiTextureType_DIFFUSE = 1, 0209 0210 /** The texture is combined with the result of the specular 0211 * lighting equation. 0212 * OR 0213 * PBR Specular/Glossiness 0214 */ 0215 aiTextureType_SPECULAR = 2, 0216 0217 /** The texture is combined with the result of the ambient 0218 * lighting equation. 0219 */ 0220 aiTextureType_AMBIENT = 3, 0221 0222 /** The texture is added to the result of the lighting 0223 * calculation. It isn't influenced by incoming light. 0224 */ 0225 aiTextureType_EMISSIVE = 4, 0226 0227 /** The texture is a height map. 0228 * 0229 * By convention, higher gray-scale values stand for 0230 * higher elevations from the base height. 0231 */ 0232 aiTextureType_HEIGHT = 5, 0233 0234 /** The texture is a (tangent space) normal-map. 0235 * 0236 * Again, there are several conventions for tangent-space 0237 * normal maps. Assimp does (intentionally) not 0238 * distinguish here. 0239 */ 0240 aiTextureType_NORMALS = 6, 0241 0242 /** The texture defines the glossiness of the material. 0243 * 0244 * The glossiness is in fact the exponent of the specular 0245 * (phong) lighting equation. Usually there is a conversion 0246 * function defined to map the linear color values in the 0247 * texture to a suitable exponent. Have fun. 0248 */ 0249 aiTextureType_SHININESS = 7, 0250 0251 /** The texture defines per-pixel opacity. 0252 * 0253 * Usually 'white' means opaque and 'black' means 0254 * 'transparency'. Or quite the opposite. Have fun. 0255 */ 0256 aiTextureType_OPACITY = 8, 0257 0258 /** Displacement texture 0259 * 0260 * The exact purpose and format is application-dependent. 0261 * Higher color values stand for higher vertex displacements. 0262 */ 0263 aiTextureType_DISPLACEMENT = 9, 0264 0265 /** Lightmap texture (aka Ambient Occlusion) 0266 * 0267 * Both 'Lightmaps' and dedicated 'ambient occlusion maps' are 0268 * covered by this material property. The texture contains a 0269 * scaling value for the final color value of a pixel. Its 0270 * intensity is not affected by incoming light. 0271 */ 0272 aiTextureType_LIGHTMAP = 10, 0273 0274 /** Reflection texture 0275 * 0276 * Contains the color of a perfect mirror reflection. 0277 * Rarely used, almost never for real-time applications. 0278 */ 0279 aiTextureType_REFLECTION = 11, 0280 0281 /** PBR Materials 0282 * PBR definitions from maya and other modelling packages now use this standard. 0283 * This was originally introduced around 2012. 0284 * Support for this is in game engines like Godot, Unreal or Unity3D. 0285 * Modelling packages which use this are very common now. 0286 */ 0287 0288 aiTextureType_BASE_COLOR = 12, 0289 aiTextureType_NORMAL_CAMERA = 13, 0290 aiTextureType_EMISSION_COLOR = 14, 0291 aiTextureType_METALNESS = 15, 0292 aiTextureType_DIFFUSE_ROUGHNESS = 16, 0293 aiTextureType_AMBIENT_OCCLUSION = 17, 0294 0295 /** Unknown texture 0296 * 0297 * A texture reference that does not match any of the definitions 0298 * above is considered to be 'unknown'. It is still imported, 0299 * but is excluded from any further post-processing. 0300 */ 0301 aiTextureType_UNKNOWN = 18, 0302 0303 /** PBR Material Modifiers 0304 * Some modern renderers have further PBR modifiers that may be overlaid 0305 * on top of the 'base' PBR materials for additional realism. 0306 * These use multiple texture maps, so only the base type is directly defined 0307 */ 0308 0309 /** Sheen 0310 * Generally used to simulate textiles that are covered in a layer of microfibers 0311 * eg velvet 0312 * https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_sheen 0313 */ 0314 aiTextureType_SHEEN = 19, 0315 0316 /** Clearcoat 0317 * Simulates a layer of 'polish' or 'lacquer' layered on top of a PBR substrate 0318 * https://autodesk.github.io/standard-surface/#closures/coating 0319 * https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_clearcoat 0320 */ 0321 aiTextureType_CLEARCOAT = 20, 0322 0323 /** Transmission 0324 * Simulates transmission through the surface 0325 * May include further information such as wall thickness 0326 */ 0327 aiTextureType_TRANSMISSION = 21, 0328 0329 /** 0330 * Maya material declarations 0331 */ 0332 aiTextureType_MAYA_BASE = 22, 0333 aiTextureType_MAYA_SPECULAR = 23, 0334 aiTextureType_MAYA_SPECULAR_COLOR = 24, 0335 aiTextureType_MAYA_SPECULAR_ROUGHNESS = 25, 0336 0337 /** Anisotropy 0338 * Simulates a surface with directional properties 0339 */ 0340 aiTextureType_ANISOTROPY = 26, 0341 0342 /** 0343 * gltf material declarations 0344 * Refs: https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#metallic-roughness-material 0345 * "textures for metalness and roughness properties are packed together in a single 0346 * texture called metallicRoughnessTexture. Its green channel contains roughness 0347 * values and its blue channel contains metalness values..." 0348 * https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#_material_pbrmetallicroughness_metallicroughnesstexture 0349 * "The metalness values are sampled from the B channel. The roughness values are 0350 * sampled from the G channel..." 0351 */ 0352 aiTextureType_GLTF_METALLIC_ROUGHNESS = 27, 0353 0354 #ifndef SWIG 0355 _aiTextureType_Force32Bit = INT_MAX 0356 #endif 0357 }; 0358 0359 #define AI_TEXTURE_TYPE_MAX aiTextureType_GLTF_METALLIC_ROUGHNESS 0360 0361 // ------------------------------------------------------------------------------- 0362 /** 0363 * @brief Get a string for a given aiTextureType 0364 * 0365 * @param in The texture type 0366 * @return The description string for the texture type. 0367 */ 0368 ASSIMP_API const char *aiTextureTypeToString(enum aiTextureType in); 0369 0370 // --------------------------------------------------------------------------- 0371 /** @brief Defines all shading models supported by the library 0372 * 0373 * Property: #AI_MATKEY_SHADING_MODEL 0374 * 0375 * The list of shading modes has been taken from Blender. 0376 * See Blender documentation for more information. The API does 0377 * not distinguish between "specular" and "diffuse" shaders (thus the 0378 * specular term for diffuse shading models like Oren-Nayar remains 0379 * undefined). <br> 0380 * Again, this value is just a hint. Assimp tries to select the shader whose 0381 * most common implementation matches the original rendering results of the 0382 * 3D modeler which wrote a particular model as closely as possible. 0383 * 0384 */ 0385 enum aiShadingMode { 0386 /** Flat shading. Shading is done on per-face base, 0387 * diffuse only. Also known as 'faceted shading'. 0388 */ 0389 aiShadingMode_Flat = 0x1, 0390 0391 /** Simple Gouraud shading. 0392 */ 0393 aiShadingMode_Gouraud = 0x2, 0394 0395 /** Phong-Shading - 0396 */ 0397 aiShadingMode_Phong = 0x3, 0398 0399 /** Phong-Blinn-Shading 0400 */ 0401 aiShadingMode_Blinn = 0x4, 0402 0403 /** Toon-Shading per pixel 0404 * 0405 * Also known as 'comic' shader. 0406 */ 0407 aiShadingMode_Toon = 0x5, 0408 0409 /** OrenNayar-Shading per pixel 0410 * 0411 * Extension to standard Lambertian shading, taking the 0412 * roughness of the material into account 0413 */ 0414 aiShadingMode_OrenNayar = 0x6, 0415 0416 /** Minnaert-Shading per pixel 0417 * 0418 * Extension to standard Lambertian shading, taking the 0419 * "darkness" of the material into account 0420 */ 0421 aiShadingMode_Minnaert = 0x7, 0422 0423 /** CookTorrance-Shading per pixel 0424 * 0425 * Special shader for metallic surfaces. 0426 */ 0427 aiShadingMode_CookTorrance = 0x8, 0428 0429 /** No shading at all. Constant light influence of 1.0. 0430 * Also known as "Unlit" 0431 */ 0432 aiShadingMode_NoShading = 0x9, 0433 aiShadingMode_Unlit = aiShadingMode_NoShading, // Alias 0434 0435 /** Fresnel shading 0436 */ 0437 aiShadingMode_Fresnel = 0xa, 0438 0439 /** Physically-Based Rendering (PBR) shading using 0440 * Bidirectional scattering/reflectance distribution function (BSDF/BRDF) 0441 * There are multiple methods under this banner, and model files may provide 0442 * data for more than one PBR-BRDF method. 0443 * Applications should use the set of provided properties to determine which 0444 * of their preferred PBR rendering methods are likely to be available 0445 * eg: 0446 * - If AI_MATKEY_METALLIC_FACTOR is set, then a Metallic/Roughness is available 0447 * - If AI_MATKEY_GLOSSINESS_FACTOR is set, then a Specular/Glossiness is available 0448 * Note that some PBR methods allow layering of techniques 0449 */ 0450 aiShadingMode_PBR_BRDF = 0xb, 0451 0452 #ifndef SWIG 0453 _aiShadingMode_Force32Bit = INT_MAX 0454 #endif 0455 }; 0456 0457 // --------------------------------------------------------------------------- 0458 /** 0459 * @brief Defines some mixed flags for a particular texture. 0460 * 0461 * Usually you'll instruct your cg artists how textures have to look like ... 0462 * and how they will be processed in your application. However, if you use 0463 * Assimp for completely generic loading purposes you might also need to 0464 * process these flags in order to display as many 'unknown' 3D models as 0465 * possible correctly. 0466 * 0467 * This corresponds to the #AI_MATKEY_TEXFLAGS property. 0468 */ 0469 enum aiTextureFlags { 0470 /** The texture's color values have to be inverted (component-wise 1-n) 0471 */ 0472 aiTextureFlags_Invert = 0x1, 0473 0474 /** Explicit request to the application to process the alpha channel 0475 * of the texture. 0476 * 0477 * Mutually exclusive with #aiTextureFlags_IgnoreAlpha. These 0478 * flags are set if the library can say for sure that the alpha 0479 * channel is used/is not used. If the model format does not 0480 * define this, it is left to the application to decide whether 0481 * the texture alpha channel - if any - is evaluated or not. 0482 */ 0483 aiTextureFlags_UseAlpha = 0x2, 0484 0485 /** Explicit request to the application to ignore the alpha channel 0486 * of the texture. 0487 * 0488 * Mutually exclusive with #aiTextureFlags_UseAlpha. 0489 */ 0490 aiTextureFlags_IgnoreAlpha = 0x4, 0491 0492 #ifndef SWIG 0493 _aiTextureFlags_Force32Bit = INT_MAX 0494 #endif 0495 }; 0496 0497 // --------------------------------------------------------------------------- 0498 /** 0499 * @brief Defines alpha-blend flags. 0500 * 0501 * If you're familiar with OpenGL or D3D, these flags aren't new to you. 0502 * They define *how* the final color value of a pixel is computed, basing 0503 * on the previous color at that pixel and the new color value from the 0504 * material. 0505 * The blend formula is: 0506 * @code 0507 * SourceColor * SourceBlend + DestColor * DestBlend 0508 * @endcode 0509 * where DestColor is the previous color in the frame-buffer at this 0510 * position and SourceColor is the material color before the transparency 0511 * calculation.<br> 0512 * This corresponds to the #AI_MATKEY_BLEND_FUNC property. 0513 */ 0514 enum aiBlendMode { 0515 /** 0516 * Formula: 0517 * @code 0518 * SourceColor*SourceAlpha + DestColor*(1-SourceAlpha) 0519 * @endcode 0520 */ 0521 aiBlendMode_Default = 0x0, 0522 0523 /** Additive blending 0524 * 0525 * Formula: 0526 * @code 0527 * SourceColor*1 + DestColor*1 0528 * @endcode 0529 */ 0530 aiBlendMode_Additive = 0x1, 0531 0532 // we don't need more for the moment, but we might need them 0533 // in future versions ... 0534 0535 #ifndef SWIG 0536 _aiBlendMode_Force32Bit = INT_MAX 0537 #endif 0538 }; 0539 0540 #include "./Compiler/pushpack1.h" 0541 0542 // --------------------------------------------------------------------------- 0543 /** 0544 * @brief Defines how an UV channel is transformed. 0545 * 0546 * This is just a helper structure for the #AI_MATKEY_UVTRANSFORM key. 0547 * See its documentation for more details. 0548 * 0549 * Typically you'll want to build a matrix of this information. However, 0550 * we keep separate scaling/translation/rotation values to make it 0551 * easier to process and optimize UV transformations internally. 0552 */ 0553 struct aiUVTransform { 0554 /** Translation on the u and v axes. 0555 * 0556 * The default value is (0|0). 0557 */ 0558 C_STRUCT aiVector2D mTranslation; 0559 0560 /** Scaling on the u and v axes. 0561 * 0562 * The default value is (1|1). 0563 */ 0564 C_STRUCT aiVector2D mScaling; 0565 0566 /** Rotation - in counter-clockwise direction. 0567 * 0568 * The rotation angle is specified in radians. The 0569 * rotation center is 0.5f|0.5f. The default value 0570 * 0.f. 0571 */ 0572 ai_real mRotation; 0573 0574 #ifdef __cplusplus 0575 aiUVTransform() AI_NO_EXCEPT 0576 : mTranslation(0.0, 0.0), 0577 mScaling(1.0, 1.0), 0578 mRotation(0.0) { 0579 // nothing to be done here ... 0580 } 0581 #endif 0582 }; 0583 0584 #include "./Compiler/poppack1.h" 0585 0586 //! @cond AI_DOX_INCLUDE_INTERNAL 0587 // --------------------------------------------------------------------------- 0588 /** 0589 * @brief A very primitive RTTI system for the contents of material properties. 0590 */ 0591 enum aiPropertyTypeInfo { 0592 /** Array of single-precision (32 Bit) floats 0593 * 0594 * It is possible to use aiGetMaterialInteger[Array]() (or the C++-API 0595 * aiMaterial::Get()) to query properties stored in floating-point format. 0596 * The material system performs the type conversion automatically. 0597 */ 0598 aiPTI_Float = 0x1, 0599 0600 /** Array of double-precision (64 Bit) floats 0601 * 0602 * It is possible to use aiGetMaterialInteger[Array]() (or the C++-API 0603 * aiMaterial::Get()) to query properties stored in floating-point format. 0604 * The material system performs the type conversion automatically. 0605 */ 0606 aiPTI_Double = 0x2, 0607 0608 /** The material property is an aiString. 0609 * 0610 * Arrays of strings aren't possible, aiGetMaterialString() (or the 0611 * C++-API aiMaterial::Get()) *must* be used to query a string property. 0612 */ 0613 aiPTI_String = 0x3, 0614 0615 /** Array of (32 Bit) integers 0616 * 0617 * It is possible to use aiGetMaterialFloat[Array]() (or the C++-API 0618 * aiMaterial::Get()) to query properties stored in integer format. 0619 * The material system performs the type conversion automatically. 0620 */ 0621 aiPTI_Integer = 0x4, 0622 0623 /** Simple binary buffer, content undefined. Not convertible to anything. 0624 */ 0625 aiPTI_Buffer = 0x5, 0626 0627 /** This value is not used. It is just there to force the 0628 * compiler to map this enum to a 32 Bit integer. 0629 */ 0630 #ifndef SWIG 0631 _aiPTI_Force32Bit = INT_MAX 0632 #endif 0633 }; 0634 0635 // --------------------------------------------------------------------------- 0636 /** @brief Data structure for a single material property 0637 * 0638 * As an user, you'll probably never need to deal with this data structure. 0639 * Just use the provided aiGetMaterialXXX() or aiMaterial::Get() family 0640 * of functions to query material properties easily. Processing them 0641 * manually is faster, but it is not the recommended way. It isn't worth 0642 * the effort. <br> 0643 * Material property names follow a simple scheme: 0644 * @code 0645 * $<name> 0646 * ?<name> 0647 * A public property, there must be corresponding AI_MATKEY_XXX define 0648 * 2nd: Public, but ignored by the #aiProcess_RemoveRedundantMaterials 0649 * post-processing step. 0650 * ~<name> 0651 * A temporary property for internal use. 0652 * @endcode 0653 * @see aiMaterial 0654 */ 0655 struct aiMaterialProperty { 0656 /** Specifies the name of the property (key) 0657 * Keys are generally case insensitive. 0658 */ 0659 C_STRUCT aiString mKey; 0660 0661 /** Textures: Specifies their exact usage semantic. 0662 * For non-texture properties, this member is always 0 0663 * (or, better-said, #aiTextureType_NONE). 0664 */ 0665 unsigned int mSemantic; 0666 0667 /** Textures: Specifies the index of the texture. 0668 * For non-texture properties, this member is always 0. 0669 */ 0670 unsigned int mIndex; 0671 0672 /** Size of the buffer mData is pointing to, in bytes. 0673 * This value may not be 0. 0674 */ 0675 unsigned int mDataLength; 0676 0677 /** Type information for the property. 0678 * 0679 * Defines the data layout inside the data buffer. This is used 0680 * by the library internally to perform debug checks and to 0681 * utilize proper type conversions. 0682 * (It's probably a hacky solution, but it works.) 0683 */ 0684 C_ENUM aiPropertyTypeInfo mType; 0685 0686 /** Binary buffer to hold the property's value. 0687 * The size of the buffer is always mDataLength. 0688 */ 0689 char *mData; 0690 0691 #ifdef __cplusplus 0692 0693 aiMaterialProperty() AI_NO_EXCEPT 0694 : mSemantic(0), 0695 mIndex(0), 0696 mDataLength(0), 0697 mType(aiPTI_Float), 0698 mData(nullptr) { 0699 // empty 0700 } 0701 0702 ~aiMaterialProperty() { 0703 delete[] mData; 0704 mData = nullptr; 0705 } 0706 0707 #endif 0708 }; 0709 //! @endcond 0710 0711 #ifdef __cplusplus 0712 } // We need to leave the "C" block here to allow template member functions 0713 #endif 0714 0715 // --------------------------------------------------------------------------- 0716 /** @brief Data structure for a material 0717 * 0718 * Material data is stored using a key-value structure. A single key-value 0719 * pair is called a 'material property'. C++ users should use the provided 0720 * member functions of aiMaterial to process material properties, C users 0721 * have to stick with the aiGetMaterialXXX family of unbound functions. 0722 * The library defines a set of standard keys (AI_MATKEY_XXX). 0723 */ 0724 #ifdef __cplusplus 0725 struct ASSIMP_API aiMaterial 0726 #else 0727 struct aiMaterial 0728 #endif 0729 { 0730 0731 #ifdef __cplusplus 0732 0733 public: 0734 /** 0735 * @brief The class constructor. 0736 */ 0737 aiMaterial(); 0738 0739 /** 0740 * @brief The class destructor. 0741 */ 0742 ~aiMaterial(); 0743 0744 // ------------------------------------------------------------------- 0745 /** 0746 * @brief Returns the name of the material. 0747 * @return The name of the material. 0748 */ 0749 // ------------------------------------------------------------------- 0750 aiString GetName() const; 0751 0752 // ------------------------------------------------------------------- 0753 /** @brief Retrieve an array of Type values with a specific key 0754 * from the material 0755 * 0756 * @param pKey Key to search for. One of the AI_MATKEY_XXX constants. 0757 * @param type .. set by AI_MATKEY_XXX 0758 * @param idx .. set by AI_MATKEY_XXX 0759 * @param pOut Pointer to a buffer to receive the result. 0760 * @param pMax Specifies the size of the given buffer, in Type's. 0761 * Receives the number of values (not bytes!) read. 0762 * NULL is a valid value for this parameter. 0763 */ 0764 template <typename Type> 0765 aiReturn Get(const char *pKey, unsigned int type, 0766 unsigned int idx, Type *pOut, unsigned int *pMax) const; 0767 0768 aiReturn Get(const char *pKey, unsigned int type, 0769 unsigned int idx, int *pOut, unsigned int *pMax) const; 0770 0771 aiReturn Get(const char *pKey, unsigned int type, 0772 unsigned int idx, ai_real *pOut, unsigned int *pMax) const; 0773 0774 // ------------------------------------------------------------------- 0775 /** @brief Retrieve a Type value with a specific key 0776 * from the material 0777 * 0778 * @param pKey Key to search for. One of the AI_MATKEY_XXX constants. 0779 * @param type Specifies the type of the texture to be retrieved ( 0780 * e.g. diffuse, specular, height map ...) 0781 * @param idx Index of the texture to be retrieved. 0782 * @param pOut Reference to receive the output value 0783 */ 0784 template <typename Type> 0785 aiReturn Get(const char *pKey, unsigned int type, 0786 unsigned int idx, Type &pOut) const; 0787 0788 aiReturn Get(const char *pKey, unsigned int type, 0789 unsigned int idx, int &pOut) const; 0790 0791 aiReturn Get(const char *pKey, unsigned int type, 0792 unsigned int idx, ai_real &pOut) const; 0793 0794 aiReturn Get(const char *pKey, unsigned int type, 0795 unsigned int idx, aiString &pOut) const; 0796 0797 aiReturn Get(const char *pKey, unsigned int type, 0798 unsigned int idx, aiColor3D &pOut) const; 0799 0800 aiReturn Get(const char *pKey, unsigned int type, 0801 unsigned int idx, aiColor4D &pOut) const; 0802 0803 aiReturn Get(const char *pKey, unsigned int type, 0804 unsigned int idx, aiUVTransform &pOut) const; 0805 0806 // ------------------------------------------------------------------- 0807 /** Get the number of textures for a particular texture type. 0808 * @param type Texture type to check for 0809 * @return Number of textures for this type. 0810 * @note A texture can be easily queried using #GetTexture() */ 0811 unsigned int GetTextureCount(aiTextureType type) const; 0812 0813 // ------------------------------------------------------------------- 0814 /** Helper function to get all parameters pertaining to a 0815 * particular texture slot from a material. 0816 * 0817 * This function is provided just for convenience, you could also 0818 * read the single material properties manually. 0819 * @param type Specifies the type of the texture to be retrieved ( 0820 * e.g. diffuse, specular, height map ...) 0821 * @param index Index of the texture to be retrieved. The function fails 0822 * if there is no texture of that type with this index. 0823 * #GetTextureCount() can be used to determine the number of textures 0824 * per texture type. 0825 * @param path Receives the path to the texture. 0826 * Use aiScene::GetEmbeddedTexture() method to determine if returned path 0827 * is an image file to be opened or a string key of embedded texture stored in the corresponding scene 0828 * (could be a '*' followed by the id of the texture in case of no name) 0829 * NULL is a valid value. 0830 * @param mapping The texture mapping. 0831 * NULL is allowed as value. 0832 * @param uvindex Receives the UV index of the texture. 0833 * NULL is a valid value. 0834 * @param blend Receives the blend factor for the texture 0835 * NULL is a valid value. 0836 * @param op Receives the texture operation to be performed between 0837 * this texture and the previous texture. NULL is allowed as value. 0838 * @param mapmode Receives the mapping modes to be used for the texture. 0839 * The parameter may be NULL but if it is a valid pointer it MUST 0840 * point to an array of 3 aiTextureMapMode's (one for each 0841 * axis: UVW order (=XYZ)). 0842 */ 0843 // ------------------------------------------------------------------- 0844 aiReturn GetTexture(aiTextureType type, 0845 unsigned int index, 0846 C_STRUCT aiString *path, 0847 aiTextureMapping *mapping = NULL, 0848 unsigned int *uvindex = NULL, 0849 ai_real *blend = NULL, 0850 aiTextureOp *op = NULL, 0851 aiTextureMapMode *mapmode = NULL) const; 0852 0853 // Setters 0854 0855 // ------------------------------------------------------------------------------ 0856 /** @brief Add a property with a given key and type info to the material 0857 * structure 0858 * 0859 * @param pInput Pointer to input data 0860 * @param pSizeInBytes Size of input data 0861 * @param pKey Key/Usage of the property (AI_MATKEY_XXX) 0862 * @param type Set by the AI_MATKEY_XXX macro 0863 * @param index Set by the AI_MATKEY_XXX macro 0864 * @param pType Type information hint */ 0865 aiReturn AddBinaryProperty(const void *pInput, 0866 unsigned int pSizeInBytes, 0867 const char *pKey, 0868 unsigned int type, 0869 unsigned int index, 0870 aiPropertyTypeInfo pType); 0871 0872 // ------------------------------------------------------------------------------ 0873 /** @brief Add a string property with a given key and type info to the 0874 * material structure 0875 * 0876 * @param pInput Input string 0877 * @param pKey Key/Usage of the property (AI_MATKEY_XXX) 0878 * @param type Set by the AI_MATKEY_XXX macro 0879 * @param index Set by the AI_MATKEY_XXX macro */ 0880 aiReturn AddProperty(const aiString *pInput, 0881 const char *pKey, 0882 unsigned int type = 0, 0883 unsigned int index = 0); 0884 0885 // ------------------------------------------------------------------------------ 0886 /** @brief Add a property with a given key to the material structure 0887 * @param pInput Pointer to the input data 0888 * @param pNumValues Number of values in the array 0889 * @param pKey Key/Usage of the property (AI_MATKEY_XXX) 0890 * @param type Set by the AI_MATKEY_XXX macro 0891 * @param index Set by the AI_MATKEY_XXX macro */ 0892 template <class TYPE> 0893 aiReturn AddProperty(const TYPE *pInput, 0894 unsigned int pNumValues, 0895 const char *pKey, 0896 unsigned int type = 0, 0897 unsigned int index = 0); 0898 0899 aiReturn AddProperty(const aiVector3D *pInput, 0900 unsigned int pNumValues, 0901 const char *pKey, 0902 unsigned int type = 0, 0903 unsigned int index = 0); 0904 0905 aiReturn AddProperty(const aiColor3D *pInput, 0906 unsigned int pNumValues, 0907 const char *pKey, 0908 unsigned int type = 0, 0909 unsigned int index = 0); 0910 0911 aiReturn AddProperty(const aiColor4D *pInput, 0912 unsigned int pNumValues, 0913 const char *pKey, 0914 unsigned int type = 0, 0915 unsigned int index = 0); 0916 0917 aiReturn AddProperty(const int *pInput, 0918 unsigned int pNumValues, 0919 const char *pKey, 0920 unsigned int type = 0, 0921 unsigned int index = 0); 0922 0923 aiReturn AddProperty(const float *pInput, 0924 unsigned int pNumValues, 0925 const char *pKey, 0926 unsigned int type = 0, 0927 unsigned int index = 0); 0928 0929 aiReturn AddProperty(const double *pInput, 0930 unsigned int pNumValues, 0931 const char *pKey, 0932 unsigned int type = 0, 0933 unsigned int index = 0); 0934 0935 aiReturn AddProperty(const aiUVTransform *pInput, 0936 unsigned int pNumValues, 0937 const char *pKey, 0938 unsigned int type = 0, 0939 unsigned int index = 0); 0940 0941 // ------------------------------------------------------------------------------ 0942 /** @brief Remove a given key from the list. 0943 * 0944 * The function fails if the key isn't found 0945 * @param pKey Key to be deleted 0946 * @param type Set by the AI_MATKEY_XXX macro 0947 * @param index Set by the AI_MATKEY_XXX macro */ 0948 aiReturn RemoveProperty(const char *pKey, 0949 unsigned int type = 0, 0950 unsigned int index = 0); 0951 0952 // ------------------------------------------------------------------------------ 0953 /** @brief Removes all properties from the material. 0954 * 0955 * The data array remains allocated so adding new properties is quite fast. */ 0956 void Clear(); 0957 0958 // ------------------------------------------------------------------------------ 0959 /** Copy the property list of a material 0960 * @param pcDest Destination material 0961 * @param pcSrc Source material 0962 */ 0963 static void CopyPropertyList(aiMaterial *pcDest, 0964 const aiMaterial *pcSrc); 0965 0966 #endif 0967 0968 /** List of all material properties loaded. */ 0969 C_STRUCT aiMaterialProperty **mProperties; 0970 0971 /** Number of properties in the data base */ 0972 unsigned int mNumProperties; 0973 0974 /** Storage allocated */ 0975 unsigned int mNumAllocated; 0976 }; 0977 0978 // Go back to extern "C" again 0979 #ifdef __cplusplus 0980 extern "C" { 0981 #endif 0982 0983 // --------------------------------------------------------------------------- 0984 #define AI_MATKEY_NAME "?mat.name", 0, 0 0985 #define AI_MATKEY_TWOSIDED "$mat.twosided", 0, 0 0986 #define AI_MATKEY_SHADING_MODEL "$mat.shadingm", 0, 0 0987 #define AI_MATKEY_ENABLE_WIREFRAME "$mat.wireframe", 0, 0 0988 #define AI_MATKEY_BLEND_FUNC "$mat.blend", 0, 0 0989 #define AI_MATKEY_OPACITY "$mat.opacity", 0, 0 0990 #define AI_MATKEY_TRANSPARENCYFACTOR "$mat.transparencyfactor", 0, 0 0991 #define AI_MATKEY_BUMPSCALING "$mat.bumpscaling", 0, 0 0992 #define AI_MATKEY_SHININESS "$mat.shininess", 0, 0 0993 #define AI_MATKEY_REFLECTIVITY "$mat.reflectivity", 0, 0 0994 #define AI_MATKEY_SHININESS_STRENGTH "$mat.shinpercent", 0, 0 0995 #define AI_MATKEY_REFRACTI "$mat.refracti", 0, 0 0996 #define AI_MATKEY_COLOR_DIFFUSE "$clr.diffuse", 0, 0 0997 #define AI_MATKEY_COLOR_AMBIENT "$clr.ambient", 0, 0 0998 #define AI_MATKEY_COLOR_SPECULAR "$clr.specular", 0, 0 0999 #define AI_MATKEY_COLOR_EMISSIVE "$clr.emissive", 0, 0 1000 #define AI_MATKEY_COLOR_TRANSPARENT "$clr.transparent", 0, 0 1001 #define AI_MATKEY_COLOR_REFLECTIVE "$clr.reflective", 0, 0 1002 #define AI_MATKEY_GLOBAL_BACKGROUND_IMAGE "?bg.global", 0, 0 1003 #define AI_MATKEY_GLOBAL_SHADERLANG "?sh.lang", 0, 0 1004 #define AI_MATKEY_SHADER_VERTEX "?sh.vs", 0, 0 1005 #define AI_MATKEY_SHADER_FRAGMENT "?sh.fs", 0, 0 1006 #define AI_MATKEY_SHADER_GEO "?sh.gs", 0, 0 1007 #define AI_MATKEY_SHADER_TESSELATION "?sh.ts", 0, 0 1008 #define AI_MATKEY_SHADER_PRIMITIVE "?sh.ps", 0, 0 1009 #define AI_MATKEY_SHADER_COMPUTE "?sh.cs", 0, 0 1010 1011 // --------------------------------------------------------------------------- 1012 // PBR material support 1013 // -------------------- 1014 // Properties defining PBR rendering techniques 1015 #define AI_MATKEY_USE_COLOR_MAP "$mat.useColorMap", 0, 0 1016 1017 // Metallic/Roughness Workflow 1018 // --------------------------- 1019 // Base RGBA color factor. Will be multiplied by final base color texture values if extant 1020 // Note: Importers may choose to copy this into AI_MATKEY_COLOR_DIFFUSE for compatibility 1021 // with renderers and formats that do not support Metallic/Roughness PBR 1022 #define AI_MATKEY_BASE_COLOR "$clr.base", 0, 0 1023 #define AI_MATKEY_BASE_COLOR_TEXTURE aiTextureType_BASE_COLOR, 0 1024 #define AI_MATKEY_USE_METALLIC_MAP "$mat.useMetallicMap", 0, 0 1025 // Metallic factor. 0.0 = Full Dielectric, 1.0 = Full Metal 1026 #define AI_MATKEY_METALLIC_FACTOR "$mat.metallicFactor", 0, 0 1027 #define AI_MATKEY_METALLIC_TEXTURE aiTextureType_METALNESS, 0 1028 #define AI_MATKEY_USE_ROUGHNESS_MAP "$mat.useRoughnessMap", 0, 0 1029 // Roughness factor. 0.0 = Perfectly Smooth, 1.0 = Completely Rough 1030 #define AI_MATKEY_ROUGHNESS_FACTOR "$mat.roughnessFactor", 0, 0 1031 #define AI_MATKEY_ROUGHNESS_TEXTURE aiTextureType_DIFFUSE_ROUGHNESS, 0 1032 // Anisotropy factor. 0.0 = isotropic, 1.0 = anisotropy along tangent direction, 1033 // -1.0 = anisotropy along bitangent direction 1034 #define AI_MATKEY_ANISOTROPY_FACTOR "$mat.anisotropyFactor", 0, 0 1035 1036 // Specular/Glossiness Workflow 1037 // --------------------------- 1038 // Diffuse/Albedo Color. Note: Pure Metals have a diffuse of {0,0,0} 1039 // AI_MATKEY_COLOR_DIFFUSE 1040 // Specular Color. 1041 // Note: Metallic/Roughness may also have a Specular Color 1042 // AI_MATKEY_COLOR_SPECULAR 1043 #define AI_MATKEY_SPECULAR_FACTOR "$mat.specularFactor", 0, 0 1044 // Glossiness factor. 0.0 = Completely Rough, 1.0 = Perfectly Smooth 1045 #define AI_MATKEY_GLOSSINESS_FACTOR "$mat.glossinessFactor", 0, 0 1046 1047 // Sheen 1048 // ----- 1049 // Sheen base RGB color. Default {0,0,0} 1050 #define AI_MATKEY_SHEEN_COLOR_FACTOR "$clr.sheen.factor", 0, 0 1051 // Sheen Roughness Factor. 1052 #define AI_MATKEY_SHEEN_ROUGHNESS_FACTOR "$mat.sheen.roughnessFactor", 0, 0 1053 #define AI_MATKEY_SHEEN_COLOR_TEXTURE aiTextureType_SHEEN, 0 1054 #define AI_MATKEY_SHEEN_ROUGHNESS_TEXTURE aiTextureType_SHEEN, 1 1055 1056 // Clearcoat 1057 // --------- 1058 // Clearcoat layer intensity. 0.0 = none (disabled) 1059 #define AI_MATKEY_CLEARCOAT_FACTOR "$mat.clearcoat.factor", 0, 0 1060 #define AI_MATKEY_CLEARCOAT_ROUGHNESS_FACTOR "$mat.clearcoat.roughnessFactor", 0, 0 1061 #define AI_MATKEY_CLEARCOAT_TEXTURE aiTextureType_CLEARCOAT, 0 1062 #define AI_MATKEY_CLEARCOAT_ROUGHNESS_TEXTURE aiTextureType_CLEARCOAT, 1 1063 #define AI_MATKEY_CLEARCOAT_NORMAL_TEXTURE aiTextureType_CLEARCOAT, 2 1064 1065 // Transmission 1066 // ------------ 1067 // https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_transmission 1068 // Base percentage of light transmitted through the surface. 0.0 = Opaque, 1.0 = Fully transparent 1069 #define AI_MATKEY_TRANSMISSION_FACTOR "$mat.transmission.factor", 0, 0 1070 // Texture defining percentage of light transmitted through the surface. 1071 // Multiplied by AI_MATKEY_TRANSMISSION_FACTOR 1072 #define AI_MATKEY_TRANSMISSION_TEXTURE aiTextureType_TRANSMISSION, 0 1073 1074 // Volume 1075 // ------------ 1076 // https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_volume 1077 // The thickness of the volume beneath the surface. If the value is 0 the material is thin-walled. Otherwise the material is a volume boundary. 1078 #define AI_MATKEY_VOLUME_THICKNESS_FACTOR "$mat.volume.thicknessFactor", 0, 0 1079 // Texture that defines the thickness. 1080 // Multiplied by AI_MATKEY_THICKNESS_FACTOR 1081 #define AI_MATKEY_VOLUME_THICKNESS_TEXTURE aiTextureType_TRANSMISSION, 1 1082 // Density of the medium given as the average distance that light travels in the medium before interacting with a particle. 1083 #define AI_MATKEY_VOLUME_ATTENUATION_DISTANCE "$mat.volume.attenuationDistance", 0, 0 1084 // The color that white light turns into due to absorption when reaching the attenuation distance. 1085 #define AI_MATKEY_VOLUME_ATTENUATION_COLOR "$mat.volume.attenuationColor", 0, 0 1086 1087 // Emissive 1088 // -------- 1089 #define AI_MATKEY_USE_EMISSIVE_MAP "$mat.useEmissiveMap", 0, 0 1090 #define AI_MATKEY_EMISSIVE_INTENSITY "$mat.emissiveIntensity", 0, 0 1091 #define AI_MATKEY_USE_AO_MAP "$mat.useAOMap", 0, 0 1092 1093 // Anisotropy 1094 // ---------- 1095 #define AI_MATKEY_ANISOTROPY_ROTATION "$mat.anisotropyRotation", 0, 0 1096 #define AI_MATKEY_ANISOTROPY_TEXTURE aiTextureType_ANISOTROPY, 0 1097 1098 // --------------------------------------------------------------------------- 1099 // Pure key names for all texture-related properties 1100 //! @cond MATS_DOC_FULL 1101 #define _AI_MATKEY_TEXTURE_BASE "$tex.file" 1102 #define _AI_MATKEY_UVWSRC_BASE "$tex.uvwsrc" 1103 #define _AI_MATKEY_TEXOP_BASE "$tex.op" 1104 #define _AI_MATKEY_MAPPING_BASE "$tex.mapping" 1105 #define _AI_MATKEY_TEXBLEND_BASE "$tex.blend" 1106 #define _AI_MATKEY_MAPPINGMODE_U_BASE "$tex.mapmodeu" 1107 #define _AI_MATKEY_MAPPINGMODE_V_BASE "$tex.mapmodev" 1108 #define _AI_MATKEY_TEXMAP_AXIS_BASE "$tex.mapaxis" 1109 #define _AI_MATKEY_UVTRANSFORM_BASE "$tex.uvtrafo" 1110 #define _AI_MATKEY_TEXFLAGS_BASE "$tex.flags" 1111 //! @endcond 1112 1113 // --------------------------------------------------------------------------- 1114 #define AI_MATKEY_TEXTURE(type, N) _AI_MATKEY_TEXTURE_BASE, type, N 1115 1116 // For backward compatibility and simplicity 1117 //! @cond MATS_DOC_FULL 1118 #define AI_MATKEY_TEXTURE_DIFFUSE(N) \ 1119 AI_MATKEY_TEXTURE(aiTextureType_DIFFUSE, N) 1120 1121 #define AI_MATKEY_TEXTURE_SPECULAR(N) \ 1122 AI_MATKEY_TEXTURE(aiTextureType_SPECULAR, N) 1123 1124 #define AI_MATKEY_TEXTURE_AMBIENT(N) \ 1125 AI_MATKEY_TEXTURE(aiTextureType_AMBIENT, N) 1126 1127 #define AI_MATKEY_TEXTURE_EMISSIVE(N) \ 1128 AI_MATKEY_TEXTURE(aiTextureType_EMISSIVE, N) 1129 1130 #define AI_MATKEY_TEXTURE_NORMALS(N) \ 1131 AI_MATKEY_TEXTURE(aiTextureType_NORMALS, N) 1132 1133 #define AI_MATKEY_TEXTURE_HEIGHT(N) \ 1134 AI_MATKEY_TEXTURE(aiTextureType_HEIGHT, N) 1135 1136 #define AI_MATKEY_TEXTURE_SHININESS(N) \ 1137 AI_MATKEY_TEXTURE(aiTextureType_SHININESS, N) 1138 1139 #define AI_MATKEY_TEXTURE_OPACITY(N) \ 1140 AI_MATKEY_TEXTURE(aiTextureType_OPACITY, N) 1141 1142 #define AI_MATKEY_TEXTURE_DISPLACEMENT(N) \ 1143 AI_MATKEY_TEXTURE(aiTextureType_DISPLACEMENT, N) 1144 1145 #define AI_MATKEY_TEXTURE_LIGHTMAP(N) \ 1146 AI_MATKEY_TEXTURE(aiTextureType_LIGHTMAP, N) 1147 1148 #define AI_MATKEY_TEXTURE_REFLECTION(N) \ 1149 AI_MATKEY_TEXTURE(aiTextureType_REFLECTION, N) 1150 1151 //! @endcond 1152 1153 // --------------------------------------------------------------------------- 1154 #define AI_MATKEY_UVWSRC(type, N) _AI_MATKEY_UVWSRC_BASE, type, N 1155 1156 // For backward compatibility and simplicity 1157 //! @cond MATS_DOC_FULL 1158 #define AI_MATKEY_UVWSRC_DIFFUSE(N) \ 1159 AI_MATKEY_UVWSRC(aiTextureType_DIFFUSE, N) 1160 1161 #define AI_MATKEY_UVWSRC_SPECULAR(N) \ 1162 AI_MATKEY_UVWSRC(aiTextureType_SPECULAR, N) 1163 1164 #define AI_MATKEY_UVWSRC_AMBIENT(N) \ 1165 AI_MATKEY_UVWSRC(aiTextureType_AMBIENT, N) 1166 1167 #define AI_MATKEY_UVWSRC_EMISSIVE(N) \ 1168 AI_MATKEY_UVWSRC(aiTextureType_EMISSIVE, N) 1169 1170 #define AI_MATKEY_UVWSRC_NORMALS(N) \ 1171 AI_MATKEY_UVWSRC(aiTextureType_NORMALS, N) 1172 1173 #define AI_MATKEY_UVWSRC_HEIGHT(N) \ 1174 AI_MATKEY_UVWSRC(aiTextureType_HEIGHT, N) 1175 1176 #define AI_MATKEY_UVWSRC_SHININESS(N) \ 1177 AI_MATKEY_UVWSRC(aiTextureType_SHININESS, N) 1178 1179 #define AI_MATKEY_UVWSRC_OPACITY(N) \ 1180 AI_MATKEY_UVWSRC(aiTextureType_OPACITY, N) 1181 1182 #define AI_MATKEY_UVWSRC_DISPLACEMENT(N) \ 1183 AI_MATKEY_UVWSRC(aiTextureType_DISPLACEMENT, N) 1184 1185 #define AI_MATKEY_UVWSRC_LIGHTMAP(N) \ 1186 AI_MATKEY_UVWSRC(aiTextureType_LIGHTMAP, N) 1187 1188 #define AI_MATKEY_UVWSRC_REFLECTION(N) \ 1189 AI_MATKEY_UVWSRC(aiTextureType_REFLECTION, N) 1190 1191 //! @endcond 1192 // --------------------------------------------------------------------------- 1193 #define AI_MATKEY_TEXOP(type, N) _AI_MATKEY_TEXOP_BASE, type, N 1194 1195 // For backward compatibility and simplicity 1196 //! @cond MATS_DOC_FULL 1197 #define AI_MATKEY_TEXOP_DIFFUSE(N) \ 1198 AI_MATKEY_TEXOP(aiTextureType_DIFFUSE, N) 1199 1200 #define AI_MATKEY_TEXOP_SPECULAR(N) \ 1201 AI_MATKEY_TEXOP(aiTextureType_SPECULAR, N) 1202 1203 #define AI_MATKEY_TEXOP_AMBIENT(N) \ 1204 AI_MATKEY_TEXOP(aiTextureType_AMBIENT, N) 1205 1206 #define AI_MATKEY_TEXOP_EMISSIVE(N) \ 1207 AI_MATKEY_TEXOP(aiTextureType_EMISSIVE, N) 1208 1209 #define AI_MATKEY_TEXOP_NORMALS(N) \ 1210 AI_MATKEY_TEXOP(aiTextureType_NORMALS, N) 1211 1212 #define AI_MATKEY_TEXOP_HEIGHT(N) \ 1213 AI_MATKEY_TEXOP(aiTextureType_HEIGHT, N) 1214 1215 #define AI_MATKEY_TEXOP_SHININESS(N) \ 1216 AI_MATKEY_TEXOP(aiTextureType_SHININESS, N) 1217 1218 #define AI_MATKEY_TEXOP_OPACITY(N) \ 1219 AI_MATKEY_TEXOP(aiTextureType_OPACITY, N) 1220 1221 #define AI_MATKEY_TEXOP_DISPLACEMENT(N) \ 1222 AI_MATKEY_TEXOP(aiTextureType_DISPLACEMENT, N) 1223 1224 #define AI_MATKEY_TEXOP_LIGHTMAP(N) \ 1225 AI_MATKEY_TEXOP(aiTextureType_LIGHTMAP, N) 1226 1227 #define AI_MATKEY_TEXOP_REFLECTION(N) \ 1228 AI_MATKEY_TEXOP(aiTextureType_REFLECTION, N) 1229 1230 //! @endcond 1231 // --------------------------------------------------------------------------- 1232 #define AI_MATKEY_MAPPING(type, N) _AI_MATKEY_MAPPING_BASE, type, N 1233 1234 // For backward compatibility and simplicity 1235 //! @cond MATS_DOC_FULL 1236 #define AI_MATKEY_MAPPING_DIFFUSE(N) \ 1237 AI_MATKEY_MAPPING(aiTextureType_DIFFUSE, N) 1238 1239 #define AI_MATKEY_MAPPING_SPECULAR(N) \ 1240 AI_MATKEY_MAPPING(aiTextureType_SPECULAR, N) 1241 1242 #define AI_MATKEY_MAPPING_AMBIENT(N) \ 1243 AI_MATKEY_MAPPING(aiTextureType_AMBIENT, N) 1244 1245 #define AI_MATKEY_MAPPING_EMISSIVE(N) \ 1246 AI_MATKEY_MAPPING(aiTextureType_EMISSIVE, N) 1247 1248 #define AI_MATKEY_MAPPING_NORMALS(N) \ 1249 AI_MATKEY_MAPPING(aiTextureType_NORMALS, N) 1250 1251 #define AI_MATKEY_MAPPING_HEIGHT(N) \ 1252 AI_MATKEY_MAPPING(aiTextureType_HEIGHT, N) 1253 1254 #define AI_MATKEY_MAPPING_SHININESS(N) \ 1255 AI_MATKEY_MAPPING(aiTextureType_SHININESS, N) 1256 1257 #define AI_MATKEY_MAPPING_OPACITY(N) \ 1258 AI_MATKEY_MAPPING(aiTextureType_OPACITY, N) 1259 1260 #define AI_MATKEY_MAPPING_DISPLACEMENT(N) \ 1261 AI_MATKEY_MAPPING(aiTextureType_DISPLACEMENT, N) 1262 1263 #define AI_MATKEY_MAPPING_LIGHTMAP(N) \ 1264 AI_MATKEY_MAPPING(aiTextureType_LIGHTMAP, N) 1265 1266 #define AI_MATKEY_MAPPING_REFLECTION(N) \ 1267 AI_MATKEY_MAPPING(aiTextureType_REFLECTION, N) 1268 1269 //! @endcond 1270 // --------------------------------------------------------------------------- 1271 #define AI_MATKEY_TEXBLEND(type, N) _AI_MATKEY_TEXBLEND_BASE, type, N 1272 1273 // For backward compatibility and simplicity 1274 //! @cond MATS_DOC_FULL 1275 #define AI_MATKEY_TEXBLEND_DIFFUSE(N) \ 1276 AI_MATKEY_TEXBLEND(aiTextureType_DIFFUSE, N) 1277 1278 #define AI_MATKEY_TEXBLEND_SPECULAR(N) \ 1279 AI_MATKEY_TEXBLEND(aiTextureType_SPECULAR, N) 1280 1281 #define AI_MATKEY_TEXBLEND_AMBIENT(N) \ 1282 AI_MATKEY_TEXBLEND(aiTextureType_AMBIENT, N) 1283 1284 #define AI_MATKEY_TEXBLEND_EMISSIVE(N) \ 1285 AI_MATKEY_TEXBLEND(aiTextureType_EMISSIVE, N) 1286 1287 #define AI_MATKEY_TEXBLEND_NORMALS(N) \ 1288 AI_MATKEY_TEXBLEND(aiTextureType_NORMALS, N) 1289 1290 #define AI_MATKEY_TEXBLEND_HEIGHT(N) \ 1291 AI_MATKEY_TEXBLEND(aiTextureType_HEIGHT, N) 1292 1293 #define AI_MATKEY_TEXBLEND_SHININESS(N) \ 1294 AI_MATKEY_TEXBLEND(aiTextureType_SHININESS, N) 1295 1296 #define AI_MATKEY_TEXBLEND_OPACITY(N) \ 1297 AI_MATKEY_TEXBLEND(aiTextureType_OPACITY, N) 1298 1299 #define AI_MATKEY_TEXBLEND_DISPLACEMENT(N) \ 1300 AI_MATKEY_TEXBLEND(aiTextureType_DISPLACEMENT, N) 1301 1302 #define AI_MATKEY_TEXBLEND_LIGHTMAP(N) \ 1303 AI_MATKEY_TEXBLEND(aiTextureType_LIGHTMAP, N) 1304 1305 #define AI_MATKEY_TEXBLEND_REFLECTION(N) \ 1306 AI_MATKEY_TEXBLEND(aiTextureType_REFLECTION, N) 1307 1308 //! @endcond 1309 // --------------------------------------------------------------------------- 1310 #define AI_MATKEY_MAPPINGMODE_U(type, N) _AI_MATKEY_MAPPINGMODE_U_BASE, type, N 1311 1312 // For backward compatibility and simplicity 1313 //! @cond MATS_DOC_FULL 1314 #define AI_MATKEY_MAPPINGMODE_U_DIFFUSE(N) \ 1315 AI_MATKEY_MAPPINGMODE_U(aiTextureType_DIFFUSE, N) 1316 1317 #define AI_MATKEY_MAPPINGMODE_U_SPECULAR(N) \ 1318 AI_MATKEY_MAPPINGMODE_U(aiTextureType_SPECULAR, N) 1319 1320 #define AI_MATKEY_MAPPINGMODE_U_AMBIENT(N) \ 1321 AI_MATKEY_MAPPINGMODE_U(aiTextureType_AMBIENT, N) 1322 1323 #define AI_MATKEY_MAPPINGMODE_U_EMISSIVE(N) \ 1324 AI_MATKEY_MAPPINGMODE_U(aiTextureType_EMISSIVE, N) 1325 1326 #define AI_MATKEY_MAPPINGMODE_U_NORMALS(N) \ 1327 AI_MATKEY_MAPPINGMODE_U(aiTextureType_NORMALS, N) 1328 1329 #define AI_MATKEY_MAPPINGMODE_U_HEIGHT(N) \ 1330 AI_MATKEY_MAPPINGMODE_U(aiTextureType_HEIGHT, N) 1331 1332 #define AI_MATKEY_MAPPINGMODE_U_SHININESS(N) \ 1333 AI_MATKEY_MAPPINGMODE_U(aiTextureType_SHININESS, N) 1334 1335 #define AI_MATKEY_MAPPINGMODE_U_OPACITY(N) \ 1336 AI_MATKEY_MAPPINGMODE_U(aiTextureType_OPACITY, N) 1337 1338 #define AI_MATKEY_MAPPINGMODE_U_DISPLACEMENT(N) \ 1339 AI_MATKEY_MAPPINGMODE_U(aiTextureType_DISPLACEMENT, N) 1340 1341 #define AI_MATKEY_MAPPINGMODE_U_LIGHTMAP(N) \ 1342 AI_MATKEY_MAPPINGMODE_U(aiTextureType_LIGHTMAP, N) 1343 1344 #define AI_MATKEY_MAPPINGMODE_U_REFLECTION(N) \ 1345 AI_MATKEY_MAPPINGMODE_U(aiTextureType_REFLECTION, N) 1346 1347 //! @endcond 1348 // --------------------------------------------------------------------------- 1349 #define AI_MATKEY_MAPPINGMODE_V(type, N) _AI_MATKEY_MAPPINGMODE_V_BASE, type, N 1350 1351 // For backward compatibility and simplicity 1352 //! @cond MATS_DOC_FULL 1353 #define AI_MATKEY_MAPPINGMODE_V_DIFFUSE(N) \ 1354 AI_MATKEY_MAPPINGMODE_V(aiTextureType_DIFFUSE, N) 1355 1356 #define AI_MATKEY_MAPPINGMODE_V_SPECULAR(N) \ 1357 AI_MATKEY_MAPPINGMODE_V(aiTextureType_SPECULAR, N) 1358 1359 #define AI_MATKEY_MAPPINGMODE_V_AMBIENT(N) \ 1360 AI_MATKEY_MAPPINGMODE_V(aiTextureType_AMBIENT, N) 1361 1362 #define AI_MATKEY_MAPPINGMODE_V_EMISSIVE(N) \ 1363 AI_MATKEY_MAPPINGMODE_V(aiTextureType_EMISSIVE, N) 1364 1365 #define AI_MATKEY_MAPPINGMODE_V_NORMALS(N) \ 1366 AI_MATKEY_MAPPINGMODE_V(aiTextureType_NORMALS, N) 1367 1368 #define AI_MATKEY_MAPPINGMODE_V_HEIGHT(N) \ 1369 AI_MATKEY_MAPPINGMODE_V(aiTextureType_HEIGHT, N) 1370 1371 #define AI_MATKEY_MAPPINGMODE_V_SHININESS(N) \ 1372 AI_MATKEY_MAPPINGMODE_V(aiTextureType_SHININESS, N) 1373 1374 #define AI_MATKEY_MAPPINGMODE_V_OPACITY(N) \ 1375 AI_MATKEY_MAPPINGMODE_V(aiTextureType_OPACITY, N) 1376 1377 #define AI_MATKEY_MAPPINGMODE_V_DISPLACEMENT(N) \ 1378 AI_MATKEY_MAPPINGMODE_V(aiTextureType_DISPLACEMENT, N) 1379 1380 #define AI_MATKEY_MAPPINGMODE_V_LIGHTMAP(N) \ 1381 AI_MATKEY_MAPPINGMODE_V(aiTextureType_LIGHTMAP, N) 1382 1383 #define AI_MATKEY_MAPPINGMODE_V_REFLECTION(N) \ 1384 AI_MATKEY_MAPPINGMODE_V(aiTextureType_REFLECTION, N) 1385 1386 //! @endcond 1387 // --------------------------------------------------------------------------- 1388 #define AI_MATKEY_TEXMAP_AXIS(type, N) _AI_MATKEY_TEXMAP_AXIS_BASE, type, N 1389 1390 // For backward compatibility and simplicity 1391 //! @cond MATS_DOC_FULL 1392 #define AI_MATKEY_TEXMAP_AXIS_DIFFUSE(N) \ 1393 AI_MATKEY_TEXMAP_AXIS(aiTextureType_DIFFUSE, N) 1394 1395 #define AI_MATKEY_TEXMAP_AXIS_SPECULAR(N) \ 1396 AI_MATKEY_TEXMAP_AXIS(aiTextureType_SPECULAR, N) 1397 1398 #define AI_MATKEY_TEXMAP_AXIS_AMBIENT(N) \ 1399 AI_MATKEY_TEXMAP_AXIS(aiTextureType_AMBIENT, N) 1400 1401 #define AI_MATKEY_TEXMAP_AXIS_EMISSIVE(N) \ 1402 AI_MATKEY_TEXMAP_AXIS(aiTextureType_EMISSIVE, N) 1403 1404 #define AI_MATKEY_TEXMAP_AXIS_NORMALS(N) \ 1405 AI_MATKEY_TEXMAP_AXIS(aiTextureType_NORMALS, N) 1406 1407 #define AI_MATKEY_TEXMAP_AXIS_HEIGHT(N) \ 1408 AI_MATKEY_TEXMAP_AXIS(aiTextureType_HEIGHT, N) 1409 1410 #define AI_MATKEY_TEXMAP_AXIS_SHININESS(N) \ 1411 AI_MATKEY_TEXMAP_AXIS(aiTextureType_SHININESS, N) 1412 1413 #define AI_MATKEY_TEXMAP_AXIS_OPACITY(N) \ 1414 AI_MATKEY_TEXMAP_AXIS(aiTextureType_OPACITY, N) 1415 1416 #define AI_MATKEY_TEXMAP_AXIS_DISPLACEMENT(N) \ 1417 AI_MATKEY_TEXMAP_AXIS(aiTextureType_DISPLACEMENT, N) 1418 1419 #define AI_MATKEY_TEXMAP_AXIS_LIGHTMAP(N) \ 1420 AI_MATKEY_TEXMAP_AXIS(aiTextureType_LIGHTMAP, N) 1421 1422 #define AI_MATKEY_TEXMAP_AXIS_REFLECTION(N) \ 1423 AI_MATKEY_TEXMAP_AXIS(aiTextureType_REFLECTION, N) 1424 1425 //! @endcond 1426 // --------------------------------------------------------------------------- 1427 #define AI_MATKEY_UVTRANSFORM(type, N) _AI_MATKEY_UVTRANSFORM_BASE, type, N 1428 1429 // For backward compatibility and simplicity 1430 //! @cond MATS_DOC_FULL 1431 #define AI_MATKEY_UVTRANSFORM_DIFFUSE(N) \ 1432 AI_MATKEY_UVTRANSFORM(aiTextureType_DIFFUSE, N) 1433 1434 #define AI_MATKEY_UVTRANSFORM_SPECULAR(N) \ 1435 AI_MATKEY_UVTRANSFORM(aiTextureType_SPECULAR, N) 1436 1437 #define AI_MATKEY_UVTRANSFORM_AMBIENT(N) \ 1438 AI_MATKEY_UVTRANSFORM(aiTextureType_AMBIENT, N) 1439 1440 #define AI_MATKEY_UVTRANSFORM_EMISSIVE(N) \ 1441 AI_MATKEY_UVTRANSFORM(aiTextureType_EMISSIVE, N) 1442 1443 #define AI_MATKEY_UVTRANSFORM_NORMALS(N) \ 1444 AI_MATKEY_UVTRANSFORM(aiTextureType_NORMALS, N) 1445 1446 #define AI_MATKEY_UVTRANSFORM_HEIGHT(N) \ 1447 AI_MATKEY_UVTRANSFORM(aiTextureType_HEIGHT, N) 1448 1449 #define AI_MATKEY_UVTRANSFORM_SHININESS(N) \ 1450 AI_MATKEY_UVTRANSFORM(aiTextureType_SHININESS, N) 1451 1452 #define AI_MATKEY_UVTRANSFORM_OPACITY(N) \ 1453 AI_MATKEY_UVTRANSFORM(aiTextureType_OPACITY, N) 1454 1455 #define AI_MATKEY_UVTRANSFORM_DISPLACEMENT(N) \ 1456 AI_MATKEY_UVTRANSFORM(aiTextureType_DISPLACEMENT, N) 1457 1458 #define AI_MATKEY_UVTRANSFORM_LIGHTMAP(N) \ 1459 AI_MATKEY_UVTRANSFORM(aiTextureType_LIGHTMAP, N) 1460 1461 #define AI_MATKEY_UVTRANSFORM_REFLECTION(N) \ 1462 AI_MATKEY_UVTRANSFORM(aiTextureType_REFLECTION, N) 1463 1464 #define AI_MATKEY_UVTRANSFORM_UNKNOWN(N) \ 1465 AI_MATKEY_UVTRANSFORM(aiTextureType_UNKNOWN, N) 1466 1467 //! @endcond 1468 // --------------------------------------------------------------------------- 1469 #define AI_MATKEY_TEXFLAGS(type, N) _AI_MATKEY_TEXFLAGS_BASE, type, N 1470 1471 // For backward compatibility and simplicity 1472 //! @cond MATS_DOC_FULL 1473 #define AI_MATKEY_TEXFLAGS_DIFFUSE(N) \ 1474 AI_MATKEY_TEXFLAGS(aiTextureType_DIFFUSE, N) 1475 1476 #define AI_MATKEY_TEXFLAGS_SPECULAR(N) \ 1477 AI_MATKEY_TEXFLAGS(aiTextureType_SPECULAR, N) 1478 1479 #define AI_MATKEY_TEXFLAGS_AMBIENT(N) \ 1480 AI_MATKEY_TEXFLAGS(aiTextureType_AMBIENT, N) 1481 1482 #define AI_MATKEY_TEXFLAGS_EMISSIVE(N) \ 1483 AI_MATKEY_TEXFLAGS(aiTextureType_EMISSIVE, N) 1484 1485 #define AI_MATKEY_TEXFLAGS_NORMALS(N) \ 1486 AI_MATKEY_TEXFLAGS(aiTextureType_NORMALS, N) 1487 1488 #define AI_MATKEY_TEXFLAGS_HEIGHT(N) \ 1489 AI_MATKEY_TEXFLAGS(aiTextureType_HEIGHT, N) 1490 1491 #define AI_MATKEY_TEXFLAGS_SHININESS(N) \ 1492 AI_MATKEY_TEXFLAGS(aiTextureType_SHININESS, N) 1493 1494 #define AI_MATKEY_TEXFLAGS_OPACITY(N) \ 1495 AI_MATKEY_TEXFLAGS(aiTextureType_OPACITY, N) 1496 1497 #define AI_MATKEY_TEXFLAGS_DISPLACEMENT(N) \ 1498 AI_MATKEY_TEXFLAGS(aiTextureType_DISPLACEMENT, N) 1499 1500 #define AI_MATKEY_TEXFLAGS_LIGHTMAP(N) \ 1501 AI_MATKEY_TEXFLAGS(aiTextureType_LIGHTMAP, N) 1502 1503 #define AI_MATKEY_TEXFLAGS_REFLECTION(N) \ 1504 AI_MATKEY_TEXFLAGS(aiTextureType_REFLECTION, N) 1505 1506 #define AI_MATKEY_TEXFLAGS_UNKNOWN(N) \ 1507 AI_MATKEY_TEXFLAGS(aiTextureType_UNKNOWN, N) 1508 1509 //! @endcond 1510 //! 1511 // --------------------------------------------------------------------------- 1512 /** @brief Retrieve a material property with a specific key from the material 1513 * 1514 * @param pMat Pointer to the input material. May not be NULL 1515 * @param pKey Key to search for. One of the AI_MATKEY_XXX constants. 1516 * @param type Specifies the type of the texture to be retrieved ( 1517 * e.g. diffuse, specular, height map ...) 1518 * @param index Index of the texture to be retrieved. 1519 * @param pPropOut Pointer to receive a pointer to a valid aiMaterialProperty 1520 * structure or NULL if the key has not been found. */ 1521 // --------------------------------------------------------------------------- 1522 ASSIMP_API C_ENUM aiReturn aiGetMaterialProperty( 1523 const C_STRUCT aiMaterial *pMat, 1524 const char *pKey, 1525 unsigned int type, 1526 unsigned int index, 1527 const C_STRUCT aiMaterialProperty **pPropOut); 1528 1529 // --------------------------------------------------------------------------- 1530 /** @brief Retrieve an array of float values with a specific key 1531 * from the material 1532 * 1533 * Pass one of the AI_MATKEY_XXX constants for the last three parameters (the 1534 * example reads the #AI_MATKEY_UVTRANSFORM property of the first diffuse texture) 1535 * @code 1536 * aiUVTransform trafo; 1537 * unsigned int max = sizeof(aiUVTransform); 1538 * if (AI_SUCCESS != aiGetMaterialFloatArray(mat, AI_MATKEY_UVTRANSFORM(aiTextureType_DIFFUSE,0), 1539 * (float*)&trafo, &max) || sizeof(aiUVTransform) != max) 1540 * { 1541 * // error handling 1542 * } 1543 * @endcode 1544 * 1545 * @param pMat Pointer to the input material. May not be NULL 1546 * @param pKey Key to search for. One of the AI_MATKEY_XXX constants. 1547 * @param pOut Pointer to a buffer to receive the result. 1548 * @param pMax Specifies the size of the given buffer, in float's. 1549 * Receives the number of values (not bytes!) read. 1550 * @param type (see the code sample above) 1551 * @param index (see the code sample above) 1552 * @return Specifies whether the key has been found. If not, the output 1553 * arrays remains unmodified and pMax is set to 0.*/ 1554 // --------------------------------------------------------------------------- 1555 ASSIMP_API C_ENUM aiReturn aiGetMaterialFloatArray( 1556 const C_STRUCT aiMaterial *pMat, 1557 const char *pKey, 1558 unsigned int type, 1559 unsigned int index, 1560 ai_real *pOut, 1561 unsigned int *pMax); 1562 1563 // --------------------------------------------------------------------------- 1564 /** @brief Retrieve a single float property with a specific key from the material. 1565 * 1566 * Pass one of the AI_MATKEY_XXX constants for the last three parameters (the 1567 * example reads the #AI_MATKEY_SHININESS_STRENGTH property of the first diffuse texture) 1568 * @code 1569 * float specStrength = 1.f; // default value, remains unmodified if we fail. 1570 * aiGetMaterialFloat(mat, AI_MATKEY_SHININESS_STRENGTH, 1571 * (float*)&specStrength); 1572 * @endcode 1573 * 1574 * @param pMat Pointer to the input material. May not be NULL 1575 * @param pKey Key to search for. One of the AI_MATKEY_XXX constants. 1576 * @param pOut Receives the output float. 1577 * @param type (see the code sample above) 1578 * @param index (see the code sample above) 1579 * @return Specifies whether the key has been found. If not, the output 1580 * float remains unmodified.*/ 1581 // --------------------------------------------------------------------------- 1582 static inline aiReturn aiGetMaterialFloat(const C_STRUCT aiMaterial *pMat, 1583 const char *pKey, 1584 unsigned int type, 1585 unsigned int index, 1586 ai_real *pOut) { 1587 return aiGetMaterialFloatArray(pMat, pKey, type, index, pOut, NULL); 1588 } 1589 1590 // --------------------------------------------------------------------------- 1591 /** @brief Retrieve an array of integer values with a specific key 1592 * from a material 1593 * 1594 * See the sample for aiGetMaterialFloatArray for more information.*/ 1595 ASSIMP_API C_ENUM aiReturn aiGetMaterialIntegerArray(const C_STRUCT aiMaterial *pMat, 1596 const char *pKey, 1597 unsigned int type, 1598 unsigned int index, 1599 int *pOut, 1600 unsigned int *pMax); 1601 1602 // --------------------------------------------------------------------------- 1603 /** @brief Retrieve an integer property with a specific key from a material 1604 * 1605 * See the sample for aiGetMaterialFloat for more information.*/ 1606 // --------------------------------------------------------------------------- 1607 static inline aiReturn aiGetMaterialInteger(const C_STRUCT aiMaterial *pMat, 1608 const char *pKey, 1609 unsigned int type, 1610 unsigned int index, 1611 int *pOut) { 1612 return aiGetMaterialIntegerArray(pMat, pKey, type, index, pOut, NULL); 1613 } 1614 1615 // --------------------------------------------------------------------------- 1616 /** @brief Retrieve a color value from the material property table 1617 * 1618 * See the sample for aiGetMaterialFloat for more information*/ 1619 // --------------------------------------------------------------------------- 1620 ASSIMP_API C_ENUM aiReturn aiGetMaterialColor(const C_STRUCT aiMaterial *pMat, 1621 const char *pKey, 1622 unsigned int type, 1623 unsigned int index, 1624 C_STRUCT aiColor4D *pOut); 1625 1626 // --------------------------------------------------------------------------- 1627 /** @brief Retrieve a aiUVTransform value from the material property table 1628 * 1629 * See the sample for aiGetMaterialFloat for more information*/ 1630 // --------------------------------------------------------------------------- 1631 ASSIMP_API C_ENUM aiReturn aiGetMaterialUVTransform(const C_STRUCT aiMaterial *pMat, 1632 const char *pKey, 1633 unsigned int type, 1634 unsigned int index, 1635 C_STRUCT aiUVTransform *pOut); 1636 1637 // --------------------------------------------------------------------------- 1638 /** @brief Retrieve a string from the material property table 1639 * 1640 * See the sample for aiGetMaterialFloat for more information.*/ 1641 // --------------------------------------------------------------------------- 1642 ASSIMP_API C_ENUM aiReturn aiGetMaterialString(const C_STRUCT aiMaterial *pMat, 1643 const char *pKey, 1644 unsigned int type, 1645 unsigned int index, 1646 C_STRUCT aiString *pOut); 1647 1648 // --------------------------------------------------------------------------- 1649 /** Get the number of textures for a particular texture type. 1650 * @param[in] pMat Pointer to the input material. May not be NULL 1651 * @param type Texture type to check for 1652 * @return Number of textures for this type. 1653 * @note A texture can be easily queried using #aiGetMaterialTexture() */ 1654 // --------------------------------------------------------------------------- 1655 ASSIMP_API unsigned int aiGetMaterialTextureCount(const C_STRUCT aiMaterial *pMat, 1656 C_ENUM aiTextureType type); 1657 1658 // --------------------------------------------------------------------------- 1659 /** @brief Helper function to get all values pertaining to a particular 1660 * texture slot from a material structure. 1661 * 1662 * This function is provided just for convenience. You could also read the 1663 * texture by parsing all of its properties manually. This function bundles 1664 * all of them in a huge function monster. 1665 * 1666 * @param[in] mat Pointer to the input material. May not be NULL 1667 * @param[in] type Specifies the texture stack to read from (e.g. diffuse, 1668 * specular, height map ...). 1669 * @param[in] index Index of the texture. The function fails if the 1670 * requested index is not available for this texture type. 1671 * #aiGetMaterialTextureCount() can be used to determine the number of 1672 * textures in a particular texture stack. 1673 * @param[out] path Receives the output path 1674 * If the texture is embedded, receives a '*' followed by the id of 1675 * the texture (for the textures stored in the corresponding scene) which 1676 * can be converted to an int using a function like atoi. 1677 * This parameter must be non-null. 1678 * @param mapping The texture mapping mode to be used. 1679 * Pass NULL if you're not interested in this information. 1680 * @param[out] uvindex For UV-mapped textures: receives the index of the UV 1681 * source channel. Unmodified otherwise. 1682 * Pass NULL if you're not interested in this information. 1683 * @param[out] blend Receives the blend factor for the texture 1684 * Pass NULL if you're not interested in this information. 1685 * @param[out] op Receives the texture blend operation to be perform between 1686 * this texture and the previous texture. 1687 * Pass NULL if you're not interested in this information. 1688 * @param[out] mapmode Receives the mapping modes to be used for the texture. 1689 * Pass NULL if you're not interested in this information. Otherwise, 1690 * pass a pointer to an array of two aiTextureMapMode's (one for each 1691 * axis, UV order). 1692 * @param[out] flags Receives the the texture flags. 1693 * @return AI_SUCCESS on success, otherwise something else. Have fun.*/ 1694 // --------------------------------------------------------------------------- 1695 #ifdef __cplusplus 1696 ASSIMP_API aiReturn aiGetMaterialTexture(const C_STRUCT aiMaterial *mat, 1697 aiTextureType type, 1698 unsigned int index, 1699 aiString *path, 1700 aiTextureMapping *mapping = NULL, 1701 unsigned int *uvindex = NULL, 1702 ai_real *blend = NULL, 1703 aiTextureOp *op = NULL, 1704 aiTextureMapMode *mapmode = NULL, 1705 unsigned int *flags = NULL); 1706 #else 1707 C_ENUM aiReturn aiGetMaterialTexture(const C_STRUCT aiMaterial *mat, 1708 C_ENUM aiTextureType type, 1709 unsigned int index, 1710 C_STRUCT aiString *path, 1711 C_ENUM aiTextureMapping *mapping /*= NULL*/, 1712 unsigned int *uvindex /*= NULL*/, 1713 ai_real *blend /*= NULL*/, 1714 C_ENUM aiTextureOp *op /*= NULL*/, 1715 C_ENUM aiTextureMapMode *mapmode /*= NULL*/, 1716 unsigned int *flags /*= NULL*/); 1717 #endif // !#ifdef __cplusplus 1718 1719 #ifdef __cplusplus 1720 } 1721 1722 #include "material.inl" 1723 1724 #endif //!__cplusplus 1725 1726 #endif //!!AI_MATERIAL_H_INC
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|