![]() |
|
|||
File indexing completed on 2025-02-21 09:30:09
0001 /* 0002 --------------------------------------------------------------------------- 0003 Open Asset Import Library (assimp) 0004 --------------------------------------------------------------------------- 0005 0006 Copyright (c) 2006-2024, 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 #ifndef SWIG 0338 _aiTextureType_Force32Bit = INT_MAX 0339 #endif 0340 }; 0341 0342 #define AI_TEXTURE_TYPE_MAX aiTextureType_MAYA_SPECULAR_ROUGHNESS 0343 0344 // ------------------------------------------------------------------------------- 0345 /** 0346 * @brief Get a string for a given aiTextureType 0347 * 0348 * @param in The texture type 0349 * @return The description string for the texture type. 0350 */ 0351 ASSIMP_API const char *aiTextureTypeToString(enum aiTextureType in); 0352 0353 // --------------------------------------------------------------------------- 0354 /** @brief Defines all shading models supported by the library 0355 * 0356 * Property: #AI_MATKEY_SHADING_MODEL 0357 * 0358 * The list of shading modes has been taken from Blender. 0359 * See Blender documentation for more information. The API does 0360 * not distinguish between "specular" and "diffuse" shaders (thus the 0361 * specular term for diffuse shading models like Oren-Nayar remains 0362 * undefined). <br> 0363 * Again, this value is just a hint. Assimp tries to select the shader whose 0364 * most common implementation matches the original rendering results of the 0365 * 3D modeler which wrote a particular model as closely as possible. 0366 * 0367 */ 0368 enum aiShadingMode { 0369 /** Flat shading. Shading is done on per-face base, 0370 * diffuse only. Also known as 'faceted shading'. 0371 */ 0372 aiShadingMode_Flat = 0x1, 0373 0374 /** Simple Gouraud shading. 0375 */ 0376 aiShadingMode_Gouraud = 0x2, 0377 0378 /** Phong-Shading - 0379 */ 0380 aiShadingMode_Phong = 0x3, 0381 0382 /** Phong-Blinn-Shading 0383 */ 0384 aiShadingMode_Blinn = 0x4, 0385 0386 /** Toon-Shading per pixel 0387 * 0388 * Also known as 'comic' shader. 0389 */ 0390 aiShadingMode_Toon = 0x5, 0391 0392 /** OrenNayar-Shading per pixel 0393 * 0394 * Extension to standard Lambertian shading, taking the 0395 * roughness of the material into account 0396 */ 0397 aiShadingMode_OrenNayar = 0x6, 0398 0399 /** Minnaert-Shading per pixel 0400 * 0401 * Extension to standard Lambertian shading, taking the 0402 * "darkness" of the material into account 0403 */ 0404 aiShadingMode_Minnaert = 0x7, 0405 0406 /** CookTorrance-Shading per pixel 0407 * 0408 * Special shader for metallic surfaces. 0409 */ 0410 aiShadingMode_CookTorrance = 0x8, 0411 0412 /** No shading at all. Constant light influence of 1.0. 0413 * Also known as "Unlit" 0414 */ 0415 aiShadingMode_NoShading = 0x9, 0416 aiShadingMode_Unlit = aiShadingMode_NoShading, // Alias 0417 0418 /** Fresnel shading 0419 */ 0420 aiShadingMode_Fresnel = 0xa, 0421 0422 /** Physically-Based Rendering (PBR) shading using 0423 * Bidirectional scattering/reflectance distribution function (BSDF/BRDF) 0424 * There are multiple methods under this banner, and model files may provide 0425 * data for more than one PBR-BRDF method. 0426 * Applications should use the set of provided properties to determine which 0427 * of their preferred PBR rendering methods are likely to be available 0428 * eg: 0429 * - If AI_MATKEY_METALLIC_FACTOR is set, then a Metallic/Roughness is available 0430 * - If AI_MATKEY_GLOSSINESS_FACTOR is set, then a Specular/Glossiness is available 0431 * Note that some PBR methods allow layering of techniques 0432 */ 0433 aiShadingMode_PBR_BRDF = 0xb, 0434 0435 #ifndef SWIG 0436 _aiShadingMode_Force32Bit = INT_MAX 0437 #endif 0438 }; 0439 0440 // --------------------------------------------------------------------------- 0441 /** 0442 * @brief Defines some mixed flags for a particular texture. 0443 * 0444 * Usually you'll instruct your cg artists how textures have to look like ... 0445 * and how they will be processed in your application. However, if you use 0446 * Assimp for completely generic loading purposes you might also need to 0447 * process these flags in order to display as many 'unknown' 3D models as 0448 * possible correctly. 0449 * 0450 * This corresponds to the #AI_MATKEY_TEXFLAGS property. 0451 */ 0452 enum aiTextureFlags { 0453 /** The texture's color values have to be inverted (component-wise 1-n) 0454 */ 0455 aiTextureFlags_Invert = 0x1, 0456 0457 /** Explicit request to the application to process the alpha channel 0458 * of the texture. 0459 * 0460 * Mutually exclusive with #aiTextureFlags_IgnoreAlpha. These 0461 * flags are set if the library can say for sure that the alpha 0462 * channel is used/is not used. If the model format does not 0463 * define this, it is left to the application to decide whether 0464 * the texture alpha channel - if any - is evaluated or not. 0465 */ 0466 aiTextureFlags_UseAlpha = 0x2, 0467 0468 /** Explicit request to the application to ignore the alpha channel 0469 * of the texture. 0470 * 0471 * Mutually exclusive with #aiTextureFlags_UseAlpha. 0472 */ 0473 aiTextureFlags_IgnoreAlpha = 0x4, 0474 0475 #ifndef SWIG 0476 _aiTextureFlags_Force32Bit = INT_MAX 0477 #endif 0478 }; 0479 0480 // --------------------------------------------------------------------------- 0481 /** 0482 * @brief Defines alpha-blend flags. 0483 * 0484 * If you're familiar with OpenGL or D3D, these flags aren't new to you. 0485 * They define *how* the final color value of a pixel is computed, basing 0486 * on the previous color at that pixel and the new color value from the 0487 * material. 0488 * The blend formula is: 0489 * @code 0490 * SourceColor * SourceBlend + DestColor * DestBlend 0491 * @endcode 0492 * where DestColor is the previous color in the frame-buffer at this 0493 * position and SourceColor is the material color before the transparency 0494 * calculation.<br> 0495 * This corresponds to the #AI_MATKEY_BLEND_FUNC property. 0496 */ 0497 enum aiBlendMode { 0498 /** 0499 * Formula: 0500 * @code 0501 * SourceColor*SourceAlpha + DestColor*(1-SourceAlpha) 0502 * @endcode 0503 */ 0504 aiBlendMode_Default = 0x0, 0505 0506 /** Additive blending 0507 * 0508 * Formula: 0509 * @code 0510 * SourceColor*1 + DestColor*1 0511 * @endcode 0512 */ 0513 aiBlendMode_Additive = 0x1, 0514 0515 // we don't need more for the moment, but we might need them 0516 // in future versions ... 0517 0518 #ifndef SWIG 0519 _aiBlendMode_Force32Bit = INT_MAX 0520 #endif 0521 }; 0522 0523 #include "./Compiler/pushpack1.h" 0524 0525 // --------------------------------------------------------------------------- 0526 /** 0527 * @brief Defines how an UV channel is transformed. 0528 * 0529 * This is just a helper structure for the #AI_MATKEY_UVTRANSFORM key. 0530 * See its documentation for more details. 0531 * 0532 * Typically you'll want to build a matrix of this information. However, 0533 * we keep separate scaling/translation/rotation values to make it 0534 * easier to process and optimize UV transformations internally. 0535 */ 0536 struct aiUVTransform { 0537 /** Translation on the u and v axes. 0538 * 0539 * The default value is (0|0). 0540 */ 0541 C_STRUCT aiVector2D mTranslation; 0542 0543 /** Scaling on the u and v axes. 0544 * 0545 * The default value is (1|1). 0546 */ 0547 C_STRUCT aiVector2D mScaling; 0548 0549 /** Rotation - in counter-clockwise direction. 0550 * 0551 * The rotation angle is specified in radians. The 0552 * rotation center is 0.5f|0.5f. The default value 0553 * 0.f. 0554 */ 0555 ai_real mRotation; 0556 0557 #ifdef __cplusplus 0558 aiUVTransform() AI_NO_EXCEPT 0559 : mTranslation(0.0, 0.0), 0560 mScaling(1.0, 1.0), 0561 mRotation(0.0) { 0562 // nothing to be done here ... 0563 } 0564 #endif 0565 }; 0566 0567 #include "./Compiler/poppack1.h" 0568 0569 //! @cond AI_DOX_INCLUDE_INTERNAL 0570 // --------------------------------------------------------------------------- 0571 /** 0572 * @brief A very primitive RTTI system for the contents of material properties. 0573 */ 0574 enum aiPropertyTypeInfo { 0575 /** Array of single-precision (32 Bit) floats 0576 * 0577 * It is possible to use aiGetMaterialInteger[Array]() (or the C++-API 0578 * aiMaterial::Get()) to query properties stored in floating-point format. 0579 * The material system performs the type conversion automatically. 0580 */ 0581 aiPTI_Float = 0x1, 0582 0583 /** Array of double-precision (64 Bit) floats 0584 * 0585 * It is possible to use aiGetMaterialInteger[Array]() (or the C++-API 0586 * aiMaterial::Get()) to query properties stored in floating-point format. 0587 * The material system performs the type conversion automatically. 0588 */ 0589 aiPTI_Double = 0x2, 0590 0591 /** The material property is an aiString. 0592 * 0593 * Arrays of strings aren't possible, aiGetMaterialString() (or the 0594 * C++-API aiMaterial::Get()) *must* be used to query a string property. 0595 */ 0596 aiPTI_String = 0x3, 0597 0598 /** Array of (32 Bit) integers 0599 * 0600 * It is possible to use aiGetMaterialFloat[Array]() (or the C++-API 0601 * aiMaterial::Get()) to query properties stored in integer format. 0602 * The material system performs the type conversion automatically. 0603 */ 0604 aiPTI_Integer = 0x4, 0605 0606 /** Simple binary buffer, content undefined. Not convertible to anything. 0607 */ 0608 aiPTI_Buffer = 0x5, 0609 0610 /** This value is not used. It is just there to force the 0611 * compiler to map this enum to a 32 Bit integer. 0612 */ 0613 #ifndef SWIG 0614 _aiPTI_Force32Bit = INT_MAX 0615 #endif 0616 }; 0617 0618 // --------------------------------------------------------------------------- 0619 /** @brief Data structure for a single material property 0620 * 0621 * As an user, you'll probably never need to deal with this data structure. 0622 * Just use the provided aiGetMaterialXXX() or aiMaterial::Get() family 0623 * of functions to query material properties easily. Processing them 0624 * manually is faster, but it is not the recommended way. It isn't worth 0625 * the effort. <br> 0626 * Material property names follow a simple scheme: 0627 * @code 0628 * $<name> 0629 * ?<name> 0630 * A public property, there must be corresponding AI_MATKEY_XXX define 0631 * 2nd: Public, but ignored by the #aiProcess_RemoveRedundantMaterials 0632 * post-processing step. 0633 * ~<name> 0634 * A temporary property for internal use. 0635 * @endcode 0636 * @see aiMaterial 0637 */ 0638 struct aiMaterialProperty { 0639 /** Specifies the name of the property (key) 0640 * Keys are generally case insensitive. 0641 */ 0642 C_STRUCT aiString mKey; 0643 0644 /** Textures: Specifies their exact usage semantic. 0645 * For non-texture properties, this member is always 0 0646 * (or, better-said, #aiTextureType_NONE). 0647 */ 0648 unsigned int mSemantic; 0649 0650 /** Textures: Specifies the index of the texture. 0651 * For non-texture properties, this member is always 0. 0652 */ 0653 unsigned int mIndex; 0654 0655 /** Size of the buffer mData is pointing to, in bytes. 0656 * This value may not be 0. 0657 */ 0658 unsigned int mDataLength; 0659 0660 /** Type information for the property. 0661 * 0662 * Defines the data layout inside the data buffer. This is used 0663 * by the library internally to perform debug checks and to 0664 * utilize proper type conversions. 0665 * (It's probably a hacky solution, but it works.) 0666 */ 0667 C_ENUM aiPropertyTypeInfo mType; 0668 0669 /** Binary buffer to hold the property's value. 0670 * The size of the buffer is always mDataLength. 0671 */ 0672 char *mData; 0673 0674 #ifdef __cplusplus 0675 0676 aiMaterialProperty() AI_NO_EXCEPT 0677 : mSemantic(0), 0678 mIndex(0), 0679 mDataLength(0), 0680 mType(aiPTI_Float), 0681 mData(nullptr) { 0682 // empty 0683 } 0684 0685 ~aiMaterialProperty() { 0686 delete[] mData; 0687 mData = nullptr; 0688 } 0689 0690 #endif 0691 }; 0692 //! @endcond 0693 0694 #ifdef __cplusplus 0695 } // We need to leave the "C" block here to allow template member functions 0696 #endif 0697 0698 // --------------------------------------------------------------------------- 0699 /** @brief Data structure for a material 0700 * 0701 * Material data is stored using a key-value structure. A single key-value 0702 * pair is called a 'material property'. C++ users should use the provided 0703 * member functions of aiMaterial to process material properties, C users 0704 * have to stick with the aiMaterialGetXXX family of unbound functions. 0705 * The library defines a set of standard keys (AI_MATKEY_XXX). 0706 */ 0707 #ifdef __cplusplus 0708 struct ASSIMP_API aiMaterial 0709 #else 0710 struct aiMaterial 0711 #endif 0712 { 0713 0714 #ifdef __cplusplus 0715 0716 public: 0717 /** 0718 * @brief The class constructor. 0719 */ 0720 aiMaterial(); 0721 0722 /** 0723 * @brief The class destructor. 0724 */ 0725 ~aiMaterial(); 0726 0727 // ------------------------------------------------------------------- 0728 /** 0729 * @brief Returns the name of the material. 0730 * @return The name of the material. 0731 */ 0732 // ------------------------------------------------------------------- 0733 aiString GetName() const; 0734 0735 // ------------------------------------------------------------------- 0736 /** @brief Retrieve an array of Type values with a specific key 0737 * from the material 0738 * 0739 * @param pKey Key to search for. One of the AI_MATKEY_XXX constants. 0740 * @param type .. set by AI_MATKEY_XXX 0741 * @param idx .. set by AI_MATKEY_XXX 0742 * @param pOut Pointer to a buffer to receive the result. 0743 * @param pMax Specifies the size of the given buffer, in Type's. 0744 * Receives the number of values (not bytes!) read. 0745 * NULL is a valid value for this parameter. 0746 */ 0747 template <typename Type> 0748 aiReturn Get(const char *pKey, unsigned int type, 0749 unsigned int idx, Type *pOut, unsigned int *pMax) const; 0750 0751 aiReturn Get(const char *pKey, unsigned int type, 0752 unsigned int idx, int *pOut, unsigned int *pMax) const; 0753 0754 aiReturn Get(const char *pKey, unsigned int type, 0755 unsigned int idx, ai_real *pOut, unsigned int *pMax) const; 0756 0757 // ------------------------------------------------------------------- 0758 /** @brief Retrieve a Type value with a specific key 0759 * from the material 0760 * 0761 * @param pKey Key to search for. One of the AI_MATKEY_XXX constants. 0762 * @param type Specifies the type of the texture to be retrieved ( 0763 * e.g. diffuse, specular, height map ...) 0764 * @param idx Index of the texture to be retrieved. 0765 * @param pOut Reference to receive the output value 0766 */ 0767 template <typename Type> 0768 aiReturn Get(const char *pKey, unsigned int type, 0769 unsigned int idx, Type &pOut) const; 0770 0771 aiReturn Get(const char *pKey, unsigned int type, 0772 unsigned int idx, int &pOut) const; 0773 0774 aiReturn Get(const char *pKey, unsigned int type, 0775 unsigned int idx, ai_real &pOut) const; 0776 0777 aiReturn Get(const char *pKey, unsigned int type, 0778 unsigned int idx, aiString &pOut) const; 0779 0780 aiReturn Get(const char *pKey, unsigned int type, 0781 unsigned int idx, aiColor3D &pOut) const; 0782 0783 aiReturn Get(const char *pKey, unsigned int type, 0784 unsigned int idx, aiColor4D &pOut) const; 0785 0786 aiReturn Get(const char *pKey, unsigned int type, 0787 unsigned int idx, aiUVTransform &pOut) const; 0788 0789 // ------------------------------------------------------------------- 0790 /** Get the number of textures for a particular texture type. 0791 * @param type Texture type to check for 0792 * @return Number of textures for this type. 0793 * @note A texture can be easily queried using #GetTexture() */ 0794 unsigned int GetTextureCount(aiTextureType type) const; 0795 0796 // ------------------------------------------------------------------- 0797 /** Helper function to get all parameters pertaining to a 0798 * particular texture slot from a material. 0799 * 0800 * This function is provided just for convenience, you could also 0801 * read the single material properties manually. 0802 * @param type Specifies the type of the texture to be retrieved ( 0803 * e.g. diffuse, specular, height map ...) 0804 * @param index Index of the texture to be retrieved. The function fails 0805 * if there is no texture of that type with this index. 0806 * #GetTextureCount() can be used to determine the number of textures 0807 * per texture type. 0808 * @param path Receives the path to the texture. 0809 * Use aiScene::GetEmbeddedTexture() method to determine if returned path 0810 * is an image file to be opened or a string key of embedded texture stored in the corresponding scene 0811 * (could be a '*' followed by the id of the texture in case of no name) 0812 * NULL is a valid value. 0813 * @param mapping The texture mapping. 0814 * NULL is allowed as value. 0815 * @param uvindex Receives the UV index of the texture. 0816 * NULL is a valid value. 0817 * @param blend Receives the blend factor for the texture 0818 * NULL is a valid value. 0819 * @param op Receives the texture operation to be performed between 0820 * this texture and the previous texture. NULL is allowed as value. 0821 * @param mapmode Receives the mapping modes to be used for the texture. 0822 * The parameter may be NULL but if it is a valid pointer it MUST 0823 * point to an array of 3 aiTextureMapMode's (one for each 0824 * axis: UVW order (=XYZ)). 0825 */ 0826 // ------------------------------------------------------------------- 0827 aiReturn GetTexture(aiTextureType type, 0828 unsigned int index, 0829 C_STRUCT aiString *path, 0830 aiTextureMapping *mapping = NULL, 0831 unsigned int *uvindex = NULL, 0832 ai_real *blend = NULL, 0833 aiTextureOp *op = NULL, 0834 aiTextureMapMode *mapmode = NULL) const; 0835 0836 // Setters 0837 0838 // ------------------------------------------------------------------------------ 0839 /** @brief Add a property with a given key and type info to the material 0840 * structure 0841 * 0842 * @param pInput Pointer to input data 0843 * @param pSizeInBytes Size of input data 0844 * @param pKey Key/Usage of the property (AI_MATKEY_XXX) 0845 * @param type Set by the AI_MATKEY_XXX macro 0846 * @param index Set by the AI_MATKEY_XXX macro 0847 * @param pType Type information hint */ 0848 aiReturn AddBinaryProperty(const void *pInput, 0849 unsigned int pSizeInBytes, 0850 const char *pKey, 0851 unsigned int type, 0852 unsigned int index, 0853 aiPropertyTypeInfo pType); 0854 0855 // ------------------------------------------------------------------------------ 0856 /** @brief Add a string property with a given key and type info to the 0857 * material structure 0858 * 0859 * @param pInput Input string 0860 * @param pKey Key/Usage of the property (AI_MATKEY_XXX) 0861 * @param type Set by the AI_MATKEY_XXX macro 0862 * @param index Set by the AI_MATKEY_XXX macro */ 0863 aiReturn AddProperty(const aiString *pInput, 0864 const char *pKey, 0865 unsigned int type = 0, 0866 unsigned int index = 0); 0867 0868 // ------------------------------------------------------------------------------ 0869 /** @brief Add a property with a given key to the material structure 0870 * @param pInput Pointer to the input data 0871 * @param pNumValues Number of values in the array 0872 * @param pKey Key/Usage of the property (AI_MATKEY_XXX) 0873 * @param type Set by the AI_MATKEY_XXX macro 0874 * @param index Set by the AI_MATKEY_XXX macro */ 0875 template <class TYPE> 0876 aiReturn AddProperty(const TYPE *pInput, 0877 unsigned int pNumValues, 0878 const char *pKey, 0879 unsigned int type = 0, 0880 unsigned int index = 0); 0881 0882 aiReturn AddProperty(const aiVector3D *pInput, 0883 unsigned int pNumValues, 0884 const char *pKey, 0885 unsigned int type = 0, 0886 unsigned int index = 0); 0887 0888 aiReturn AddProperty(const aiColor3D *pInput, 0889 unsigned int pNumValues, 0890 const char *pKey, 0891 unsigned int type = 0, 0892 unsigned int index = 0); 0893 0894 aiReturn AddProperty(const aiColor4D *pInput, 0895 unsigned int pNumValues, 0896 const char *pKey, 0897 unsigned int type = 0, 0898 unsigned int index = 0); 0899 0900 aiReturn AddProperty(const int *pInput, 0901 unsigned int pNumValues, 0902 const char *pKey, 0903 unsigned int type = 0, 0904 unsigned int index = 0); 0905 0906 aiReturn AddProperty(const float *pInput, 0907 unsigned int pNumValues, 0908 const char *pKey, 0909 unsigned int type = 0, 0910 unsigned int index = 0); 0911 0912 aiReturn AddProperty(const double *pInput, 0913 unsigned int pNumValues, 0914 const char *pKey, 0915 unsigned int type = 0, 0916 unsigned int index = 0); 0917 0918 aiReturn AddProperty(const aiUVTransform *pInput, 0919 unsigned int pNumValues, 0920 const char *pKey, 0921 unsigned int type = 0, 0922 unsigned int index = 0); 0923 0924 // ------------------------------------------------------------------------------ 0925 /** @brief Remove a given key from the list. 0926 * 0927 * The function fails if the key isn't found 0928 * @param pKey Key to be deleted 0929 * @param type Set by the AI_MATKEY_XXX macro 0930 * @param index Set by the AI_MATKEY_XXX macro */ 0931 aiReturn RemoveProperty(const char *pKey, 0932 unsigned int type = 0, 0933 unsigned int index = 0); 0934 0935 // ------------------------------------------------------------------------------ 0936 /** @brief Removes all properties from the material. 0937 * 0938 * The data array remains allocated so adding new properties is quite fast. */ 0939 void Clear(); 0940 0941 // ------------------------------------------------------------------------------ 0942 /** Copy the property list of a material 0943 * @param pcDest Destination material 0944 * @param pcSrc Source material 0945 */ 0946 static void CopyPropertyList(aiMaterial *pcDest, 0947 const aiMaterial *pcSrc); 0948 0949 #endif 0950 0951 /** List of all material properties loaded. */ 0952 C_STRUCT aiMaterialProperty **mProperties; 0953 0954 /** Number of properties in the data base */ 0955 unsigned int mNumProperties; 0956 0957 /** Storage allocated */ 0958 unsigned int mNumAllocated; 0959 }; 0960 0961 // Go back to extern "C" again 0962 #ifdef __cplusplus 0963 extern "C" { 0964 #endif 0965 0966 // --------------------------------------------------------------------------- 0967 #define AI_MATKEY_NAME "?mat.name", 0, 0 0968 #define AI_MATKEY_TWOSIDED "$mat.twosided", 0, 0 0969 #define AI_MATKEY_SHADING_MODEL "$mat.shadingm", 0, 0 0970 #define AI_MATKEY_ENABLE_WIREFRAME "$mat.wireframe", 0, 0 0971 #define AI_MATKEY_BLEND_FUNC "$mat.blend", 0, 0 0972 #define AI_MATKEY_OPACITY "$mat.opacity", 0, 0 0973 #define AI_MATKEY_TRANSPARENCYFACTOR "$mat.transparencyfactor", 0, 0 0974 #define AI_MATKEY_BUMPSCALING "$mat.bumpscaling", 0, 0 0975 #define AI_MATKEY_SHININESS "$mat.shininess", 0, 0 0976 #define AI_MATKEY_REFLECTIVITY "$mat.reflectivity", 0, 0 0977 #define AI_MATKEY_SHININESS_STRENGTH "$mat.shinpercent", 0, 0 0978 #define AI_MATKEY_REFRACTI "$mat.refracti", 0, 0 0979 #define AI_MATKEY_COLOR_DIFFUSE "$clr.diffuse", 0, 0 0980 #define AI_MATKEY_COLOR_AMBIENT "$clr.ambient", 0, 0 0981 #define AI_MATKEY_COLOR_SPECULAR "$clr.specular", 0, 0 0982 #define AI_MATKEY_COLOR_EMISSIVE "$clr.emissive", 0, 0 0983 #define AI_MATKEY_COLOR_TRANSPARENT "$clr.transparent", 0, 0 0984 #define AI_MATKEY_COLOR_REFLECTIVE "$clr.reflective", 0, 0 0985 #define AI_MATKEY_GLOBAL_BACKGROUND_IMAGE "?bg.global", 0, 0 0986 #define AI_MATKEY_GLOBAL_SHADERLANG "?sh.lang", 0, 0 0987 #define AI_MATKEY_SHADER_VERTEX "?sh.vs", 0, 0 0988 #define AI_MATKEY_SHADER_FRAGMENT "?sh.fs", 0, 0 0989 #define AI_MATKEY_SHADER_GEO "?sh.gs", 0, 0 0990 #define AI_MATKEY_SHADER_TESSELATION "?sh.ts", 0, 0 0991 #define AI_MATKEY_SHADER_PRIMITIVE "?sh.ps", 0, 0 0992 #define AI_MATKEY_SHADER_COMPUTE "?sh.cs", 0, 0 0993 0994 // --------------------------------------------------------------------------- 0995 // PBR material support 0996 // -------------------- 0997 // Properties defining PBR rendering techniques 0998 #define AI_MATKEY_USE_COLOR_MAP "$mat.useColorMap", 0, 0 0999 1000 // Metallic/Roughness Workflow 1001 // --------------------------- 1002 // Base RGBA color factor. Will be multiplied by final base color texture values if extant 1003 // Note: Importers may choose to copy this into AI_MATKEY_COLOR_DIFFUSE for compatibility 1004 // with renderers and formats that do not support Metallic/Roughness PBR 1005 #define AI_MATKEY_BASE_COLOR "$clr.base", 0, 0 1006 #define AI_MATKEY_BASE_COLOR_TEXTURE aiTextureType_BASE_COLOR, 0 1007 #define AI_MATKEY_USE_METALLIC_MAP "$mat.useMetallicMap", 0, 0 1008 // Metallic factor. 0.0 = Full Dielectric, 1.0 = Full Metal 1009 #define AI_MATKEY_METALLIC_FACTOR "$mat.metallicFactor", 0, 0 1010 #define AI_MATKEY_METALLIC_TEXTURE aiTextureType_METALNESS, 0 1011 #define AI_MATKEY_USE_ROUGHNESS_MAP "$mat.useRoughnessMap", 0, 0 1012 // Roughness factor. 0.0 = Perfectly Smooth, 1.0 = Completely Rough 1013 #define AI_MATKEY_ROUGHNESS_FACTOR "$mat.roughnessFactor", 0, 0 1014 #define AI_MATKEY_ROUGHNESS_TEXTURE aiTextureType_DIFFUSE_ROUGHNESS, 0 1015 // Anisotropy factor. 0.0 = isotropic, 1.0 = anisotropy along tangent direction, 1016 // -1.0 = anisotropy along bitangent direction 1017 #define AI_MATKEY_ANISOTROPY_FACTOR "$mat.anisotropyFactor", 0, 0 1018 1019 // Specular/Glossiness Workflow 1020 // --------------------------- 1021 // Diffuse/Albedo Color. Note: Pure Metals have a diffuse of {0,0,0} 1022 // AI_MATKEY_COLOR_DIFFUSE 1023 // Specular Color. 1024 // Note: Metallic/Roughness may also have a Specular Color 1025 // AI_MATKEY_COLOR_SPECULAR 1026 #define AI_MATKEY_SPECULAR_FACTOR "$mat.specularFactor", 0, 0 1027 // Glossiness factor. 0.0 = Completely Rough, 1.0 = Perfectly Smooth 1028 #define AI_MATKEY_GLOSSINESS_FACTOR "$mat.glossinessFactor", 0, 0 1029 1030 // Sheen 1031 // ----- 1032 // Sheen base RGB color. Default {0,0,0} 1033 #define AI_MATKEY_SHEEN_COLOR_FACTOR "$clr.sheen.factor", 0, 0 1034 // Sheen Roughness Factor. 1035 #define AI_MATKEY_SHEEN_ROUGHNESS_FACTOR "$mat.sheen.roughnessFactor", 0, 0 1036 #define AI_MATKEY_SHEEN_COLOR_TEXTURE aiTextureType_SHEEN, 0 1037 #define AI_MATKEY_SHEEN_ROUGHNESS_TEXTURE aiTextureType_SHEEN, 1 1038 1039 // Clearcoat 1040 // --------- 1041 // Clearcoat layer intensity. 0.0 = none (disabled) 1042 #define AI_MATKEY_CLEARCOAT_FACTOR "$mat.clearcoat.factor", 0, 0 1043 #define AI_MATKEY_CLEARCOAT_ROUGHNESS_FACTOR "$mat.clearcoat.roughnessFactor", 0, 0 1044 #define AI_MATKEY_CLEARCOAT_TEXTURE aiTextureType_CLEARCOAT, 0 1045 #define AI_MATKEY_CLEARCOAT_ROUGHNESS_TEXTURE aiTextureType_CLEARCOAT, 1 1046 #define AI_MATKEY_CLEARCOAT_NORMAL_TEXTURE aiTextureType_CLEARCOAT, 2 1047 1048 // Transmission 1049 // ------------ 1050 // https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_transmission 1051 // Base percentage of light transmitted through the surface. 0.0 = Opaque, 1.0 = Fully transparent 1052 #define AI_MATKEY_TRANSMISSION_FACTOR "$mat.transmission.factor", 0, 0 1053 // Texture defining percentage of light transmitted through the surface. 1054 // Multiplied by AI_MATKEY_TRANSMISSION_FACTOR 1055 #define AI_MATKEY_TRANSMISSION_TEXTURE aiTextureType_TRANSMISSION, 0 1056 1057 // Volume 1058 // ------------ 1059 // https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_volume 1060 // 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. 1061 #define AI_MATKEY_VOLUME_THICKNESS_FACTOR "$mat.volume.thicknessFactor", 0, 0 1062 // Texture that defines the thickness. 1063 // Multiplied by AI_MATKEY_THICKNESS_FACTOR 1064 #define AI_MATKEY_VOLUME_THICKNESS_TEXTURE aiTextureType_TRANSMISSION, 1 1065 // Density of the medium given as the average distance that light travels in the medium before interacting with a particle. 1066 #define AI_MATKEY_VOLUME_ATTENUATION_DISTANCE "$mat.volume.attenuationDistance", 0, 0 1067 // The color that white light turns into due to absorption when reaching the attenuation distance. 1068 #define AI_MATKEY_VOLUME_ATTENUATION_COLOR "$mat.volume.attenuationColor", 0, 0 1069 1070 // Emissive 1071 // -------- 1072 #define AI_MATKEY_USE_EMISSIVE_MAP "$mat.useEmissiveMap", 0, 0 1073 #define AI_MATKEY_EMISSIVE_INTENSITY "$mat.emissiveIntensity", 0, 0 1074 #define AI_MATKEY_USE_AO_MAP "$mat.useAOMap", 0, 0 1075 1076 // --------------------------------------------------------------------------- 1077 // Pure key names for all texture-related properties 1078 //! @cond MATS_DOC_FULL 1079 #define _AI_MATKEY_TEXTURE_BASE "$tex.file" 1080 #define _AI_MATKEY_UVWSRC_BASE "$tex.uvwsrc" 1081 #define _AI_MATKEY_TEXOP_BASE "$tex.op" 1082 #define _AI_MATKEY_MAPPING_BASE "$tex.mapping" 1083 #define _AI_MATKEY_TEXBLEND_BASE "$tex.blend" 1084 #define _AI_MATKEY_MAPPINGMODE_U_BASE "$tex.mapmodeu" 1085 #define _AI_MATKEY_MAPPINGMODE_V_BASE "$tex.mapmodev" 1086 #define _AI_MATKEY_TEXMAP_AXIS_BASE "$tex.mapaxis" 1087 #define _AI_MATKEY_UVTRANSFORM_BASE "$tex.uvtrafo" 1088 #define _AI_MATKEY_TEXFLAGS_BASE "$tex.flags" 1089 //! @endcond 1090 1091 // --------------------------------------------------------------------------- 1092 #define AI_MATKEY_TEXTURE(type, N) _AI_MATKEY_TEXTURE_BASE, type, N 1093 1094 // For backward compatibility and simplicity 1095 //! @cond MATS_DOC_FULL 1096 #define AI_MATKEY_TEXTURE_DIFFUSE(N) \ 1097 AI_MATKEY_TEXTURE(aiTextureType_DIFFUSE, N) 1098 1099 #define AI_MATKEY_TEXTURE_SPECULAR(N) \ 1100 AI_MATKEY_TEXTURE(aiTextureType_SPECULAR, N) 1101 1102 #define AI_MATKEY_TEXTURE_AMBIENT(N) \ 1103 AI_MATKEY_TEXTURE(aiTextureType_AMBIENT, N) 1104 1105 #define AI_MATKEY_TEXTURE_EMISSIVE(N) \ 1106 AI_MATKEY_TEXTURE(aiTextureType_EMISSIVE, N) 1107 1108 #define AI_MATKEY_TEXTURE_NORMALS(N) \ 1109 AI_MATKEY_TEXTURE(aiTextureType_NORMALS, N) 1110 1111 #define AI_MATKEY_TEXTURE_HEIGHT(N) \ 1112 AI_MATKEY_TEXTURE(aiTextureType_HEIGHT, N) 1113 1114 #define AI_MATKEY_TEXTURE_SHININESS(N) \ 1115 AI_MATKEY_TEXTURE(aiTextureType_SHININESS, N) 1116 1117 #define AI_MATKEY_TEXTURE_OPACITY(N) \ 1118 AI_MATKEY_TEXTURE(aiTextureType_OPACITY, N) 1119 1120 #define AI_MATKEY_TEXTURE_DISPLACEMENT(N) \ 1121 AI_MATKEY_TEXTURE(aiTextureType_DISPLACEMENT, N) 1122 1123 #define AI_MATKEY_TEXTURE_LIGHTMAP(N) \ 1124 AI_MATKEY_TEXTURE(aiTextureType_LIGHTMAP, N) 1125 1126 #define AI_MATKEY_TEXTURE_REFLECTION(N) \ 1127 AI_MATKEY_TEXTURE(aiTextureType_REFLECTION, N) 1128 1129 //! @endcond 1130 1131 // --------------------------------------------------------------------------- 1132 #define AI_MATKEY_UVWSRC(type, N) _AI_MATKEY_UVWSRC_BASE, type, N 1133 1134 // For backward compatibility and simplicity 1135 //! @cond MATS_DOC_FULL 1136 #define AI_MATKEY_UVWSRC_DIFFUSE(N) \ 1137 AI_MATKEY_UVWSRC(aiTextureType_DIFFUSE, N) 1138 1139 #define AI_MATKEY_UVWSRC_SPECULAR(N) \ 1140 AI_MATKEY_UVWSRC(aiTextureType_SPECULAR, N) 1141 1142 #define AI_MATKEY_UVWSRC_AMBIENT(N) \ 1143 AI_MATKEY_UVWSRC(aiTextureType_AMBIENT, N) 1144 1145 #define AI_MATKEY_UVWSRC_EMISSIVE(N) \ 1146 AI_MATKEY_UVWSRC(aiTextureType_EMISSIVE, N) 1147 1148 #define AI_MATKEY_UVWSRC_NORMALS(N) \ 1149 AI_MATKEY_UVWSRC(aiTextureType_NORMALS, N) 1150 1151 #define AI_MATKEY_UVWSRC_HEIGHT(N) \ 1152 AI_MATKEY_UVWSRC(aiTextureType_HEIGHT, N) 1153 1154 #define AI_MATKEY_UVWSRC_SHININESS(N) \ 1155 AI_MATKEY_UVWSRC(aiTextureType_SHININESS, N) 1156 1157 #define AI_MATKEY_UVWSRC_OPACITY(N) \ 1158 AI_MATKEY_UVWSRC(aiTextureType_OPACITY, N) 1159 1160 #define AI_MATKEY_UVWSRC_DISPLACEMENT(N) \ 1161 AI_MATKEY_UVWSRC(aiTextureType_DISPLACEMENT, N) 1162 1163 #define AI_MATKEY_UVWSRC_LIGHTMAP(N) \ 1164 AI_MATKEY_UVWSRC(aiTextureType_LIGHTMAP, N) 1165 1166 #define AI_MATKEY_UVWSRC_REFLECTION(N) \ 1167 AI_MATKEY_UVWSRC(aiTextureType_REFLECTION, N) 1168 1169 //! @endcond 1170 // --------------------------------------------------------------------------- 1171 #define AI_MATKEY_TEXOP(type, N) _AI_MATKEY_TEXOP_BASE, type, N 1172 1173 // For backward compatibility and simplicity 1174 //! @cond MATS_DOC_FULL 1175 #define AI_MATKEY_TEXOP_DIFFUSE(N) \ 1176 AI_MATKEY_TEXOP(aiTextureType_DIFFUSE, N) 1177 1178 #define AI_MATKEY_TEXOP_SPECULAR(N) \ 1179 AI_MATKEY_TEXOP(aiTextureType_SPECULAR, N) 1180 1181 #define AI_MATKEY_TEXOP_AMBIENT(N) \ 1182 AI_MATKEY_TEXOP(aiTextureType_AMBIENT, N) 1183 1184 #define AI_MATKEY_TEXOP_EMISSIVE(N) \ 1185 AI_MATKEY_TEXOP(aiTextureType_EMISSIVE, N) 1186 1187 #define AI_MATKEY_TEXOP_NORMALS(N) \ 1188 AI_MATKEY_TEXOP(aiTextureType_NORMALS, N) 1189 1190 #define AI_MATKEY_TEXOP_HEIGHT(N) \ 1191 AI_MATKEY_TEXOP(aiTextureType_HEIGHT, N) 1192 1193 #define AI_MATKEY_TEXOP_SHININESS(N) \ 1194 AI_MATKEY_TEXOP(aiTextureType_SHININESS, N) 1195 1196 #define AI_MATKEY_TEXOP_OPACITY(N) \ 1197 AI_MATKEY_TEXOP(aiTextureType_OPACITY, N) 1198 1199 #define AI_MATKEY_TEXOP_DISPLACEMENT(N) \ 1200 AI_MATKEY_TEXOP(aiTextureType_DISPLACEMENT, N) 1201 1202 #define AI_MATKEY_TEXOP_LIGHTMAP(N) \ 1203 AI_MATKEY_TEXOP(aiTextureType_LIGHTMAP, N) 1204 1205 #define AI_MATKEY_TEXOP_REFLECTION(N) \ 1206 AI_MATKEY_TEXOP(aiTextureType_REFLECTION, N) 1207 1208 //! @endcond 1209 // --------------------------------------------------------------------------- 1210 #define AI_MATKEY_MAPPING(type, N) _AI_MATKEY_MAPPING_BASE, type, N 1211 1212 // For backward compatibility and simplicity 1213 //! @cond MATS_DOC_FULL 1214 #define AI_MATKEY_MAPPING_DIFFUSE(N) \ 1215 AI_MATKEY_MAPPING(aiTextureType_DIFFUSE, N) 1216 1217 #define AI_MATKEY_MAPPING_SPECULAR(N) \ 1218 AI_MATKEY_MAPPING(aiTextureType_SPECULAR, N) 1219 1220 #define AI_MATKEY_MAPPING_AMBIENT(N) \ 1221 AI_MATKEY_MAPPING(aiTextureType_AMBIENT, N) 1222 1223 #define AI_MATKEY_MAPPING_EMISSIVE(N) \ 1224 AI_MATKEY_MAPPING(aiTextureType_EMISSIVE, N) 1225 1226 #define AI_MATKEY_MAPPING_NORMALS(N) \ 1227 AI_MATKEY_MAPPING(aiTextureType_NORMALS, N) 1228 1229 #define AI_MATKEY_MAPPING_HEIGHT(N) \ 1230 AI_MATKEY_MAPPING(aiTextureType_HEIGHT, N) 1231 1232 #define AI_MATKEY_MAPPING_SHININESS(N) \ 1233 AI_MATKEY_MAPPING(aiTextureType_SHININESS, N) 1234 1235 #define AI_MATKEY_MAPPING_OPACITY(N) \ 1236 AI_MATKEY_MAPPING(aiTextureType_OPACITY, N) 1237 1238 #define AI_MATKEY_MAPPING_DISPLACEMENT(N) \ 1239 AI_MATKEY_MAPPING(aiTextureType_DISPLACEMENT, N) 1240 1241 #define AI_MATKEY_MAPPING_LIGHTMAP(N) \ 1242 AI_MATKEY_MAPPING(aiTextureType_LIGHTMAP, N) 1243 1244 #define AI_MATKEY_MAPPING_REFLECTION(N) \ 1245 AI_MATKEY_MAPPING(aiTextureType_REFLECTION, N) 1246 1247 //! @endcond 1248 // --------------------------------------------------------------------------- 1249 #define AI_MATKEY_TEXBLEND(type, N) _AI_MATKEY_TEXBLEND_BASE, type, N 1250 1251 // For backward compatibility and simplicity 1252 //! @cond MATS_DOC_FULL 1253 #define AI_MATKEY_TEXBLEND_DIFFUSE(N) \ 1254 AI_MATKEY_TEXBLEND(aiTextureType_DIFFUSE, N) 1255 1256 #define AI_MATKEY_TEXBLEND_SPECULAR(N) \ 1257 AI_MATKEY_TEXBLEND(aiTextureType_SPECULAR, N) 1258 1259 #define AI_MATKEY_TEXBLEND_AMBIENT(N) \ 1260 AI_MATKEY_TEXBLEND(aiTextureType_AMBIENT, N) 1261 1262 #define AI_MATKEY_TEXBLEND_EMISSIVE(N) \ 1263 AI_MATKEY_TEXBLEND(aiTextureType_EMISSIVE, N) 1264 1265 #define AI_MATKEY_TEXBLEND_NORMALS(N) \ 1266 AI_MATKEY_TEXBLEND(aiTextureType_NORMALS, N) 1267 1268 #define AI_MATKEY_TEXBLEND_HEIGHT(N) \ 1269 AI_MATKEY_TEXBLEND(aiTextureType_HEIGHT, N) 1270 1271 #define AI_MATKEY_TEXBLEND_SHININESS(N) \ 1272 AI_MATKEY_TEXBLEND(aiTextureType_SHININESS, N) 1273 1274 #define AI_MATKEY_TEXBLEND_OPACITY(N) \ 1275 AI_MATKEY_TEXBLEND(aiTextureType_OPACITY, N) 1276 1277 #define AI_MATKEY_TEXBLEND_DISPLACEMENT(N) \ 1278 AI_MATKEY_TEXBLEND(aiTextureType_DISPLACEMENT, N) 1279 1280 #define AI_MATKEY_TEXBLEND_LIGHTMAP(N) \ 1281 AI_MATKEY_TEXBLEND(aiTextureType_LIGHTMAP, N) 1282 1283 #define AI_MATKEY_TEXBLEND_REFLECTION(N) \ 1284 AI_MATKEY_TEXBLEND(aiTextureType_REFLECTION, N) 1285 1286 //! @endcond 1287 // --------------------------------------------------------------------------- 1288 #define AI_MATKEY_MAPPINGMODE_U(type, N) _AI_MATKEY_MAPPINGMODE_U_BASE, type, N 1289 1290 // For backward compatibility and simplicity 1291 //! @cond MATS_DOC_FULL 1292 #define AI_MATKEY_MAPPINGMODE_U_DIFFUSE(N) \ 1293 AI_MATKEY_MAPPINGMODE_U(aiTextureType_DIFFUSE, N) 1294 1295 #define AI_MATKEY_MAPPINGMODE_U_SPECULAR(N) \ 1296 AI_MATKEY_MAPPINGMODE_U(aiTextureType_SPECULAR, N) 1297 1298 #define AI_MATKEY_MAPPINGMODE_U_AMBIENT(N) \ 1299 AI_MATKEY_MAPPINGMODE_U(aiTextureType_AMBIENT, N) 1300 1301 #define AI_MATKEY_MAPPINGMODE_U_EMISSIVE(N) \ 1302 AI_MATKEY_MAPPINGMODE_U(aiTextureType_EMISSIVE, N) 1303 1304 #define AI_MATKEY_MAPPINGMODE_U_NORMALS(N) \ 1305 AI_MATKEY_MAPPINGMODE_U(aiTextureType_NORMALS, N) 1306 1307 #define AI_MATKEY_MAPPINGMODE_U_HEIGHT(N) \ 1308 AI_MATKEY_MAPPINGMODE_U(aiTextureType_HEIGHT, N) 1309 1310 #define AI_MATKEY_MAPPINGMODE_U_SHININESS(N) \ 1311 AI_MATKEY_MAPPINGMODE_U(aiTextureType_SHININESS, N) 1312 1313 #define AI_MATKEY_MAPPINGMODE_U_OPACITY(N) \ 1314 AI_MATKEY_MAPPINGMODE_U(aiTextureType_OPACITY, N) 1315 1316 #define AI_MATKEY_MAPPINGMODE_U_DISPLACEMENT(N) \ 1317 AI_MATKEY_MAPPINGMODE_U(aiTextureType_DISPLACEMENT, N) 1318 1319 #define AI_MATKEY_MAPPINGMODE_U_LIGHTMAP(N) \ 1320 AI_MATKEY_MAPPINGMODE_U(aiTextureType_LIGHTMAP, N) 1321 1322 #define AI_MATKEY_MAPPINGMODE_U_REFLECTION(N) \ 1323 AI_MATKEY_MAPPINGMODE_U(aiTextureType_REFLECTION, N) 1324 1325 //! @endcond 1326 // --------------------------------------------------------------------------- 1327 #define AI_MATKEY_MAPPINGMODE_V(type, N) _AI_MATKEY_MAPPINGMODE_V_BASE, type, N 1328 1329 // For backward compatibility and simplicity 1330 //! @cond MATS_DOC_FULL 1331 #define AI_MATKEY_MAPPINGMODE_V_DIFFUSE(N) \ 1332 AI_MATKEY_MAPPINGMODE_V(aiTextureType_DIFFUSE, N) 1333 1334 #define AI_MATKEY_MAPPINGMODE_V_SPECULAR(N) \ 1335 AI_MATKEY_MAPPINGMODE_V(aiTextureType_SPECULAR, N) 1336 1337 #define AI_MATKEY_MAPPINGMODE_V_AMBIENT(N) \ 1338 AI_MATKEY_MAPPINGMODE_V(aiTextureType_AMBIENT, N) 1339 1340 #define AI_MATKEY_MAPPINGMODE_V_EMISSIVE(N) \ 1341 AI_MATKEY_MAPPINGMODE_V(aiTextureType_EMISSIVE, N) 1342 1343 #define AI_MATKEY_MAPPINGMODE_V_NORMALS(N) \ 1344 AI_MATKEY_MAPPINGMODE_V(aiTextureType_NORMALS, N) 1345 1346 #define AI_MATKEY_MAPPINGMODE_V_HEIGHT(N) \ 1347 AI_MATKEY_MAPPINGMODE_V(aiTextureType_HEIGHT, N) 1348 1349 #define AI_MATKEY_MAPPINGMODE_V_SHININESS(N) \ 1350 AI_MATKEY_MAPPINGMODE_V(aiTextureType_SHININESS, N) 1351 1352 #define AI_MATKEY_MAPPINGMODE_V_OPACITY(N) \ 1353 AI_MATKEY_MAPPINGMODE_V(aiTextureType_OPACITY, N) 1354 1355 #define AI_MATKEY_MAPPINGMODE_V_DISPLACEMENT(N) \ 1356 AI_MATKEY_MAPPINGMODE_V(aiTextureType_DISPLACEMENT, N) 1357 1358 #define AI_MATKEY_MAPPINGMODE_V_LIGHTMAP(N) \ 1359 AI_MATKEY_MAPPINGMODE_V(aiTextureType_LIGHTMAP, N) 1360 1361 #define AI_MATKEY_MAPPINGMODE_V_REFLECTION(N) \ 1362 AI_MATKEY_MAPPINGMODE_V(aiTextureType_REFLECTION, N) 1363 1364 //! @endcond 1365 // --------------------------------------------------------------------------- 1366 #define AI_MATKEY_TEXMAP_AXIS(type, N) _AI_MATKEY_TEXMAP_AXIS_BASE, type, N 1367 1368 // For backward compatibility and simplicity 1369 //! @cond MATS_DOC_FULL 1370 #define AI_MATKEY_TEXMAP_AXIS_DIFFUSE(N) \ 1371 AI_MATKEY_TEXMAP_AXIS(aiTextureType_DIFFUSE, N) 1372 1373 #define AI_MATKEY_TEXMAP_AXIS_SPECULAR(N) \ 1374 AI_MATKEY_TEXMAP_AXIS(aiTextureType_SPECULAR, N) 1375 1376 #define AI_MATKEY_TEXMAP_AXIS_AMBIENT(N) \ 1377 AI_MATKEY_TEXMAP_AXIS(aiTextureType_AMBIENT, N) 1378 1379 #define AI_MATKEY_TEXMAP_AXIS_EMISSIVE(N) \ 1380 AI_MATKEY_TEXMAP_AXIS(aiTextureType_EMISSIVE, N) 1381 1382 #define AI_MATKEY_TEXMAP_AXIS_NORMALS(N) \ 1383 AI_MATKEY_TEXMAP_AXIS(aiTextureType_NORMALS, N) 1384 1385 #define AI_MATKEY_TEXMAP_AXIS_HEIGHT(N) \ 1386 AI_MATKEY_TEXMAP_AXIS(aiTextureType_HEIGHT, N) 1387 1388 #define AI_MATKEY_TEXMAP_AXIS_SHININESS(N) \ 1389 AI_MATKEY_TEXMAP_AXIS(aiTextureType_SHININESS, N) 1390 1391 #define AI_MATKEY_TEXMAP_AXIS_OPACITY(N) \ 1392 AI_MATKEY_TEXMAP_AXIS(aiTextureType_OPACITY, N) 1393 1394 #define AI_MATKEY_TEXMAP_AXIS_DISPLACEMENT(N) \ 1395 AI_MATKEY_TEXMAP_AXIS(aiTextureType_DISPLACEMENT, N) 1396 1397 #define AI_MATKEY_TEXMAP_AXIS_LIGHTMAP(N) \ 1398 AI_MATKEY_TEXMAP_AXIS(aiTextureType_LIGHTMAP, N) 1399 1400 #define AI_MATKEY_TEXMAP_AXIS_REFLECTION(N) \ 1401 AI_MATKEY_TEXMAP_AXIS(aiTextureType_REFLECTION, N) 1402 1403 //! @endcond 1404 // --------------------------------------------------------------------------- 1405 #define AI_MATKEY_UVTRANSFORM(type, N) _AI_MATKEY_UVTRANSFORM_BASE, type, N 1406 1407 // For backward compatibility and simplicity 1408 //! @cond MATS_DOC_FULL 1409 #define AI_MATKEY_UVTRANSFORM_DIFFUSE(N) \ 1410 AI_MATKEY_UVTRANSFORM(aiTextureType_DIFFUSE, N) 1411 1412 #define AI_MATKEY_UVTRANSFORM_SPECULAR(N) \ 1413 AI_MATKEY_UVTRANSFORM(aiTextureType_SPECULAR, N) 1414 1415 #define AI_MATKEY_UVTRANSFORM_AMBIENT(N) \ 1416 AI_MATKEY_UVTRANSFORM(aiTextureType_AMBIENT, N) 1417 1418 #define AI_MATKEY_UVTRANSFORM_EMISSIVE(N) \ 1419 AI_MATKEY_UVTRANSFORM(aiTextureType_EMISSIVE, N) 1420 1421 #define AI_MATKEY_UVTRANSFORM_NORMALS(N) \ 1422 AI_MATKEY_UVTRANSFORM(aiTextureType_NORMALS, N) 1423 1424 #define AI_MATKEY_UVTRANSFORM_HEIGHT(N) \ 1425 AI_MATKEY_UVTRANSFORM(aiTextureType_HEIGHT, N) 1426 1427 #define AI_MATKEY_UVTRANSFORM_SHININESS(N) \ 1428 AI_MATKEY_UVTRANSFORM(aiTextureType_SHININESS, N) 1429 1430 #define AI_MATKEY_UVTRANSFORM_OPACITY(N) \ 1431 AI_MATKEY_UVTRANSFORM(aiTextureType_OPACITY, N) 1432 1433 #define AI_MATKEY_UVTRANSFORM_DISPLACEMENT(N) \ 1434 AI_MATKEY_UVTRANSFORM(aiTextureType_DISPLACEMENT, N) 1435 1436 #define AI_MATKEY_UVTRANSFORM_LIGHTMAP(N) \ 1437 AI_MATKEY_UVTRANSFORM(aiTextureType_LIGHTMAP, N) 1438 1439 #define AI_MATKEY_UVTRANSFORM_REFLECTION(N) \ 1440 AI_MATKEY_UVTRANSFORM(aiTextureType_REFLECTION, N) 1441 1442 #define AI_MATKEY_UVTRANSFORM_UNKNOWN(N) \ 1443 AI_MATKEY_UVTRANSFORM(aiTextureType_UNKNOWN, N) 1444 1445 //! @endcond 1446 // --------------------------------------------------------------------------- 1447 #define AI_MATKEY_TEXFLAGS(type, N) _AI_MATKEY_TEXFLAGS_BASE, type, N 1448 1449 // For backward compatibility and simplicity 1450 //! @cond MATS_DOC_FULL 1451 #define AI_MATKEY_TEXFLAGS_DIFFUSE(N) \ 1452 AI_MATKEY_TEXFLAGS(aiTextureType_DIFFUSE, N) 1453 1454 #define AI_MATKEY_TEXFLAGS_SPECULAR(N) \ 1455 AI_MATKEY_TEXFLAGS(aiTextureType_SPECULAR, N) 1456 1457 #define AI_MATKEY_TEXFLAGS_AMBIENT(N) \ 1458 AI_MATKEY_TEXFLAGS(aiTextureType_AMBIENT, N) 1459 1460 #define AI_MATKEY_TEXFLAGS_EMISSIVE(N) \ 1461 AI_MATKEY_TEXFLAGS(aiTextureType_EMISSIVE, N) 1462 1463 #define AI_MATKEY_TEXFLAGS_NORMALS(N) \ 1464 AI_MATKEY_TEXFLAGS(aiTextureType_NORMALS, N) 1465 1466 #define AI_MATKEY_TEXFLAGS_HEIGHT(N) \ 1467 AI_MATKEY_TEXFLAGS(aiTextureType_HEIGHT, N) 1468 1469 #define AI_MATKEY_TEXFLAGS_SHININESS(N) \ 1470 AI_MATKEY_TEXFLAGS(aiTextureType_SHININESS, N) 1471 1472 #define AI_MATKEY_TEXFLAGS_OPACITY(N) \ 1473 AI_MATKEY_TEXFLAGS(aiTextureType_OPACITY, N) 1474 1475 #define AI_MATKEY_TEXFLAGS_DISPLACEMENT(N) \ 1476 AI_MATKEY_TEXFLAGS(aiTextureType_DISPLACEMENT, N) 1477 1478 #define AI_MATKEY_TEXFLAGS_LIGHTMAP(N) \ 1479 AI_MATKEY_TEXFLAGS(aiTextureType_LIGHTMAP, N) 1480 1481 #define AI_MATKEY_TEXFLAGS_REFLECTION(N) \ 1482 AI_MATKEY_TEXFLAGS(aiTextureType_REFLECTION, N) 1483 1484 #define AI_MATKEY_TEXFLAGS_UNKNOWN(N) \ 1485 AI_MATKEY_TEXFLAGS(aiTextureType_UNKNOWN, N) 1486 1487 //! @endcond 1488 //! 1489 // --------------------------------------------------------------------------- 1490 /** @brief Retrieve a material property with a specific key from the material 1491 * 1492 * @param pMat Pointer to the input material. May not be NULL 1493 * @param pKey Key to search for. One of the AI_MATKEY_XXX constants. 1494 * @param type Specifies the type of the texture to be retrieved ( 1495 * e.g. diffuse, specular, height map ...) 1496 * @param index Index of the texture to be retrieved. 1497 * @param pPropOut Pointer to receive a pointer to a valid aiMaterialProperty 1498 * structure or NULL if the key has not been found. */ 1499 // --------------------------------------------------------------------------- 1500 ASSIMP_API C_ENUM aiReturn aiGetMaterialProperty( 1501 const C_STRUCT aiMaterial *pMat, 1502 const char *pKey, 1503 unsigned int type, 1504 unsigned int index, 1505 const C_STRUCT aiMaterialProperty **pPropOut); 1506 1507 // --------------------------------------------------------------------------- 1508 /** @brief Retrieve an array of float values with a specific key 1509 * from the material 1510 * 1511 * Pass one of the AI_MATKEY_XXX constants for the last three parameters (the 1512 * example reads the #AI_MATKEY_UVTRANSFORM property of the first diffuse texture) 1513 * @code 1514 * aiUVTransform trafo; 1515 * unsigned int max = sizeof(aiUVTransform); 1516 * if (AI_SUCCESS != aiGetMaterialFloatArray(mat, AI_MATKEY_UVTRANSFORM(aiTextureType_DIFFUSE,0), 1517 * (float*)&trafo, &max) || sizeof(aiUVTransform) != max) 1518 * { 1519 * // error handling 1520 * } 1521 * @endcode 1522 * 1523 * @param pMat Pointer to the input material. May not be NULL 1524 * @param pKey Key to search for. One of the AI_MATKEY_XXX constants. 1525 * @param pOut Pointer to a buffer to receive the result. 1526 * @param pMax Specifies the size of the given buffer, in float's. 1527 * Receives the number of values (not bytes!) read. 1528 * @param type (see the code sample above) 1529 * @param index (see the code sample above) 1530 * @return Specifies whether the key has been found. If not, the output 1531 * arrays remains unmodified and pMax is set to 0.*/ 1532 // --------------------------------------------------------------------------- 1533 ASSIMP_API C_ENUM aiReturn aiGetMaterialFloatArray( 1534 const C_STRUCT aiMaterial *pMat, 1535 const char *pKey, 1536 unsigned int type, 1537 unsigned int index, 1538 float *pOut, 1539 unsigned int *pMax); 1540 1541 // --------------------------------------------------------------------------- 1542 /** @brief Retrieve a single float property with a specific key from the material. 1543 * 1544 * Pass one of the AI_MATKEY_XXX constants for the last three parameters (the 1545 * example reads the #AI_MATKEY_SHININESS_STRENGTH property of the first diffuse texture) 1546 * @code 1547 * float specStrength = 1.f; // default value, remains unmodified if we fail. 1548 * aiGetMaterialFloat(mat, AI_MATKEY_SHININESS_STRENGTH, 1549 * (float*)&specStrength); 1550 * @endcode 1551 * 1552 * @param pMat Pointer to the input material. May not be NULL 1553 * @param pKey Key to search for. One of the AI_MATKEY_XXX constants. 1554 * @param pOut Receives the output float. 1555 * @param type (see the code sample above) 1556 * @param index (see the code sample above) 1557 * @return Specifies whether the key has been found. If not, the output 1558 * float remains unmodified.*/ 1559 // --------------------------------------------------------------------------- 1560 inline aiReturn aiGetMaterialFloat(const C_STRUCT aiMaterial *pMat, 1561 const char *pKey, 1562 unsigned int type, 1563 unsigned int index, 1564 float *pOut) { 1565 return aiGetMaterialFloatArray(pMat, pKey, type, index, pOut, (unsigned int *)0x0); 1566 } 1567 1568 // --------------------------------------------------------------------------- 1569 /** @brief Retrieve an array of integer values with a specific key 1570 * from a material 1571 * 1572 * See the sample for aiGetMaterialFloatArray for more information.*/ 1573 ASSIMP_API C_ENUM aiReturn aiGetMaterialIntegerArray(const C_STRUCT aiMaterial *pMat, 1574 const char *pKey, 1575 unsigned int type, 1576 unsigned int index, 1577 int *pOut, 1578 unsigned int *pMax); 1579 1580 // --------------------------------------------------------------------------- 1581 /** @brief Retrieve an integer property with a specific key from a material 1582 * 1583 * See the sample for aiGetMaterialFloat for more information.*/ 1584 // --------------------------------------------------------------------------- 1585 inline aiReturn aiGetMaterialInteger(const C_STRUCT aiMaterial *pMat, 1586 const char *pKey, 1587 unsigned int type, 1588 unsigned int index, 1589 int *pOut) { 1590 return aiGetMaterialIntegerArray(pMat, pKey, type, index, pOut, (unsigned int *)0x0); 1591 } 1592 1593 // --------------------------------------------------------------------------- 1594 /** @brief Retrieve a color value from the material property table 1595 * 1596 * See the sample for aiGetMaterialFloat for more information*/ 1597 // --------------------------------------------------------------------------- 1598 ASSIMP_API C_ENUM aiReturn aiGetMaterialColor(const C_STRUCT aiMaterial *pMat, 1599 const char *pKey, 1600 unsigned int type, 1601 unsigned int index, 1602 C_STRUCT aiColor4D *pOut); 1603 1604 // --------------------------------------------------------------------------- 1605 /** @brief Retrieve a aiUVTransform value from the material property table 1606 * 1607 * See the sample for aiGetMaterialFloat for more information*/ 1608 // --------------------------------------------------------------------------- 1609 ASSIMP_API C_ENUM aiReturn aiGetMaterialUVTransform(const C_STRUCT aiMaterial *pMat, 1610 const char *pKey, 1611 unsigned int type, 1612 unsigned int index, 1613 C_STRUCT aiUVTransform *pOut); 1614 1615 // --------------------------------------------------------------------------- 1616 /** @brief Retrieve a string from the material property table 1617 * 1618 * See the sample for aiGetMaterialFloat for more information.*/ 1619 // --------------------------------------------------------------------------- 1620 ASSIMP_API C_ENUM aiReturn aiGetMaterialString(const C_STRUCT aiMaterial *pMat, 1621 const char *pKey, 1622 unsigned int type, 1623 unsigned int index, 1624 C_STRUCT aiString *pOut); 1625 1626 // --------------------------------------------------------------------------- 1627 /** Get the number of textures for a particular texture type. 1628 * @param[in] pMat Pointer to the input material. May not be NULL 1629 * @param type Texture type to check for 1630 * @return Number of textures for this type. 1631 * @note A texture can be easily queried using #aiGetMaterialTexture() */ 1632 // --------------------------------------------------------------------------- 1633 ASSIMP_API unsigned int aiGetMaterialTextureCount(const C_STRUCT aiMaterial *pMat, 1634 C_ENUM aiTextureType type); 1635 1636 // --------------------------------------------------------------------------- 1637 /** @brief Helper function to get all values pertaining to a particular 1638 * texture slot from a material structure. 1639 * 1640 * This function is provided just for convenience. You could also read the 1641 * texture by parsing all of its properties manually. This function bundles 1642 * all of them in a huge function monster. 1643 * 1644 * @param[in] mat Pointer to the input material. May not be NULL 1645 * @param[in] type Specifies the texture stack to read from (e.g. diffuse, 1646 * specular, height map ...). 1647 * @param[in] index Index of the texture. The function fails if the 1648 * requested index is not available for this texture type. 1649 * #aiGetMaterialTextureCount() can be used to determine the number of 1650 * textures in a particular texture stack. 1651 * @param[out] path Receives the output path 1652 * If the texture is embedded, receives a '*' followed by the id of 1653 * the texture (for the textures stored in the corresponding scene) which 1654 * can be converted to an int using a function like atoi. 1655 * This parameter must be non-null. 1656 * @param mapping The texture mapping mode to be used. 1657 * Pass NULL if you're not interested in this information. 1658 * @param[out] uvindex For UV-mapped textures: receives the index of the UV 1659 * source channel. Unmodified otherwise. 1660 * Pass NULL if you're not interested in this information. 1661 * @param[out] blend Receives the blend factor for the texture 1662 * Pass NULL if you're not interested in this information. 1663 * @param[out] op Receives the texture blend operation to be perform between 1664 * this texture and the previous texture. 1665 * Pass NULL if you're not interested in this information. 1666 * @param[out] mapmode Receives the mapping modes to be used for the texture. 1667 * Pass NULL if you're not interested in this information. Otherwise, 1668 * pass a pointer to an array of two aiTextureMapMode's (one for each 1669 * axis, UV order). 1670 * @param[out] flags Receives the the texture flags. 1671 * @return AI_SUCCESS on success, otherwise something else. Have fun.*/ 1672 // --------------------------------------------------------------------------- 1673 #ifdef __cplusplus 1674 ASSIMP_API aiReturn aiGetMaterialTexture(const C_STRUCT aiMaterial *mat, 1675 aiTextureType type, 1676 unsigned int index, 1677 aiString *path, 1678 aiTextureMapping *mapping = NULL, 1679 unsigned int *uvindex = NULL, 1680 ai_real *blend = NULL, 1681 aiTextureOp *op = NULL, 1682 aiTextureMapMode *mapmode = NULL, 1683 unsigned int *flags = NULL); 1684 #else 1685 C_ENUM aiReturn aiGetMaterialTexture(const C_STRUCT aiMaterial *mat, 1686 C_ENUM aiTextureType type, 1687 unsigned int index, 1688 C_STRUCT aiString *path, 1689 C_ENUM aiTextureMapping *mapping /*= NULL*/, 1690 unsigned int *uvindex /*= NULL*/, 1691 ai_real *blend /*= NULL*/, 1692 C_ENUM aiTextureOp *op /*= NULL*/, 1693 C_ENUM aiTextureMapMode *mapmode /*= NULL*/, 1694 unsigned int *flags /*= NULL*/); 1695 #endif // !#ifdef __cplusplus 1696 1697 #ifdef __cplusplus 1698 } 1699 1700 #include "material.inl" 1701 1702 #endif //!__cplusplus 1703 1704 #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 |
![]() ![]() |