material.h 60 KB

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