vrshoot

view libs/assimp/assimp/material.h @ 0:b2f14e535253

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 01 Feb 2014 19:58:19 +0200
parents
children
line source
1 /*
2 ---------------------------------------------------------------------------
3 Open Asset Import Library (assimp)
4 ---------------------------------------------------------------------------
6 Copyright (c) 2006-2012, assimp team
8 All rights reserved.
10 Redistribution and use of this software in source and binary forms,
11 with or without modification, are permitted provided that the following
12 conditions are met:
14 * Redistributions of source code must retain the above
15 copyright notice, this list of conditions and the
16 following disclaimer.
18 * Redistributions in binary form must reproduce the above
19 copyright notice, this list of conditions and the
20 following disclaimer in the documentation and/or other
21 materials provided with the distribution.
23 * Neither the name of the assimp team, nor the names of its
24 contributors may be used to endorse or promote products
25 derived from this software without specific prior
26 written permission of the assimp team.
28 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 ---------------------------------------------------------------------------
40 */
42 /** @file material.h
43 * @brief Defines the material system of the library
44 */
46 #ifndef AI_MATERIAL_H_INC
47 #define AI_MATERIAL_H_INC
49 #include "types.h"
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
55 // Name for default materials (2nd is used if meshes have UV coords)
56 #define AI_DEFAULT_MATERIAL_NAME "DefaultMaterial"
58 // ---------------------------------------------------------------------------
59 /** @brief Defines how the Nth texture of a specific type is combined with
60 * the result of all previous layers.
61 *
62 * Example (left: key, right: value): <br>
63 * @code
64 * DiffColor0 - gray
65 * DiffTextureOp0 - aiTextureOpMultiply
66 * DiffTexture0 - tex1.png
67 * DiffTextureOp0 - aiTextureOpAdd
68 * DiffTexture1 - tex2.png
69 * @endcode
70 * Written as equation, the final diffuse term for a specific pixel would be:
71 * @code
72 * diffFinal = DiffColor0 * sampleTex(DiffTexture0,UV0) +
73 * sampleTex(DiffTexture1,UV0) * diffContrib;
74 * @endcode
75 * where 'diffContrib' is the intensity of the incoming light for that pixel.
76 */
77 enum aiTextureOp
78 {
79 /** T = T1 * T2 */
80 aiTextureOp_Multiply = 0x0,
82 /** T = T1 + T2 */
83 aiTextureOp_Add = 0x1,
85 /** T = T1 - T2 */
86 aiTextureOp_Subtract = 0x2,
88 /** T = T1 / T2 */
89 aiTextureOp_Divide = 0x3,
91 /** T = (T1 + T2) - (T1 * T2) */
92 aiTextureOp_SmoothAdd = 0x4,
94 /** T = T1 + (T2-0.5) */
95 aiTextureOp_SignedAdd = 0x5,
98 /** @cond never
99 * This value is not used. It forces the compiler to use at least
100 * 32 Bit integers to represent this enum.
101 */
102 #ifndef SWIG
103 _aiTextureOp_Force32Bit = INT_MAX
104 #endif
105 //! @endcond
106 };
108 // ---------------------------------------------------------------------------
109 /** @brief Defines how UV coordinates outside the [0...1] range are handled.
110 *
111 * Commonly refered to as 'wrapping mode'.
112 */
113 enum aiTextureMapMode
114 {
115 /** A texture coordinate u|v is translated to u%1|v%1
116 */
117 aiTextureMapMode_Wrap = 0x0,
119 /** Texture coordinates outside [0...1]
120 * are clamped to the nearest valid value.
121 */
122 aiTextureMapMode_Clamp = 0x1,
124 /** If the texture coordinates for a pixel are outside [0...1]
125 * the texture is not applied to that pixel
126 */
127 aiTextureMapMode_Decal = 0x3,
129 /** A texture coordinate u|v becomes u%1|v%1 if (u-(u%1))%2 is zero and
130 * 1-(u%1)|1-(v%1) otherwise
131 */
132 aiTextureMapMode_Mirror = 0x2,
134 /** @cond never
135 * This value is not used. It forces the compiler to use at least
136 * 32 Bit integers to represent this enum.
137 */
138 #ifndef SWIG
139 _aiTextureMapMode_Force32Bit = INT_MAX
140 #endif
141 //! @endcond
142 };
144 // ---------------------------------------------------------------------------
145 /** @brief Defines how the mapping coords for a texture are generated.
146 *
147 * Real-time applications typically require full UV coordinates, so the use of
148 * the aiProcess_GenUVCoords step is highly recommended. It generates proper
149 * UV channels for non-UV mapped objects, as long as an accurate description
150 * how the mapping should look like (e.g spherical) is given.
151 * See the #AI_MATKEY_MAPPING property for more details.
152 */
153 enum aiTextureMapping
154 {
155 /** The mapping coordinates are taken from an UV channel.
156 *
157 * The #AI_MATKEY_UVWSRC key specifies from which UV channel
158 * the texture coordinates are to be taken from (remember,
159 * meshes can have more than one UV channel).
160 */
161 aiTextureMapping_UV = 0x0,
163 /** Spherical mapping */
164 aiTextureMapping_SPHERE = 0x1,
166 /** Cylindrical mapping */
167 aiTextureMapping_CYLINDER = 0x2,
169 /** Cubic mapping */
170 aiTextureMapping_BOX = 0x3,
172 /** Planar mapping */
173 aiTextureMapping_PLANE = 0x4,
175 /** Undefined mapping. Have fun. */
176 aiTextureMapping_OTHER = 0x5,
179 /** @cond never
180 * This value is not used. It forces the compiler to use at least
181 * 32 Bit integers to represent this enum.
182 */
183 #ifndef SWIG
184 _aiTextureMapping_Force32Bit = INT_MAX
185 #endif
186 //! @endcond
187 };
189 // ---------------------------------------------------------------------------
190 /** @brief Defines the purpose of a texture
191 *
192 * This is a very difficult topic. Different 3D packages support different
193 * kinds of textures. For very common texture types, such as bumpmaps, the
194 * rendering results depend on implementation details in the rendering
195 * pipelines of these applications. Assimp loads all texture references from
196 * the model file and tries to determine which of the predefined texture
197 * types below is the best choice to match the original use of the texture
198 * as closely as possible.<br>
199 *
200 * In content pipelines you'll usually define how textures have to be handled,
201 * and the artists working on models have to conform to this specification,
202 * regardless which 3D tool they're using.
203 */
204 enum aiTextureType
205 {
206 /** Dummy value.
207 *
208 * No texture, but the value to be used as 'texture semantic'
209 * (#aiMaterialProperty::mSemantic) for all material properties
210 * *not* related to textures.
211 */
212 aiTextureType_NONE = 0x0,
216 /** The texture is combined with the result of the diffuse
217 * lighting equation.
218 */
219 aiTextureType_DIFFUSE = 0x1,
221 /** The texture is combined with the result of the specular
222 * lighting equation.
223 */
224 aiTextureType_SPECULAR = 0x2,
226 /** The texture is combined with the result of the ambient
227 * lighting equation.
228 */
229 aiTextureType_AMBIENT = 0x3,
231 /** The texture is added to the result of the lighting
232 * calculation. It isn't influenced by incoming light.
233 */
234 aiTextureType_EMISSIVE = 0x4,
236 /** The texture is a height map.
237 *
238 * By convention, higher gray-scale values stand for
239 * higher elevations from the base height.
240 */
241 aiTextureType_HEIGHT = 0x5,
243 /** The texture is a (tangent space) normal-map.
244 *
245 * Again, there are several conventions for tangent-space
246 * normal maps. Assimp does (intentionally) not
247 * distinguish here.
248 */
249 aiTextureType_NORMALS = 0x6,
251 /** The texture defines the glossiness of the material.
252 *
253 * The glossiness is in fact the exponent of the specular
254 * (phong) lighting equation. Usually there is a conversion
255 * function defined to map the linear color values in the
256 * texture to a suitable exponent. Have fun.
257 */
258 aiTextureType_SHININESS = 0x7,
260 /** The texture defines per-pixel opacity.
261 *
262 * Usually 'white' means opaque and 'black' means
263 * 'transparency'. Or quite the opposite. Have fun.
264 */
265 aiTextureType_OPACITY = 0x8,
267 /** Displacement texture
268 *
269 * The exact purpose and format is application-dependent.
270 * Higher color values stand for higher vertex displacements.
271 */
272 aiTextureType_DISPLACEMENT = 0x9,
274 /** Lightmap texture (aka Ambient Occlusion)
275 *
276 * Both 'Lightmaps' and dedicated 'ambient occlusion maps' are
277 * covered by this material property. The texture contains a
278 * scaling value for the final color value of a pixel. Its
279 * intensity is not affected by incoming light.
280 */
281 aiTextureType_LIGHTMAP = 0xA,
283 /** Reflection texture
284 *
285 * Contains the color of a perfect mirror reflection.
286 * Rarely used, almost never for real-time applications.
287 */
288 aiTextureType_REFLECTION = 0xB,
290 /** Unknown texture
291 *
292 * A texture reference that does not match any of the definitions
293 * above is considered to be 'unknown'. It is still imported,
294 * but is excluded from any further postprocessing.
295 */
296 aiTextureType_UNKNOWN = 0xC,
299 /** @cond never
300 * This value is not used. It forces the compiler to use at least
301 * 32 Bit integers to represent this enum.
302 */
303 #ifndef SWIG
304 _aiTextureType_Force32Bit = INT_MAX
305 #endif
306 //! @endcond
307 };
309 #define AI_TEXTURE_TYPE_MAX aiTextureType_UNKNOWN
311 // ---------------------------------------------------------------------------
312 /** @brief Defines all shading models supported by the library
313 *
314 * The list of shading modes has been taken from Blender.
315 * See Blender documentation for more information. The API does
316 * not distinguish between "specular" and "diffuse" shaders (thus the
317 * specular term for diffuse shading models like Oren-Nayar remains
318 * undefined). <br>
319 * Again, this value is just a hint. Assimp tries to select the shader whose
320 * most common implementation matches the original rendering results of the
321 * 3D modeller which wrote a particular model as closely as possible.
322 */
323 enum aiShadingMode
324 {
325 /** Flat shading. Shading is done on per-face base,
326 * diffuse only. Also known as 'faceted shading'.
327 */
328 aiShadingMode_Flat = 0x1,
330 /** Simple Gouraud shading.
331 */
332 aiShadingMode_Gouraud = 0x2,
334 /** Phong-Shading -
335 */
336 aiShadingMode_Phong = 0x3,
338 /** Phong-Blinn-Shading
339 */
340 aiShadingMode_Blinn = 0x4,
342 /** Toon-Shading per pixel
343 *
344 * Also known as 'comic' shader.
345 */
346 aiShadingMode_Toon = 0x5,
348 /** OrenNayar-Shading per pixel
349 *
350 * Extension to standard Lambertian shading, taking the
351 * roughness of the material into account
352 */
353 aiShadingMode_OrenNayar = 0x6,
355 /** Minnaert-Shading per pixel
356 *
357 * Extension to standard Lambertian shading, taking the
358 * "darkness" of the material into account
359 */
360 aiShadingMode_Minnaert = 0x7,
362 /** CookTorrance-Shading per pixel
363 *
364 * Special shader for metallic surfaces.
365 */
366 aiShadingMode_CookTorrance = 0x8,
368 /** No shading at all. Constant light influence of 1.0.
369 */
370 aiShadingMode_NoShading = 0x9,
372 /** Fresnel shading
373 */
374 aiShadingMode_Fresnel = 0xa,
377 /** @cond never
378 * This value is not used. It forces the compiler to use at least
379 * 32 Bit integers to represent this enum.
380 */
381 #ifndef SWIG
382 _aiShadingMode_Force32Bit = INT_MAX
383 #endif
384 //! @endcond
385 };
388 // ---------------------------------------------------------------------------
389 /** @brief Defines some mixed flags for a particular texture.
390 *
391 * Usually you'll instruct your cg artists how textures have to look like ...
392 * and how they will be processed in your application. However, if you use
393 * Assimp for completely generic loading purposes you might also need to
394 * process these flags in order to display as many 'unknown' 3D models as
395 * possible correctly.
396 *
397 * This corresponds to the #AI_MATKEY_TEXFLAGS property.
398 */
399 enum aiTextureFlags
400 {
401 /** The texture's color values have to be inverted (componentwise 1-n)
402 */
403 aiTextureFlags_Invert = 0x1,
405 /** Explicit request to the application to process the alpha channel
406 * of the texture.
407 *
408 * Mutually exclusive with #aiTextureFlags_IgnoreAlpha. These
409 * flags are set if the library can say for sure that the alpha
410 * channel is used/is not used. If the model format does not
411 * define this, it is left to the application to decide whether
412 * the texture alpha channel - if any - is evaluated or not.
413 */
414 aiTextureFlags_UseAlpha = 0x2,
416 /** Explicit request to the application to ignore the alpha channel
417 * of the texture.
418 *
419 * Mutually exclusive with #aiTextureFlags_UseAlpha.
420 */
421 aiTextureFlags_IgnoreAlpha = 0x4,
423 /** @cond never
424 * This value is not used. It forces the compiler to use at least
425 * 32 Bit integers to represent this enum.
426 */
427 #ifndef SWIG
428 _aiTextureFlags_Force32Bit = INT_MAX
429 #endif
430 //! @endcond
431 };
434 // ---------------------------------------------------------------------------
435 /** @brief Defines alpha-blend flags.
436 *
437 * If you're familiar with OpenGL or D3D, these flags aren't new to you.
438 * They define *how* the final color value of a pixel is computed, basing
439 * on the previous color at that pixel and the new color value from the
440 * material.
441 * The blend formula is:
442 * @code
443 * SourceColor * SourceBlend + DestColor * DestBlend
444 * @endcode
445 * where <DestColor> is the previous color in the framebuffer at this
446 * position and <SourceColor> is the material colro before the transparency
447 * calculation.<br>
448 * This corresponds to the #AI_MATKEY_BLEND_FUNC property.
449 */
450 enum aiBlendMode
451 {
452 /**
453 * Formula:
454 * @code
455 * SourceColor*SourceAlpha + DestColor*(1-SourceAlpha)
456 * @endcode
457 */
458 aiBlendMode_Default = 0x0,
460 /** Additive blending
461 *
462 * Formula:
463 * @code
464 * SourceColor*1 + DestColor*1
465 * @endcode
466 */
467 aiBlendMode_Additive = 0x1,
469 // we don't need more for the moment, but we might need them
470 // in future versions ...
472 /** @cond never
473 * This value is not used. It forces the compiler to use at least
474 * 32 Bit integers to represent this enum.
475 */
476 #ifndef SWIG
477 _aiBlendMode_Force32Bit = INT_MAX
478 #endif
479 //! @endcond
480 };
483 #include "./Compiler/pushpack1.h"
485 // ---------------------------------------------------------------------------
486 /** @brief Defines how an UV channel is transformed.
487 *
488 * This is just a helper structure for the #AI_MATKEY_UVTRANSFORM key.
489 * See its documentation for more details.
490 *
491 * Typically you'll want to build a matrix of this information. However,
492 * we keep separate scaling/translation/rotation values to make it
493 * easier to process and optimize UV transformations internally.
494 */
495 struct aiUVTransform
496 {
497 /** Translation on the u and v axes.
498 *
499 * The default value is (0|0).
500 */
501 C_STRUCT aiVector2D mTranslation;
503 /** Scaling on the u and v axes.
504 *
505 * The default value is (1|1).
506 */
507 C_STRUCT aiVector2D mScaling;
509 /** Rotation - in counter-clockwise direction.
510 *
511 * The rotation angle is specified in radians. The
512 * rotation center is 0.5f|0.5f. The default value
513 * 0.f.
514 */
515 float mRotation;
518 #ifdef __cplusplus
519 aiUVTransform()
520 : mScaling (1.f,1.f)
521 , mRotation (0.f)
522 {
523 // nothing to be done here ...
524 }
525 #endif
527 } PACK_STRUCT;
529 #include "./Compiler/poppack1.h"
531 //! @cond AI_DOX_INCLUDE_INTERNAL
532 // ---------------------------------------------------------------------------
533 /** @brief A very primitive RTTI system for the contents of material
534 * properties.
535 */
536 enum aiPropertyTypeInfo
537 {
538 /** Array of single-precision (32 Bit) floats
539 *
540 * It is possible to use aiGetMaterialInteger[Array]() (or the C++-API
541 * aiMaterial::Get()) to query properties stored in floating-point format.
542 * The material system performs the type conversion automatically.
543 */
544 aiPTI_Float = 0x1,
546 /** The material property is an aiString.
547 *
548 * Arrays of strings aren't possible, aiGetMaterialString() (or the
549 * C++-API aiMaterial::Get()) *must* be used to query a string property.
550 */
551 aiPTI_String = 0x3,
553 /** Array of (32 Bit) integers
554 *
555 * It is possible to use aiGetMaterialFloat[Array]() (or the C++-API
556 * aiMaterial::Get()) to query properties stored in integer format.
557 * The material system performs the type conversion automatically.
558 */
559 aiPTI_Integer = 0x4,
562 /** Simple binary buffer, content undefined. Not convertible to anything.
563 */
564 aiPTI_Buffer = 0x5,
567 /** This value is not used. It is just there to force the
568 * compiler to map this enum to a 32 Bit integer.
569 */
570 #ifndef SWIG
571 _aiPTI_Force32Bit = INT_MAX
572 #endif
573 };
575 // ---------------------------------------------------------------------------
576 /** @brief Data structure for a single material property
577 *
578 * As an user, you'll probably never need to deal with this data structure.
579 * Just use the provided aiGetMaterialXXX() or aiMaterial::Get() family
580 * of functions to query material properties easily. Processing them
581 * manually is faster, but it is not the recommended way. It isn't worth
582 * the effort. <br>
583 * Material property names follow a simple scheme:
584 * @code
585 * $<name>
586 * ?<name>
587 * A public property, there must be corresponding AI_MATKEY_XXX define
588 * 2nd: Public, but ignored by the #aiProcess_RemoveRedundantMaterials
589 * post-processing step.
590 * ~<name>
591 * A temporary property for internal use.
592 * @endcode
593 * @see aiMaterial
594 */
595 struct aiMaterialProperty
596 {
597 /** Specifies the name of the property (key)
598 * Keys are generally case insensitive.
599 */
600 C_STRUCT aiString mKey;
602 /** Textures: Specifies their exact usage semantic.
603 * For non-texture properties, this member is always 0
604 * (or, better-said, #aiTextureType_NONE).
605 */
606 unsigned int mSemantic;
608 /** Textures: Specifies the index of the texture.
609 * For non-texture properties, this member is always 0.
610 */
611 unsigned int mIndex;
613 /** Size of the buffer mData is pointing to, in bytes.
614 * This value may not be 0.
615 */
616 unsigned int mDataLength;
618 /** Type information for the property.
619 *
620 * Defines the data layout inside the data buffer. This is used
621 * by the library internally to perform debug checks and to
622 * utilize proper type conversions.
623 * (It's probably a hacky solution, but it works.)
624 */
625 C_ENUM aiPropertyTypeInfo mType;
627 /** Binary buffer to hold the property's value.
628 * The size of the buffer is always mDataLength.
629 */
630 char* mData;
632 #ifdef __cplusplus
634 aiMaterialProperty()
635 : mSemantic( 0 )
636 , mIndex( 0 )
637 , mDataLength( 0 )
638 , mType( aiPTI_Float )
639 , mData( NULL )
640 {
641 }
643 ~aiMaterialProperty() {
644 delete[] mData;
645 }
647 #endif
648 };
649 //! @endcond
651 #ifdef __cplusplus
652 } // We need to leave the "C" block here to allow template member functions
653 #endif
655 // ---------------------------------------------------------------------------
656 /** @brief Data structure for a material
657 *
658 * Material data is stored using a key-value structure. A single key-value
659 * pair is called a 'material property'. C++ users should use the provided
660 * member functions of aiMaterial to process material properties, C users
661 * have to stick with the aiMaterialGetXXX family of unbound functions.
662 * The library defines a set of standard keys (AI_MATKEY_XXX).
663 */
664 #ifdef __cplusplus
665 struct ASSIMP_API aiMaterial
666 #else
667 struct aiMaterial
668 #endif
669 {
671 #ifdef __cplusplus
673 public:
675 aiMaterial();
676 ~aiMaterial();
678 // -------------------------------------------------------------------
679 /** @brief Retrieve an array of Type values with a specific key
680 * from the material
681 *
682 * @param pKey Key to search for. One of the AI_MATKEY_XXX constants.
683 * @param type .. set by AI_MATKEY_XXX
684 * @param idx .. set by AI_MATKEY_XXX
685 * @param pOut Pointer to a buffer to receive the result.
686 * @param pMax Specifies the size of the given buffer, in Type's.
687 * Receives the number of values (not bytes!) read.
688 * NULL is a valid value for this parameter.
689 */
690 template <typename Type>
691 aiReturn Get(const char* pKey,unsigned int type,
692 unsigned int idx, Type* pOut, unsigned int* pMax) const;
694 // -------------------------------------------------------------------
695 /** @brief Retrieve a Type value with a specific key
696 * from the material
697 *
698 * @param pKey Key to search for. One of the AI_MATKEY_XXX constants.
699 * @param type Specifies the type of the texture to be retrieved (
700 * e.g. diffuse, specular, height map ...)
701 * @param idx Index of the texture to be retrieved.
702 * @param pOut Reference to receive the output value
703 */
704 template <typename Type>
705 aiReturn Get(const char* pKey,unsigned int type,
706 unsigned int idx,Type& pOut) const;
708 // -------------------------------------------------------------------
709 /** Get the number of textures for a particular texture type.
710 * @param type Texture type to check for
711 * @return Number of textures for this type.
712 * @note A texture can be easily queried using #GetTexture() */
713 unsigned int GetTextureCount(aiTextureType type) const;
715 // -------------------------------------------------------------------
716 /** Helper function to get all parameters pertaining to a
717 * particular texture slot from a material.
718 *
719 * This function is provided just for convenience, you could also
720 * read the single material properties manually.
721 * @param type Specifies the type of the texture to be retrieved (
722 * e.g. diffuse, specular, height map ...)
723 * @param index Index of the texture to be retrieved. The function fails
724 * if there is no texture of that type with this index.
725 * #GetTextureCount() can be used to determine the number of textures
726 * per texture type.
727 * @param path Receives the path to the texture.
728 * NULL is a valid value.
729 * @param mapping The texture mapping.
730 * NULL is allowed as value.
731 * @param uvindex Receives the UV index of the texture.
732 * NULL is a valid value.
733 * @param blend Receives the blend factor for the texture
734 * NULL is a valid value.
735 * @param op Receives the texture operation to be performed between
736 * this texture and the previous texture. NULL is allowed as value.
737 * @param mapmode Receives the mapping modes to be used for the texture.
738 * The parameter may be NULL but if it is a valid pointer it MUST
739 * point to an array of 3 aiTextureMapMode's (one for each
740 * axis: UVW order (=XYZ)).
741 */
742 // -------------------------------------------------------------------
743 aiReturn GetTexture(aiTextureType type,
744 unsigned int index,
745 C_STRUCT aiString* path,
746 aiTextureMapping* mapping = NULL,
747 unsigned int* uvindex = NULL,
748 float* blend = NULL,
749 aiTextureOp* op = NULL,
750 aiTextureMapMode* mapmode = NULL) const;
753 // Setters
756 // ------------------------------------------------------------------------------
757 /** @brief Add a property with a given key and type info to the material
758 * structure
759 *
760 * @param pInput Pointer to input data
761 * @param pSizeInBytes Size of input data
762 * @param pKey Key/Usage of the property (AI_MATKEY_XXX)
763 * @param type Set by the AI_MATKEY_XXX macro
764 * @param index Set by the AI_MATKEY_XXX macro
765 * @param pType Type information hint */
766 aiReturn AddBinaryProperty (const void* pInput,
767 unsigned int pSizeInBytes,
768 const char* pKey,
769 unsigned int type ,
770 unsigned int index ,
771 aiPropertyTypeInfo pType);
773 // ------------------------------------------------------------------------------
774 /** @brief Add a string property with a given key and type info to the
775 * material structure
776 *
777 * @param pInput Input string
778 * @param pKey Key/Usage of the property (AI_MATKEY_XXX)
779 * @param type Set by the AI_MATKEY_XXX macro
780 * @param index Set by the AI_MATKEY_XXX macro */
781 aiReturn AddProperty (const aiString* pInput,
782 const char* pKey,
783 unsigned int type = 0,
784 unsigned int index = 0);
786 // ------------------------------------------------------------------------------
787 /** @brief Add a property with a given key to the material structure
788 * @param pInput Pointer to the input data
789 * @param pNumValues Number of values in the array
790 * @param pKey Key/Usage of the property (AI_MATKEY_XXX)
791 * @param type Set by the AI_MATKEY_XXX macro
792 * @param index Set by the AI_MATKEY_XXX macro */
793 template<class TYPE>
794 aiReturn AddProperty (const TYPE* pInput,
795 unsigned int pNumValues,
796 const char* pKey,
797 unsigned int type = 0,
798 unsigned int index = 0);
800 // ------------------------------------------------------------------------------
801 /** @brief Remove a given key from the list.
802 *
803 * The function fails if the key isn't found
804 * @param pKey Key to be deleted */
805 aiReturn RemoveProperty (const char* pKey,
806 unsigned int type = 0,
807 unsigned int index = 0);
809 // ------------------------------------------------------------------------------
810 /** @brief Removes all properties from the material.
811 *
812 * The data array remains allocated so adding new properties is quite fast. */
813 void Clear();
815 // ------------------------------------------------------------------------------
816 /** Copy the property list of a material
817 * @param pcDest Destination material
818 * @param pcSrc Source material
819 */
820 static void CopyPropertyList(aiMaterial* pcDest,
821 const aiMaterial* pcSrc);
824 #endif
826 /** List of all material properties loaded. */
827 C_STRUCT aiMaterialProperty** mProperties;
829 /** Number of properties in the data base */
830 unsigned int mNumProperties;
832 /** Storage allocated */
833 unsigned int mNumAllocated;
834 };
836 // Go back to extern "C" again
837 #ifdef __cplusplus
838 extern "C" {
839 #endif
841 // ---------------------------------------------------------------------------
842 #define AI_MATKEY_NAME "?mat.name",0,0
843 #define AI_MATKEY_TWOSIDED "$mat.twosided",0,0
844 #define AI_MATKEY_SHADING_MODEL "$mat.shadingm",0,0
845 #define AI_MATKEY_ENABLE_WIREFRAME "$mat.wireframe",0,0
846 #define AI_MATKEY_BLEND_FUNC "$mat.blend",0,0
847 #define AI_MATKEY_OPACITY "$mat.opacity",0,0
848 #define AI_MATKEY_BUMPSCALING "$mat.bumpscaling",0,0
849 #define AI_MATKEY_SHININESS "$mat.shininess",0,0
850 #define AI_MATKEY_REFLECTIVITY "$mat.reflectivity",0,0
851 #define AI_MATKEY_SHININESS_STRENGTH "$mat.shinpercent",0,0
852 #define AI_MATKEY_REFRACTI "$mat.refracti",0,0
853 #define AI_MATKEY_COLOR_DIFFUSE "$clr.diffuse",0,0
854 #define AI_MATKEY_COLOR_AMBIENT "$clr.ambient",0,0
855 #define AI_MATKEY_COLOR_SPECULAR "$clr.specular",0,0
856 #define AI_MATKEY_COLOR_EMISSIVE "$clr.emissive",0,0
857 #define AI_MATKEY_COLOR_TRANSPARENT "$clr.transparent",0,0
858 #define AI_MATKEY_COLOR_REFLECTIVE "$clr.reflective",0,0
859 #define AI_MATKEY_GLOBAL_BACKGROUND_IMAGE "?bg.global",0,0
861 // ---------------------------------------------------------------------------
862 // Pure key names for all texture-related properties
863 //! @cond MATS_DOC_FULL
864 #define _AI_MATKEY_TEXTURE_BASE "$tex.file"
865 #define _AI_MATKEY_UVWSRC_BASE "$tex.uvwsrc"
866 #define _AI_MATKEY_TEXOP_BASE "$tex.op"
867 #define _AI_MATKEY_MAPPING_BASE "$tex.mapping"
868 #define _AI_MATKEY_TEXBLEND_BASE "$tex.blend"
869 #define _AI_MATKEY_MAPPINGMODE_U_BASE "$tex.mapmodeu"
870 #define _AI_MATKEY_MAPPINGMODE_V_BASE "$tex.mapmodev"
871 #define _AI_MATKEY_TEXMAP_AXIS_BASE "$tex.mapaxis"
872 #define _AI_MATKEY_UVTRANSFORM_BASE "$tex.uvtrafo"
873 #define _AI_MATKEY_TEXFLAGS_BASE "$tex.flags"
874 //! @endcond
876 // ---------------------------------------------------------------------------
877 #define AI_MATKEY_TEXTURE(type, N) _AI_MATKEY_TEXTURE_BASE,type,N
879 // For backward compatibility and simplicity
880 //! @cond MATS_DOC_FULL
881 #define AI_MATKEY_TEXTURE_DIFFUSE(N) \
882 AI_MATKEY_TEXTURE(aiTextureType_DIFFUSE,N)
884 #define AI_MATKEY_TEXTURE_SPECULAR(N) \
885 AI_MATKEY_TEXTURE(aiTextureType_SPECULAR,N)
887 #define AI_MATKEY_TEXTURE_AMBIENT(N) \
888 AI_MATKEY_TEXTURE(aiTextureType_AMBIENT,N)
890 #define AI_MATKEY_TEXTURE_EMISSIVE(N) \
891 AI_MATKEY_TEXTURE(aiTextureType_EMISSIVE,N)
893 #define AI_MATKEY_TEXTURE_NORMALS(N) \
894 AI_MATKEY_TEXTURE(aiTextureType_NORMALS,N)
896 #define AI_MATKEY_TEXTURE_HEIGHT(N) \
897 AI_MATKEY_TEXTURE(aiTextureType_HEIGHT,N)
899 #define AI_MATKEY_TEXTURE_SHININESS(N) \
900 AI_MATKEY_TEXTURE(aiTextureType_SHININESS,N)
902 #define AI_MATKEY_TEXTURE_OPACITY(N) \
903 AI_MATKEY_TEXTURE(aiTextureType_OPACITY,N)
905 #define AI_MATKEY_TEXTURE_DISPLACEMENT(N) \
906 AI_MATKEY_TEXTURE(aiTextureType_DISPLACEMENT,N)
908 #define AI_MATKEY_TEXTURE_LIGHTMAP(N) \
909 AI_MATKEY_TEXTURE(aiTextureType_LIGHTMAP,N)
911 #define AI_MATKEY_TEXTURE_REFLECTION(N) \
912 AI_MATKEY_TEXTURE(aiTextureType_REFLECTION,N)
914 //! @endcond
916 // ---------------------------------------------------------------------------
917 #define AI_MATKEY_UVWSRC(type, N) _AI_MATKEY_UVWSRC_BASE,type,N
919 // For backward compatibility and simplicity
920 //! @cond MATS_DOC_FULL
921 #define AI_MATKEY_UVWSRC_DIFFUSE(N) \
922 AI_MATKEY_UVWSRC(aiTextureType_DIFFUSE,N)
924 #define AI_MATKEY_UVWSRC_SPECULAR(N) \
925 AI_MATKEY_UVWSRC(aiTextureType_SPECULAR,N)
927 #define AI_MATKEY_UVWSRC_AMBIENT(N) \
928 AI_MATKEY_UVWSRC(aiTextureType_AMBIENT,N)
930 #define AI_MATKEY_UVWSRC_EMISSIVE(N) \
931 AI_MATKEY_UVWSRC(aiTextureType_EMISSIVE,N)
933 #define AI_MATKEY_UVWSRC_NORMALS(N) \
934 AI_MATKEY_UVWSRC(aiTextureType_NORMALS,N)
936 #define AI_MATKEY_UVWSRC_HEIGHT(N) \
937 AI_MATKEY_UVWSRC(aiTextureType_HEIGHT,N)
939 #define AI_MATKEY_UVWSRC_SHININESS(N) \
940 AI_MATKEY_UVWSRC(aiTextureType_SHININESS,N)
942 #define AI_MATKEY_UVWSRC_OPACITY(N) \
943 AI_MATKEY_UVWSRC(aiTextureType_OPACITY,N)
945 #define AI_MATKEY_UVWSRC_DISPLACEMENT(N) \
946 AI_MATKEY_UVWSRC(aiTextureType_DISPLACEMENT,N)
948 #define AI_MATKEY_UVWSRC_LIGHTMAP(N) \
949 AI_MATKEY_UVWSRC(aiTextureType_LIGHTMAP,N)
951 #define AI_MATKEY_UVWSRC_REFLECTION(N) \
952 AI_MATKEY_UVWSRC(aiTextureType_REFLECTION,N)
954 //! @endcond
955 // ---------------------------------------------------------------------------
956 #define AI_MATKEY_TEXOP(type, N) _AI_MATKEY_TEXOP_BASE,type,N
958 // For backward compatibility and simplicity
959 //! @cond MATS_DOC_FULL
960 #define AI_MATKEY_TEXOP_DIFFUSE(N) \
961 AI_MATKEY_TEXOP(aiTextureType_DIFFUSE,N)
963 #define AI_MATKEY_TEXOP_SPECULAR(N) \
964 AI_MATKEY_TEXOP(aiTextureType_SPECULAR,N)
966 #define AI_MATKEY_TEXOP_AMBIENT(N) \
967 AI_MATKEY_TEXOP(aiTextureType_AMBIENT,N)
969 #define AI_MATKEY_TEXOP_EMISSIVE(N) \
970 AI_MATKEY_TEXOP(aiTextureType_EMISSIVE,N)
972 #define AI_MATKEY_TEXOP_NORMALS(N) \
973 AI_MATKEY_TEXOP(aiTextureType_NORMALS,N)
975 #define AI_MATKEY_TEXOP_HEIGHT(N) \
976 AI_MATKEY_TEXOP(aiTextureType_HEIGHT,N)
978 #define AI_MATKEY_TEXOP_SHININESS(N) \
979 AI_MATKEY_TEXOP(aiTextureType_SHININESS,N)
981 #define AI_MATKEY_TEXOP_OPACITY(N) \
982 AI_MATKEY_TEXOP(aiTextureType_OPACITY,N)
984 #define AI_MATKEY_TEXOP_DISPLACEMENT(N) \
985 AI_MATKEY_TEXOP(aiTextureType_DISPLACEMENT,N)
987 #define AI_MATKEY_TEXOP_LIGHTMAP(N) \
988 AI_MATKEY_TEXOP(aiTextureType_LIGHTMAP,N)
990 #define AI_MATKEY_TEXOP_REFLECTION(N) \
991 AI_MATKEY_TEXOP(aiTextureType_REFLECTION,N)
993 //! @endcond
994 // ---------------------------------------------------------------------------
995 #define AI_MATKEY_MAPPING(type, N) _AI_MATKEY_MAPPING_BASE,type,N
997 // For backward compatibility and simplicity
998 //! @cond MATS_DOC_FULL
999 #define AI_MATKEY_MAPPING_DIFFUSE(N) \
1000 AI_MATKEY_MAPPING(aiTextureType_DIFFUSE,N)
1002 #define AI_MATKEY_MAPPING_SPECULAR(N) \
1003 AI_MATKEY_MAPPING(aiTextureType_SPECULAR,N)
1005 #define AI_MATKEY_MAPPING_AMBIENT(N) \
1006 AI_MATKEY_MAPPING(aiTextureType_AMBIENT,N)
1008 #define AI_MATKEY_MAPPING_EMISSIVE(N) \
1009 AI_MATKEY_MAPPING(aiTextureType_EMISSIVE,N)
1011 #define AI_MATKEY_MAPPING_NORMALS(N) \
1012 AI_MATKEY_MAPPING(aiTextureType_NORMALS,N)
1014 #define AI_MATKEY_MAPPING_HEIGHT(N) \
1015 AI_MATKEY_MAPPING(aiTextureType_HEIGHT,N)
1017 #define AI_MATKEY_MAPPING_SHININESS(N) \
1018 AI_MATKEY_MAPPING(aiTextureType_SHININESS,N)
1020 #define AI_MATKEY_MAPPING_OPACITY(N) \
1021 AI_MATKEY_MAPPING(aiTextureType_OPACITY,N)
1023 #define AI_MATKEY_MAPPING_DISPLACEMENT(N) \
1024 AI_MATKEY_MAPPING(aiTextureType_DISPLACEMENT,N)
1026 #define AI_MATKEY_MAPPING_LIGHTMAP(N) \
1027 AI_MATKEY_MAPPING(aiTextureType_LIGHTMAP,N)
1029 #define AI_MATKEY_MAPPING_REFLECTION(N) \
1030 AI_MATKEY_MAPPING(aiTextureType_REFLECTION,N)
1032 //! @endcond
1033 // ---------------------------------------------------------------------------
1034 #define AI_MATKEY_TEXBLEND(type, N) _AI_MATKEY_TEXBLEND_BASE,type,N
1036 // For backward compatibility and simplicity
1037 //! @cond MATS_DOC_FULL
1038 #define AI_MATKEY_TEXBLEND_DIFFUSE(N) \
1039 AI_MATKEY_TEXBLEND(aiTextureType_DIFFUSE,N)
1041 #define AI_MATKEY_TEXBLEND_SPECULAR(N) \
1042 AI_MATKEY_TEXBLEND(aiTextureType_SPECULAR,N)
1044 #define AI_MATKEY_TEXBLEND_AMBIENT(N) \
1045 AI_MATKEY_TEXBLEND(aiTextureType_AMBIENT,N)
1047 #define AI_MATKEY_TEXBLEND_EMISSIVE(N) \
1048 AI_MATKEY_TEXBLEND(aiTextureType_EMISSIVE,N)
1050 #define AI_MATKEY_TEXBLEND_NORMALS(N) \
1051 AI_MATKEY_TEXBLEND(aiTextureType_NORMALS,N)
1053 #define AI_MATKEY_TEXBLEND_HEIGHT(N) \
1054 AI_MATKEY_TEXBLEND(aiTextureType_HEIGHT,N)
1056 #define AI_MATKEY_TEXBLEND_SHININESS(N) \
1057 AI_MATKEY_TEXBLEND(aiTextureType_SHININESS,N)
1059 #define AI_MATKEY_TEXBLEND_OPACITY(N) \
1060 AI_MATKEY_TEXBLEND(aiTextureType_OPACITY,N)
1062 #define AI_MATKEY_TEXBLEND_DISPLACEMENT(N) \
1063 AI_MATKEY_TEXBLEND(aiTextureType_DISPLACEMENT,N)
1065 #define AI_MATKEY_TEXBLEND_LIGHTMAP(N) \
1066 AI_MATKEY_TEXBLEND(aiTextureType_LIGHTMAP,N)
1068 #define AI_MATKEY_TEXBLEND_REFLECTION(N) \
1069 AI_MATKEY_TEXBLEND(aiTextureType_REFLECTION,N)
1071 //! @endcond
1072 // ---------------------------------------------------------------------------
1073 #define AI_MATKEY_MAPPINGMODE_U(type, N) _AI_MATKEY_MAPPINGMODE_U_BASE,type,N
1075 // For backward compatibility and simplicity
1076 //! @cond MATS_DOC_FULL
1077 #define AI_MATKEY_MAPPINGMODE_U_DIFFUSE(N) \
1078 AI_MATKEY_MAPPINGMODE_U(aiTextureType_DIFFUSE,N)
1080 #define AI_MATKEY_MAPPINGMODE_U_SPECULAR(N) \
1081 AI_MATKEY_MAPPINGMODE_U(aiTextureType_SPECULAR,N)
1083 #define AI_MATKEY_MAPPINGMODE_U_AMBIENT(N) \
1084 AI_MATKEY_MAPPINGMODE_U(aiTextureType_AMBIENT,N)
1086 #define AI_MATKEY_MAPPINGMODE_U_EMISSIVE(N) \
1087 AI_MATKEY_MAPPINGMODE_U(aiTextureType_EMISSIVE,N)
1089 #define AI_MATKEY_MAPPINGMODE_U_NORMALS(N) \
1090 AI_MATKEY_MAPPINGMODE_U(aiTextureType_NORMALS,N)
1092 #define AI_MATKEY_MAPPINGMODE_U_HEIGHT(N) \
1093 AI_MATKEY_MAPPINGMODE_U(aiTextureType_HEIGHT,N)
1095 #define AI_MATKEY_MAPPINGMODE_U_SHININESS(N) \
1096 AI_MATKEY_MAPPINGMODE_U(aiTextureType_SHININESS,N)
1098 #define AI_MATKEY_MAPPINGMODE_U_OPACITY(N) \
1099 AI_MATKEY_MAPPINGMODE_U(aiTextureType_OPACITY,N)
1101 #define AI_MATKEY_MAPPINGMODE_U_DISPLACEMENT(N) \
1102 AI_MATKEY_MAPPINGMODE_U(aiTextureType_DISPLACEMENT,N)
1104 #define AI_MATKEY_MAPPINGMODE_U_LIGHTMAP(N) \
1105 AI_MATKEY_MAPPINGMODE_U(aiTextureType_LIGHTMAP,N)
1107 #define AI_MATKEY_MAPPINGMODE_U_REFLECTION(N) \
1108 AI_MATKEY_MAPPINGMODE_U(aiTextureType_REFLECTION,N)
1110 //! @endcond
1111 // ---------------------------------------------------------------------------
1112 #define AI_MATKEY_MAPPINGMODE_V(type, N) _AI_MATKEY_MAPPINGMODE_V_BASE,type,N
1114 // For backward compatibility and simplicity
1115 //! @cond MATS_DOC_FULL
1116 #define AI_MATKEY_MAPPINGMODE_V_DIFFUSE(N) \
1117 AI_MATKEY_MAPPINGMODE_V(aiTextureType_DIFFUSE,N)
1119 #define AI_MATKEY_MAPPINGMODE_V_SPECULAR(N) \
1120 AI_MATKEY_MAPPINGMODE_V(aiTextureType_SPECULAR,N)
1122 #define AI_MATKEY_MAPPINGMODE_V_AMBIENT(N) \
1123 AI_MATKEY_MAPPINGMODE_V(aiTextureType_AMBIENT,N)
1125 #define AI_MATKEY_MAPPINGMODE_V_EMISSIVE(N) \
1126 AI_MATKEY_MAPPINGMODE_V(aiTextureType_EMISSIVE,N)
1128 #define AI_MATKEY_MAPPINGMODE_V_NORMALS(N) \
1129 AI_MATKEY_MAPPINGMODE_V(aiTextureType_NORMALS,N)
1131 #define AI_MATKEY_MAPPINGMODE_V_HEIGHT(N) \
1132 AI_MATKEY_MAPPINGMODE_V(aiTextureType_HEIGHT,N)
1134 #define AI_MATKEY_MAPPINGMODE_V_SHININESS(N) \
1135 AI_MATKEY_MAPPINGMODE_V(aiTextureType_SHININESS,N)
1137 #define AI_MATKEY_MAPPINGMODE_V_OPACITY(N) \
1138 AI_MATKEY_MAPPINGMODE_V(aiTextureType_OPACITY,N)
1140 #define AI_MATKEY_MAPPINGMODE_V_DISPLACEMENT(N) \
1141 AI_MATKEY_MAPPINGMODE_V(aiTextureType_DISPLACEMENT,N)
1143 #define AI_MATKEY_MAPPINGMODE_V_LIGHTMAP(N) \
1144 AI_MATKEY_MAPPINGMODE_V(aiTextureType_LIGHTMAP,N)
1146 #define AI_MATKEY_MAPPINGMODE_V_REFLECTION(N) \
1147 AI_MATKEY_MAPPINGMODE_V(aiTextureType_REFLECTION,N)
1149 //! @endcond
1150 // ---------------------------------------------------------------------------
1151 #define AI_MATKEY_TEXMAP_AXIS(type, N) _AI_MATKEY_TEXMAP_AXIS_BASE,type,N
1153 // For backward compatibility and simplicity
1154 //! @cond MATS_DOC_FULL
1155 #define AI_MATKEY_TEXMAP_AXIS_DIFFUSE(N) \
1156 AI_MATKEY_TEXMAP_AXIS(aiTextureType_DIFFUSE,N)
1158 #define AI_MATKEY_TEXMAP_AXIS_SPECULAR(N) \
1159 AI_MATKEY_TEXMAP_AXIS(aiTextureType_SPECULAR,N)
1161 #define AI_MATKEY_TEXMAP_AXIS_AMBIENT(N) \
1162 AI_MATKEY_TEXMAP_AXIS(aiTextureType_AMBIENT,N)
1164 #define AI_MATKEY_TEXMAP_AXIS_EMISSIVE(N) \
1165 AI_MATKEY_TEXMAP_AXIS(aiTextureType_EMISSIVE,N)
1167 #define AI_MATKEY_TEXMAP_AXIS_NORMALS(N) \
1168 AI_MATKEY_TEXMAP_AXIS(aiTextureType_NORMALS,N)
1170 #define AI_MATKEY_TEXMAP_AXIS_HEIGHT(N) \
1171 AI_MATKEY_TEXMAP_AXIS(aiTextureType_HEIGHT,N)
1173 #define AI_MATKEY_TEXMAP_AXIS_SHININESS(N) \
1174 AI_MATKEY_TEXMAP_AXIS(aiTextureType_SHININESS,N)
1176 #define AI_MATKEY_TEXMAP_AXIS_OPACITY(N) \
1177 AI_MATKEY_TEXMAP_AXIS(aiTextureType_OPACITY,N)
1179 #define AI_MATKEY_TEXMAP_AXIS_DISPLACEMENT(N) \
1180 AI_MATKEY_TEXMAP_AXIS(aiTextureType_DISPLACEMENT,N)
1182 #define AI_MATKEY_TEXMAP_AXIS_LIGHTMAP(N) \
1183 AI_MATKEY_TEXMAP_AXIS(aiTextureType_LIGHTMAP,N)
1185 #define AI_MATKEY_TEXMAP_AXIS_REFLECTION(N) \
1186 AI_MATKEY_TEXMAP_AXIS(aiTextureType_REFLECTION,N)
1188 //! @endcond
1189 // ---------------------------------------------------------------------------
1190 #define AI_MATKEY_UVTRANSFORM(type, N) _AI_MATKEY_UVTRANSFORM_BASE,type,N
1192 // For backward compatibility and simplicity
1193 //! @cond MATS_DOC_FULL
1194 #define AI_MATKEY_UVTRANSFORM_DIFFUSE(N) \
1195 AI_MATKEY_UVTRANSFORM(aiTextureType_DIFFUSE,N)
1197 #define AI_MATKEY_UVTRANSFORM_SPECULAR(N) \
1198 AI_MATKEY_UVTRANSFORM(aiTextureType_SPECULAR,N)
1200 #define AI_MATKEY_UVTRANSFORM_AMBIENT(N) \
1201 AI_MATKEY_UVTRANSFORM(aiTextureType_AMBIENT,N)
1203 #define AI_MATKEY_UVTRANSFORM_EMISSIVE(N) \
1204 AI_MATKEY_UVTRANSFORM(aiTextureType_EMISSIVE,N)
1206 #define AI_MATKEY_UVTRANSFORM_NORMALS(N) \
1207 AI_MATKEY_UVTRANSFORM(aiTextureType_NORMALS,N)
1209 #define AI_MATKEY_UVTRANSFORM_HEIGHT(N) \
1210 AI_MATKEY_UVTRANSFORM(aiTextureType_HEIGHT,N)
1212 #define AI_MATKEY_UVTRANSFORM_SHININESS(N) \
1213 AI_MATKEY_UVTRANSFORM(aiTextureType_SHININESS,N)
1215 #define AI_MATKEY_UVTRANSFORM_OPACITY(N) \
1216 AI_MATKEY_UVTRANSFORM(aiTextureType_OPACITY,N)
1218 #define AI_MATKEY_UVTRANSFORM_DISPLACEMENT(N) \
1219 AI_MATKEY_UVTRANSFORM(aiTextureType_DISPLACEMENT,N)
1221 #define AI_MATKEY_UVTRANSFORM_LIGHTMAP(N) \
1222 AI_MATKEY_UVTRANSFORM(aiTextureType_LIGHTMAP,N)
1224 #define AI_MATKEY_UVTRANSFORM_REFLECTION(N) \
1225 AI_MATKEY_UVTRANSFORM(aiTextureType_REFLECTION,N)
1227 #define AI_MATKEY_UVTRANSFORM_UNKNOWN(N) \
1228 AI_MATKEY_UVTRANSFORM(aiTextureType_UNKNOWN,N)
1230 //! @endcond
1231 // ---------------------------------------------------------------------------
1232 #define AI_MATKEY_TEXFLAGS(type, N) _AI_MATKEY_TEXFLAGS_BASE,type,N
1234 // For backward compatibility and simplicity
1235 //! @cond MATS_DOC_FULL
1236 #define AI_MATKEY_TEXFLAGS_DIFFUSE(N) \
1237 AI_MATKEY_TEXFLAGS(aiTextureType_DIFFUSE,N)
1239 #define AI_MATKEY_TEXFLAGS_SPECULAR(N) \
1240 AI_MATKEY_TEXFLAGS(aiTextureType_SPECULAR,N)
1242 #define AI_MATKEY_TEXFLAGS_AMBIENT(N) \
1243 AI_MATKEY_TEXFLAGS(aiTextureType_AMBIENT,N)
1245 #define AI_MATKEY_TEXFLAGS_EMISSIVE(N) \
1246 AI_MATKEY_TEXFLAGS(aiTextureType_EMISSIVE,N)
1248 #define AI_MATKEY_TEXFLAGS_NORMALS(N) \
1249 AI_MATKEY_TEXFLAGS(aiTextureType_NORMALS,N)
1251 #define AI_MATKEY_TEXFLAGS_HEIGHT(N) \
1252 AI_MATKEY_TEXFLAGS(aiTextureType_HEIGHT,N)
1254 #define AI_MATKEY_TEXFLAGS_SHININESS(N) \
1255 AI_MATKEY_TEXFLAGS(aiTextureType_SHININESS,N)
1257 #define AI_MATKEY_TEXFLAGS_OPACITY(N) \
1258 AI_MATKEY_TEXFLAGS(aiTextureType_OPACITY,N)
1260 #define AI_MATKEY_TEXFLAGS_DISPLACEMENT(N) \
1261 AI_MATKEY_TEXFLAGS(aiTextureType_DISPLACEMENT,N)
1263 #define AI_MATKEY_TEXFLAGS_LIGHTMAP(N) \
1264 AI_MATKEY_TEXFLAGS(aiTextureType_LIGHTMAP,N)
1266 #define AI_MATKEY_TEXFLAGS_REFLECTION(N) \
1267 AI_MATKEY_TEXFLAGS(aiTextureType_REFLECTION,N)
1269 #define AI_MATKEY_TEXFLAGS_UNKNOWN(N) \
1270 AI_MATKEY_TEXFLAGS(aiTextureType_UNKNOWN,N)
1272 // ---------------------------------------------------------------------------
1273 /** @brief Retrieve a material property with a specific key from the material
1275 * @param pMat Pointer to the input material. May not be NULL
1276 * @param pKey Key to search for. One of the AI_MATKEY_XXX constants.
1277 * @param type Specifies the type of the texture to be retrieved (
1278 * e.g. diffuse, specular, height map ...)
1279 * @param index Index of the texture to be retrieved.
1280 * @param pPropOut Pointer to receive a pointer to a valid aiMaterialProperty
1281 * structure or NULL if the key has not been found. */
1282 // ---------------------------------------------------------------------------
1283 ASSIMP_API C_ENUM aiReturn aiGetMaterialProperty(
1284 const C_STRUCT aiMaterial* pMat,
1285 const char* pKey,
1286 unsigned int type,
1287 unsigned int index,
1288 const C_STRUCT aiMaterialProperty** pPropOut);
1290 // ---------------------------------------------------------------------------
1291 /** @brief Retrieve an array of float values with a specific key
1292 * from the material
1294 * Pass one of the AI_MATKEY_XXX constants for the last three parameters (the
1295 * example reads the #AI_MATKEY_UVTRANSFORM property of the first diffuse texture)
1296 * @code
1297 * aiUVTransform trafo;
1298 * unsigned int max = sizeof(aiUVTransform);
1299 * if (AI_SUCCESS != aiGetMaterialFloatArray(mat, AI_MATKEY_UVTRANSFORM(aiTextureType_DIFFUSE,0),
1300 * (float*)&trafo, &max) || sizeof(aiUVTransform) != max)
1301 * {
1302 * // error handling
1303 * }
1304 * @endcode
1306 * @param pMat Pointer to the input material. May not be NULL
1307 * @param pKey Key to search for. One of the AI_MATKEY_XXX constants.
1308 * @param pOut Pointer to a buffer to receive the result.
1309 * @param pMax Specifies the size of the given buffer, in float's.
1310 * Receives the number of values (not bytes!) read.
1311 * @param type (see the code sample above)
1312 * @param index (see the code sample above)
1313 * @return Specifies whether the key has been found. If not, the output
1314 * arrays remains unmodified and pMax is set to 0.*/
1315 // ---------------------------------------------------------------------------
1316 ASSIMP_API C_ENUM aiReturn aiGetMaterialFloatArray(
1317 const C_STRUCT aiMaterial* pMat,
1318 const char* pKey,
1319 unsigned int type,
1320 unsigned int index,
1321 float* pOut,
1322 unsigned int* pMax);
1325 #ifdef __cplusplus
1327 // ---------------------------------------------------------------------------
1328 /** @brief Retrieve a single float property with a specific key from the material.
1330 * Pass one of the AI_MATKEY_XXX constants for the last three parameters (the
1331 * example reads the #AI_MATKEY_SHININESS_STRENGTH property of the first diffuse texture)
1332 * @code
1333 * float specStrength = 1.f; // default value, remains unmodified if we fail.
1334 * aiGetMaterialFloat(mat, AI_MATKEY_SHININESS_STRENGTH,
1335 * (float*)&specStrength);
1336 * @endcode
1338 * @param pMat Pointer to the input material. May not be NULL
1339 * @param pKey Key to search for. One of the AI_MATKEY_XXX constants.
1340 * @param pOut Receives the output float.
1341 * @param type (see the code sample above)
1342 * @param index (see the code sample above)
1343 * @return Specifies whether the key has been found. If not, the output
1344 * float remains unmodified.*/
1345 // ---------------------------------------------------------------------------
1346 inline aiReturn aiGetMaterialFloat(const aiMaterial* pMat,
1347 const char* pKey,
1348 unsigned int type,
1349 unsigned int index,
1350 float* pOut)
1352 return aiGetMaterialFloatArray(pMat,pKey,type,index,pOut,(unsigned int*)0x0);
1355 #else
1357 // Use our friend, the C preprocessor
1358 #define aiGetMaterialFloat (pMat, type, index, pKey, pOut) \
1359 aiGetMaterialFloatArray(pMat, type, index, pKey, pOut, NULL)
1361 #endif //!__cplusplus
1364 // ---------------------------------------------------------------------------
1365 /** @brief Retrieve an array of integer values with a specific key
1366 * from a material
1368 * See the sample for aiGetMaterialFloatArray for more information.*/
1369 ASSIMP_API C_ENUM aiReturn aiGetMaterialIntegerArray(const C_STRUCT aiMaterial* pMat,
1370 const char* pKey,
1371 unsigned int type,
1372 unsigned int index,
1373 int* pOut,
1374 unsigned int* pMax);
1377 #ifdef __cplusplus
1379 // ---------------------------------------------------------------------------
1380 /** @brief Retrieve an integer property with a specific key from a material
1382 * See the sample for aiGetMaterialFloat for more information.*/
1383 // ---------------------------------------------------------------------------
1384 inline aiReturn aiGetMaterialInteger(const C_STRUCT aiMaterial* pMat,
1385 const char* pKey,
1386 unsigned int type,
1387 unsigned int index,
1388 int* pOut)
1390 return aiGetMaterialIntegerArray(pMat,pKey,type,index,pOut,(unsigned int*)0x0);
1393 #else
1395 // use our friend, the C preprocessor
1396 #define aiGetMaterialInteger (pMat, type, index, pKey, pOut) \
1397 aiGetMaterialIntegerArray(pMat, type, index, pKey, pOut, NULL)
1399 #endif //!__cplusplus
1403 // ---------------------------------------------------------------------------
1404 /** @brief Retrieve a color value from the material property table
1406 * See the sample for aiGetMaterialFloat for more information*/
1407 // ---------------------------------------------------------------------------
1408 ASSIMP_API C_ENUM aiReturn aiGetMaterialColor(const C_STRUCT aiMaterial* pMat,
1409 const char* pKey,
1410 unsigned int type,
1411 unsigned int index,
1412 C_STRUCT aiColor4D* pOut);
1415 // ---------------------------------------------------------------------------
1416 /** @brief Retrieve a string from the material property table
1418 * See the sample for aiGetMaterialFloat for more information.*/
1419 // ---------------------------------------------------------------------------
1420 ASSIMP_API C_ENUM aiReturn aiGetMaterialString(const C_STRUCT aiMaterial* pMat,
1421 const char* pKey,
1422 unsigned int type,
1423 unsigned int index,
1424 C_STRUCT aiString* pOut);
1426 // ---------------------------------------------------------------------------
1427 /** Get the number of textures for a particular texture type.
1428 * @param[in] pMat Pointer to the input material. May not be NULL
1429 * @param type Texture type to check for
1430 * @return Number of textures for this type.
1431 * @note A texture can be easily queried using #aiGetMaterialTexture() */
1432 // ---------------------------------------------------------------------------
1433 ASSIMP_API unsigned int aiGetMaterialTextureCount(const C_STRUCT aiMaterial* pMat,
1434 C_ENUM aiTextureType type);
1436 // ---------------------------------------------------------------------------
1437 /** @brief Helper function to get all values pertaining to a particular
1438 * texture slot from a material structure.
1440 * This function is provided just for convenience. You could also read the
1441 * texture by parsing all of its properties manually. This function bundles
1442 * all of them in a huge function monster.
1444 * @param[in] mat Pointer to the input material. May not be NULL
1445 * @param[in] type Specifies the texture stack to read from (e.g. diffuse,
1446 * specular, height map ...).
1447 * @param[in] index Index of the texture. The function fails if the
1448 * requested index is not available for this texture type.
1449 * #aiGetMaterialTextureCount() can be used to determine the number of
1450 * textures in a particular texture stack.
1451 * @param[out] path Receives the output path
1452 * This parameter must be non-null.
1453 * @param mapping The texture mapping mode to be used.
1454 * Pass NULL if you're not interested in this information.
1455 * @param[out] uvindex For UV-mapped textures: receives the index of the UV
1456 * source channel. Unmodified otherwise.
1457 * Pass NULL if you're not interested in this information.
1458 * @param[out] blend Receives the blend factor for the texture
1459 * Pass NULL if you're not interested in this information.
1460 * @param[out] op Receives the texture blend operation to be perform between
1461 * this texture and the previous texture.
1462 * Pass NULL if you're not interested in this information.
1463 * @param[out] mapmode Receives the mapping modes to be used for the texture.
1464 * Pass NULL if you're not interested in this information. Otherwise,
1465 * pass a pointer to an array of two aiTextureMapMode's (one for each
1466 * axis, UV order).
1467 * @return AI_SUCCESS on success, otherwise something else. Have fun.*/
1468 // ---------------------------------------------------------------------------
1469 #ifdef __cplusplus
1470 ASSIMP_API aiReturn aiGetMaterialTexture(const C_STRUCT aiMaterial* mat,
1471 aiTextureType type,
1472 unsigned int index,
1473 aiString* path,
1474 aiTextureMapping* mapping = NULL,
1475 unsigned int* uvindex = NULL,
1476 float* blend = NULL,
1477 aiTextureOp* op = NULL,
1478 aiTextureMapMode* mapmode = NULL,
1479 unsigned int* flags = NULL);
1480 #else
1481 C_ENUM aiReturn aiGetMaterialTexture(const C_STRUCT aiMaterial* mat,
1482 C_ENUM aiTextureType type,
1483 unsigned int index,
1484 C_STRUCT aiString* path,
1485 C_ENUM aiTextureMapping* mapping /*= NULL*/,
1486 unsigned int* uvindex /*= NULL*/,
1487 float* blend /*= NULL*/,
1488 C_ENUM aiTextureOp* op /*= NULL*/,
1489 C_ENUM aiTextureMapMode* mapmode /*= NULL*/,
1490 unsigned int* flags /*= NULL*/);
1491 #endif // !#ifdef __cplusplus
1493 #ifdef __cplusplus
1496 #include "material.inl"
1498 #endif //!__cplusplus
1499 #endif //!!AI_MATERIAL_H_INC