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

source code of qt3d/src/3rdparty/assimp/src/include/assimp/material.h