material.h 60 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681
  1. /*
  2. ---------------------------------------------------------------------------
  3. Open Asset Import Library (assimp)
  4. ---------------------------------------------------------------------------
  5. Copyright (c) 2006-2022, 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. /** PBR Material Modifiers
  249. * Some modern renderers have further PBR modifiers that may be overlaid
  250. * on top of the 'base' PBR materials for additional realism.
  251. * These use multiple texture maps, so only the base type is directly defined
  252. */
  253. /** Sheen
  254. * Generally used to simulate textiles that are covered in a layer of microfibers
  255. * eg velvet
  256. * https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_sheen
  257. */
  258. aiTextureType_SHEEN = 19,
  259. /** Clearcoat
  260. * Simulates a layer of 'polish' or 'laquer' layered on top of a PBR substrate
  261. * https://autodesk.github.io/standard-surface/#closures/coating
  262. * https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_clearcoat
  263. */
  264. aiTextureType_CLEARCOAT = 20,
  265. /** Transmission
  266. * Simulates transmission through the surface
  267. * May include further information such as wall thickness
  268. */
  269. aiTextureType_TRANSMISSION = 21,
  270. /** Unknown texture
  271. *
  272. * A texture reference that does not match any of the definitions
  273. * above is considered to be 'unknown'. It is still imported,
  274. * but is excluded from any further post-processing.
  275. */
  276. aiTextureType_UNKNOWN = 18,
  277. #ifndef SWIG
  278. _aiTextureType_Force32Bit = INT_MAX
  279. #endif
  280. };
  281. #define AI_TEXTURE_TYPE_MAX aiTextureType_TRANSMISSION
  282. // -------------------------------------------------------------------------------
  283. // Get a string for a given aiTextureType
  284. ASSIMP_API const char *TextureTypeToString(enum aiTextureType in);
  285. // ---------------------------------------------------------------------------
  286. /** @brief Defines all shading models supported by the library
  287. *
  288. * Property: #AI_MATKEY_SHADING_MODEL
  289. *
  290. * The list of shading modes has been taken from Blender.
  291. * See Blender documentation for more information. The API does
  292. * not distinguish between "specular" and "diffuse" shaders (thus the
  293. * specular term for diffuse shading models like Oren-Nayar remains
  294. * undefined). <br>
  295. * Again, this value is just a hint. Assimp tries to select the shader whose
  296. * most common implementation matches the original rendering results of the
  297. * 3D modeler which wrote a particular model as closely as possible.
  298. *
  299. */
  300. enum aiShadingMode {
  301. /** Flat shading. Shading is done on per-face base,
  302. * diffuse only. Also known as 'faceted shading'.
  303. */
  304. aiShadingMode_Flat = 0x1,
  305. /** Simple Gouraud shading.
  306. */
  307. aiShadingMode_Gouraud = 0x2,
  308. /** Phong-Shading -
  309. */
  310. aiShadingMode_Phong = 0x3,
  311. /** Phong-Blinn-Shading
  312. */
  313. aiShadingMode_Blinn = 0x4,
  314. /** Toon-Shading per pixel
  315. *
  316. * Also known as 'comic' shader.
  317. */
  318. aiShadingMode_Toon = 0x5,
  319. /** OrenNayar-Shading per pixel
  320. *
  321. * Extension to standard Lambertian shading, taking the
  322. * roughness of the material into account
  323. */
  324. aiShadingMode_OrenNayar = 0x6,
  325. /** Minnaert-Shading per pixel
  326. *
  327. * Extension to standard Lambertian shading, taking the
  328. * "darkness" of the material into account
  329. */
  330. aiShadingMode_Minnaert = 0x7,
  331. /** CookTorrance-Shading per pixel
  332. *
  333. * Special shader for metallic surfaces.
  334. */
  335. aiShadingMode_CookTorrance = 0x8,
  336. /** No shading at all. Constant light influence of 1.0.
  337. * Also known as "Unlit"
  338. */
  339. aiShadingMode_NoShading = 0x9,
  340. aiShadingMode_Unlit = aiShadingMode_NoShading, // Alias
  341. /** Fresnel shading
  342. */
  343. aiShadingMode_Fresnel = 0xa,
  344. /** Physically-Based Rendering (PBR) shading using
  345. * Bidirectional scattering/reflectance distribution function (BSDF/BRDF)
  346. * There are multiple methods under this banner, and model files may provide
  347. * data for more than one PBR-BRDF method.
  348. * Applications should use the set of provided properties to determine which
  349. * of their preferred PBR rendering methods are likely to be available
  350. * eg:
  351. * - If AI_MATKEY_METALLIC_FACTOR is set, then a Metallic/Roughness is available
  352. * - If AI_MATKEY_GLOSSINESS_FACTOR is set, then a Specular/Glossiness is available
  353. * Note that some PBR methods allow layering of techniques
  354. */
  355. aiShadingMode_PBR_BRDF = 0xb,
  356. #ifndef SWIG
  357. _aiShadingMode_Force32Bit = INT_MAX
  358. #endif
  359. };
  360. // ---------------------------------------------------------------------------
  361. /** @brief Defines some mixed flags for a particular texture.
  362. *
  363. * Usually you'll instruct your cg artists how textures have to look like ...
  364. * and how they will be processed in your application. However, if you use
  365. * Assimp for completely generic loading purposes you might also need to
  366. * process these flags in order to display as many 'unknown' 3D models as
  367. * possible correctly.
  368. *
  369. * This corresponds to the #AI_MATKEY_TEXFLAGS property.
  370. */
  371. enum aiTextureFlags {
  372. /** The texture's color values have to be inverted (component-wise 1-n)
  373. */
  374. aiTextureFlags_Invert = 0x1,
  375. /** Explicit request to the application to process the alpha channel
  376. * of the texture.
  377. *
  378. * Mutually exclusive with #aiTextureFlags_IgnoreAlpha. These
  379. * flags are set if the library can say for sure that the alpha
  380. * channel is used/is not used. If the model format does not
  381. * define this, it is left to the application to decide whether
  382. * the texture alpha channel - if any - is evaluated or not.
  383. */
  384. aiTextureFlags_UseAlpha = 0x2,
  385. /** Explicit request to the application to ignore the alpha channel
  386. * of the texture.
  387. *
  388. * Mutually exclusive with #aiTextureFlags_UseAlpha.
  389. */
  390. aiTextureFlags_IgnoreAlpha = 0x4,
  391. #ifndef SWIG
  392. _aiTextureFlags_Force32Bit = INT_MAX
  393. #endif
  394. };
  395. // ---------------------------------------------------------------------------
  396. /** @brief Defines alpha-blend flags.
  397. *
  398. * If you're familiar with OpenGL or D3D, these flags aren't new to you.
  399. * They define *how* the final color value of a pixel is computed, basing
  400. * on the previous color at that pixel and the new color value from the
  401. * material.
  402. * The blend formula is:
  403. * @code
  404. * SourceColor * SourceBlend + DestColor * DestBlend
  405. * @endcode
  406. * where DestColor is the previous color in the frame-buffer at this
  407. * position and SourceColor is the material color before the transparency
  408. * calculation.<br>
  409. * This corresponds to the #AI_MATKEY_BLEND_FUNC property.
  410. */
  411. enum aiBlendMode {
  412. /**
  413. * Formula:
  414. * @code
  415. * SourceColor*SourceAlpha + DestColor*(1-SourceAlpha)
  416. * @endcode
  417. */
  418. aiBlendMode_Default = 0x0,
  419. /** Additive blending
  420. *
  421. * Formula:
  422. * @code
  423. * SourceColor*1 + DestColor*1
  424. * @endcode
  425. */
  426. aiBlendMode_Additive = 0x1,
  427. // we don't need more for the moment, but we might need them
  428. // in future versions ...
  429. #ifndef SWIG
  430. _aiBlendMode_Force32Bit = INT_MAX
  431. #endif
  432. };
  433. #include "./Compiler/pushpack1.h"
  434. // ---------------------------------------------------------------------------
  435. /** @brief Defines how an UV channel is transformed.
  436. *
  437. * This is just a helper structure for the #AI_MATKEY_UVTRANSFORM key.
  438. * See its documentation for more details.
  439. *
  440. * Typically you'll want to build a matrix of this information. However,
  441. * we keep separate scaling/translation/rotation values to make it
  442. * easier to process and optimize UV transformations internally.
  443. */
  444. struct aiUVTransform {
  445. /** Translation on the u and v axes.
  446. *
  447. * The default value is (0|0).
  448. */
  449. C_STRUCT aiVector2D mTranslation;
  450. /** Scaling on the u and v axes.
  451. *
  452. * The default value is (1|1).
  453. */
  454. C_STRUCT aiVector2D mScaling;
  455. /** Rotation - in counter-clockwise direction.
  456. *
  457. * The rotation angle is specified in radians. The
  458. * rotation center is 0.5f|0.5f. The default value
  459. * 0.f.
  460. */
  461. ai_real mRotation;
  462. #ifdef __cplusplus
  463. aiUVTransform() AI_NO_EXCEPT
  464. : mTranslation(0.0, 0.0),
  465. mScaling(1.0, 1.0),
  466. mRotation(0.0) {
  467. // nothing to be done here ...
  468. }
  469. #endif
  470. };
  471. #include "./Compiler/poppack1.h"
  472. //! @cond AI_DOX_INCLUDE_INTERNAL
  473. // ---------------------------------------------------------------------------
  474. /** @brief A very primitive RTTI system for the contents of material
  475. * properties.
  476. */
  477. enum aiPropertyTypeInfo {
  478. /** Array of single-precision (32 Bit) floats
  479. *
  480. * It is possible to use aiGetMaterialInteger[Array]() (or the C++-API
  481. * aiMaterial::Get()) to query properties stored in floating-point format.
  482. * The material system performs the type conversion automatically.
  483. */
  484. aiPTI_Float = 0x1,
  485. /** Array of double-precision (64 Bit) floats
  486. *
  487. * It is possible to use aiGetMaterialInteger[Array]() (or the C++-API
  488. * aiMaterial::Get()) to query properties stored in floating-point format.
  489. * The material system performs the type conversion automatically.
  490. */
  491. aiPTI_Double = 0x2,
  492. /** The material property is an aiString.
  493. *
  494. * Arrays of strings aren't possible, aiGetMaterialString() (or the
  495. * C++-API aiMaterial::Get()) *must* be used to query a string property.
  496. */
  497. aiPTI_String = 0x3,
  498. /** Array of (32 Bit) integers
  499. *
  500. * It is possible to use aiGetMaterialFloat[Array]() (or the C++-API
  501. * aiMaterial::Get()) to query properties stored in integer format.
  502. * The material system performs the type conversion automatically.
  503. */
  504. aiPTI_Integer = 0x4,
  505. /** Simple binary buffer, content undefined. Not convertible to anything.
  506. */
  507. aiPTI_Buffer = 0x5,
  508. /** This value is not used. It is just there to force the
  509. * compiler to map this enum to a 32 Bit integer.
  510. */
  511. #ifndef SWIG
  512. _aiPTI_Force32Bit = INT_MAX
  513. #endif
  514. };
  515. // ---------------------------------------------------------------------------
  516. /** @brief Data structure for a single material property
  517. *
  518. * As an user, you'll probably never need to deal with this data structure.
  519. * Just use the provided aiGetMaterialXXX() or aiMaterial::Get() family
  520. * of functions to query material properties easily. Processing them
  521. * manually is faster, but it is not the recommended way. It isn't worth
  522. * the effort. <br>
  523. * Material property names follow a simple scheme:
  524. * @code
  525. * $<name>
  526. * ?<name>
  527. * A public property, there must be corresponding AI_MATKEY_XXX define
  528. * 2nd: Public, but ignored by the #aiProcess_RemoveRedundantMaterials
  529. * post-processing step.
  530. * ~<name>
  531. * A temporary property for internal use.
  532. * @endcode
  533. * @see aiMaterial
  534. */
  535. struct aiMaterialProperty {
  536. /** Specifies the name of the property (key)
  537. * Keys are generally case insensitive.
  538. */
  539. C_STRUCT aiString mKey;
  540. /** Textures: Specifies their exact usage semantic.
  541. * For non-texture properties, this member is always 0
  542. * (or, better-said, #aiTextureType_NONE).
  543. */
  544. unsigned int mSemantic;
  545. /** Textures: Specifies the index of the texture.
  546. * For non-texture properties, this member is always 0.
  547. */
  548. unsigned int mIndex;
  549. /** Size of the buffer mData is pointing to, in bytes.
  550. * This value may not be 0.
  551. */
  552. unsigned int mDataLength;
  553. /** Type information for the property.
  554. *
  555. * Defines the data layout inside the data buffer. This is used
  556. * by the library internally to perform debug checks and to
  557. * utilize proper type conversions.
  558. * (It's probably a hacky solution, but it works.)
  559. */
  560. C_ENUM aiPropertyTypeInfo mType;
  561. /** Binary buffer to hold the property's value.
  562. * The size of the buffer is always mDataLength.
  563. */
  564. char *mData;
  565. #ifdef __cplusplus
  566. aiMaterialProperty() AI_NO_EXCEPT
  567. : mSemantic(0),
  568. mIndex(0),
  569. mDataLength(0),
  570. mType(aiPTI_Float),
  571. mData(nullptr) {
  572. // empty
  573. }
  574. ~aiMaterialProperty() {
  575. delete[] mData;
  576. mData = nullptr;
  577. }
  578. #endif
  579. };
  580. //! @endcond
  581. #ifdef __cplusplus
  582. } // We need to leave the "C" block here to allow template member functions
  583. #endif
  584. // ---------------------------------------------------------------------------
  585. /** @brief Data structure for a material
  586. *
  587. * Material data is stored using a key-value structure. A single key-value
  588. * pair is called a 'material property'. C++ users should use the provided
  589. * member functions of aiMaterial to process material properties, C users
  590. * have to stick with the aiMaterialGetXXX family of unbound functions.
  591. * The library defines a set of standard keys (AI_MATKEY_XXX).
  592. */
  593. #ifdef __cplusplus
  594. struct ASSIMP_API aiMaterial
  595. #else
  596. struct aiMaterial
  597. #endif
  598. {
  599. #ifdef __cplusplus
  600. public:
  601. aiMaterial();
  602. ~aiMaterial();
  603. // -------------------------------------------------------------------
  604. /**
  605. * @brief Returns the name of the material.
  606. * @return The name of the material.
  607. */
  608. // -------------------------------------------------------------------
  609. aiString GetName() const;
  610. // -------------------------------------------------------------------
  611. /** @brief Retrieve an array of Type values with a specific key
  612. * from the material
  613. *
  614. * @param pKey Key to search for. One of the AI_MATKEY_XXX constants.
  615. * @param type .. set by AI_MATKEY_XXX
  616. * @param idx .. set by AI_MATKEY_XXX
  617. * @param pOut Pointer to a buffer to receive the result.
  618. * @param pMax Specifies the size of the given buffer, in Type's.
  619. * Receives the number of values (not bytes!) read.
  620. * NULL is a valid value for this parameter.
  621. */
  622. template <typename Type>
  623. aiReturn Get(const char *pKey, unsigned int type,
  624. unsigned int idx, Type *pOut, unsigned int *pMax) const;
  625. aiReturn Get(const char *pKey, unsigned int type,
  626. unsigned int idx, int *pOut, unsigned int *pMax) const;
  627. aiReturn Get(const char *pKey, unsigned int type,
  628. unsigned int idx, ai_real *pOut, unsigned int *pMax) const;
  629. // -------------------------------------------------------------------
  630. /** @brief Retrieve a Type value with a specific key
  631. * from the material
  632. *
  633. * @param pKey Key to search for. One of the AI_MATKEY_XXX constants.
  634. * @param type Specifies the type of the texture to be retrieved (
  635. * e.g. diffuse, specular, height map ...)
  636. * @param idx Index of the texture to be retrieved.
  637. * @param pOut Reference to receive the output value
  638. */
  639. template <typename Type>
  640. aiReturn Get(const char *pKey, unsigned int type,
  641. unsigned int idx, Type &pOut) const;
  642. aiReturn Get(const char *pKey, unsigned int type,
  643. unsigned int idx, int &pOut) const;
  644. aiReturn Get(const char *pKey, unsigned int type,
  645. unsigned int idx, ai_real &pOut) const;
  646. aiReturn Get(const char *pKey, unsigned int type,
  647. unsigned int idx, aiString &pOut) const;
  648. aiReturn Get(const char *pKey, unsigned int type,
  649. unsigned int idx, aiColor3D &pOut) const;
  650. aiReturn Get(const char *pKey, unsigned int type,
  651. unsigned int idx, aiColor4D &pOut) const;
  652. aiReturn Get(const char *pKey, unsigned int type,
  653. unsigned int idx, aiUVTransform &pOut) const;
  654. // -------------------------------------------------------------------
  655. /** Get the number of textures for a particular texture type.
  656. * @param type Texture type to check for
  657. * @return Number of textures for this type.
  658. * @note A texture can be easily queried using #GetTexture() */
  659. unsigned int GetTextureCount(aiTextureType type) const;
  660. // -------------------------------------------------------------------
  661. /** Helper function to get all parameters pertaining to a
  662. * particular texture slot from a material.
  663. *
  664. * This function is provided just for convenience, you could also
  665. * read the single material properties manually.
  666. * @param type Specifies the type of the texture to be retrieved (
  667. * e.g. diffuse, specular, height map ...)
  668. * @param index Index of the texture to be retrieved. The function fails
  669. * if there is no texture of that type with this index.
  670. * #GetTextureCount() can be used to determine the number of textures
  671. * per texture type.
  672. * @param path Receives the path to the texture.
  673. * Use aiScene::GetEmbeddedTexture() method to determine if returned path
  674. * is an image file to be opened or a string key of embedded texture stored in the corresponding scene
  675. * (could be a '*' followed by the id of the texture in case of no name)
  676. * NULL is a valid value.
  677. * @param mapping The texture mapping.
  678. * NULL is allowed as value.
  679. * @param uvindex Receives the UV index of the texture.
  680. * NULL is a valid value.
  681. * @param blend Receives the blend factor for the texture
  682. * NULL is a valid value.
  683. * @param op Receives the texture operation to be performed between
  684. * this texture and the previous texture. NULL is allowed as value.
  685. * @param mapmode Receives the mapping modes to be used for the texture.
  686. * The parameter may be NULL but if it is a valid pointer it MUST
  687. * point to an array of 3 aiTextureMapMode's (one for each
  688. * axis: UVW order (=XYZ)).
  689. */
  690. // -------------------------------------------------------------------
  691. aiReturn GetTexture(aiTextureType type,
  692. unsigned int index,
  693. C_STRUCT aiString *path,
  694. aiTextureMapping *mapping = NULL,
  695. unsigned int *uvindex = NULL,
  696. ai_real *blend = NULL,
  697. aiTextureOp *op = NULL,
  698. aiTextureMapMode *mapmode = NULL) const;
  699. // Setters
  700. // ------------------------------------------------------------------------------
  701. /** @brief Add a property with a given key and type info to the material
  702. * structure
  703. *
  704. * @param pInput Pointer to input data
  705. * @param pSizeInBytes Size of input data
  706. * @param pKey Key/Usage of the property (AI_MATKEY_XXX)
  707. * @param type Set by the AI_MATKEY_XXX macro
  708. * @param index Set by the AI_MATKEY_XXX macro
  709. * @param pType Type information hint */
  710. aiReturn AddBinaryProperty(const void *pInput,
  711. unsigned int pSizeInBytes,
  712. const char *pKey,
  713. unsigned int type,
  714. unsigned int index,
  715. aiPropertyTypeInfo pType);
  716. // ------------------------------------------------------------------------------
  717. /** @brief Add a string property with a given key and type info to the
  718. * material structure
  719. *
  720. * @param pInput Input string
  721. * @param pKey Key/Usage of the property (AI_MATKEY_XXX)
  722. * @param type Set by the AI_MATKEY_XXX macro
  723. * @param index Set by the AI_MATKEY_XXX macro */
  724. aiReturn AddProperty(const aiString *pInput,
  725. const char *pKey,
  726. unsigned int type = 0,
  727. unsigned int index = 0);
  728. // ------------------------------------------------------------------------------
  729. /** @brief Add a property with a given key to the material structure
  730. * @param pInput Pointer to the input data
  731. * @param pNumValues Number of values in the array
  732. * @param pKey Key/Usage of the property (AI_MATKEY_XXX)
  733. * @param type Set by the AI_MATKEY_XXX macro
  734. * @param index Set by the AI_MATKEY_XXX macro */
  735. template <class TYPE>
  736. aiReturn AddProperty(const TYPE *pInput,
  737. unsigned int pNumValues,
  738. const char *pKey,
  739. unsigned int type = 0,
  740. unsigned int index = 0);
  741. aiReturn AddProperty(const aiVector3D *pInput,
  742. unsigned int pNumValues,
  743. const char *pKey,
  744. unsigned int type = 0,
  745. unsigned int index = 0);
  746. aiReturn AddProperty(const aiColor3D *pInput,
  747. unsigned int pNumValues,
  748. const char *pKey,
  749. unsigned int type = 0,
  750. unsigned int index = 0);
  751. aiReturn AddProperty(const aiColor4D *pInput,
  752. unsigned int pNumValues,
  753. const char *pKey,
  754. unsigned int type = 0,
  755. unsigned int index = 0);
  756. aiReturn AddProperty(const int *pInput,
  757. unsigned int pNumValues,
  758. const char *pKey,
  759. unsigned int type = 0,
  760. unsigned int index = 0);
  761. aiReturn AddProperty(const float *pInput,
  762. unsigned int pNumValues,
  763. const char *pKey,
  764. unsigned int type = 0,
  765. unsigned int index = 0);
  766. aiReturn AddProperty(const double *pInput,
  767. unsigned int pNumValues,
  768. const char *pKey,
  769. unsigned int type = 0,
  770. unsigned int index = 0);
  771. aiReturn AddProperty(const aiUVTransform *pInput,
  772. unsigned int pNumValues,
  773. const char *pKey,
  774. unsigned int type = 0,
  775. unsigned int index = 0);
  776. // ------------------------------------------------------------------------------
  777. /** @brief Remove a given key from the list.
  778. *
  779. * The function fails if the key isn't found
  780. * @param pKey Key to be deleted
  781. * @param type Set by the AI_MATKEY_XXX macro
  782. * @param index Set by the AI_MATKEY_XXX macro */
  783. aiReturn RemoveProperty(const char *pKey,
  784. unsigned int type = 0,
  785. unsigned int index = 0);
  786. // ------------------------------------------------------------------------------
  787. /** @brief Removes all properties from the material.
  788. *
  789. * The data array remains allocated so adding new properties is quite fast. */
  790. void Clear();
  791. // ------------------------------------------------------------------------------
  792. /** Copy the property list of a material
  793. * @param pcDest Destination material
  794. * @param pcSrc Source material
  795. */
  796. static void CopyPropertyList(aiMaterial *pcDest,
  797. const aiMaterial *pcSrc);
  798. #endif
  799. /** List of all material properties loaded. */
  800. C_STRUCT aiMaterialProperty **mProperties;
  801. /** Number of properties in the data base */
  802. unsigned int mNumProperties;
  803. /** Storage allocated */
  804. unsigned int mNumAllocated;
  805. };
  806. // Go back to extern "C" again
  807. #ifdef __cplusplus
  808. extern "C" {
  809. #endif
  810. // ---------------------------------------------------------------------------
  811. #define AI_MATKEY_NAME "?mat.name", 0, 0
  812. #define AI_MATKEY_TWOSIDED "$mat.twosided", 0, 0
  813. #define AI_MATKEY_SHADING_MODEL "$mat.shadingm", 0, 0
  814. #define AI_MATKEY_ENABLE_WIREFRAME "$mat.wireframe", 0, 0
  815. #define AI_MATKEY_BLEND_FUNC "$mat.blend", 0, 0
  816. #define AI_MATKEY_OPACITY "$mat.opacity", 0, 0
  817. #define AI_MATKEY_TRANSPARENCYFACTOR "$mat.transparencyfactor", 0, 0
  818. #define AI_MATKEY_BUMPSCALING "$mat.bumpscaling", 0, 0
  819. #define AI_MATKEY_SHININESS "$mat.shininess", 0, 0
  820. #define AI_MATKEY_REFLECTIVITY "$mat.reflectivity", 0, 0
  821. #define AI_MATKEY_SHININESS_STRENGTH "$mat.shinpercent", 0, 0
  822. #define AI_MATKEY_REFRACTI "$mat.refracti", 0, 0
  823. #define AI_MATKEY_COLOR_DIFFUSE "$clr.diffuse", 0, 0
  824. #define AI_MATKEY_COLOR_AMBIENT "$clr.ambient", 0, 0
  825. #define AI_MATKEY_COLOR_SPECULAR "$clr.specular", 0, 0
  826. #define AI_MATKEY_COLOR_EMISSIVE "$clr.emissive", 0, 0
  827. #define AI_MATKEY_COLOR_TRANSPARENT "$clr.transparent", 0, 0
  828. #define AI_MATKEY_COLOR_REFLECTIVE "$clr.reflective", 0, 0
  829. #define AI_MATKEY_GLOBAL_BACKGROUND_IMAGE "?bg.global", 0, 0
  830. #define AI_MATKEY_GLOBAL_SHADERLANG "?sh.lang", 0, 0
  831. #define AI_MATKEY_SHADER_VERTEX "?sh.vs", 0, 0
  832. #define AI_MATKEY_SHADER_FRAGMENT "?sh.fs", 0, 0
  833. #define AI_MATKEY_SHADER_GEO "?sh.gs", 0, 0
  834. #define AI_MATKEY_SHADER_TESSELATION "?sh.ts", 0, 0
  835. #define AI_MATKEY_SHADER_PRIMITIVE "?sh.ps", 0, 0
  836. #define AI_MATKEY_SHADER_COMPUTE "?sh.cs", 0, 0
  837. // ---------------------------------------------------------------------------
  838. // PBR material support
  839. // --------------------
  840. // Properties defining PBR rendering techniques
  841. #define AI_MATKEY_USE_COLOR_MAP "$mat.useColorMap", 0, 0
  842. // Metallic/Roughness Workflow
  843. // ---------------------------
  844. // Base RGBA color factor. Will be multiplied by final base color texture values if extant
  845. // Note: Importers may choose to copy this into AI_MATKEY_COLOR_DIFFUSE for compatibility
  846. // with renderers and formats that do not support Metallic/Roughness PBR
  847. #define AI_MATKEY_BASE_COLOR "$clr.base", 0, 0
  848. #define AI_MATKEY_BASE_COLOR_TEXTURE aiTextureType_BASE_COLOR, 0
  849. #define AI_MATKEY_USE_METALLIC_MAP "$mat.useMetallicMap", 0, 0
  850. // Metallic factor. 0.0 = Full Dielectric, 1.0 = Full Metal
  851. #define AI_MATKEY_METALLIC_FACTOR "$mat.metallicFactor", 0, 0
  852. #define AI_MATKEY_METALLIC_TEXTURE aiTextureType_METALNESS, 0
  853. #define AI_MATKEY_USE_ROUGHNESS_MAP "$mat.useRoughnessMap", 0, 0
  854. // Roughness factor. 0.0 = Perfectly Smooth, 1.0 = Completely Rough
  855. #define AI_MATKEY_ROUGHNESS_FACTOR "$mat.roughnessFactor", 0, 0
  856. #define AI_MATKEY_ROUGHNESS_TEXTURE aiTextureType_DIFFUSE_ROUGHNESS, 0
  857. // Anisotropy factor. 0.0 = isotropic, 1.0 = anisotropy along tangent direction,
  858. // -1.0 = anisotropy along bitangent direction
  859. #define AI_MATKEY_ANISOTROPY_FACTOR "$mat.anisotropyFactor", 0, 0
  860. // Specular/Glossiness Workflow
  861. // ---------------------------
  862. // Diffuse/Albedo Color. Note: Pure Metals have a diffuse of {0,0,0}
  863. // AI_MATKEY_COLOR_DIFFUSE
  864. // Specular Color.
  865. // Note: Metallic/Roughness may also have a Specular Color
  866. // AI_MATKEY_COLOR_SPECULAR
  867. #define AI_MATKEY_SPECULAR_FACTOR "$mat.specularFactor", 0, 0
  868. // Glossiness factor. 0.0 = Completely Rough, 1.0 = Perfectly Smooth
  869. #define AI_MATKEY_GLOSSINESS_FACTOR "$mat.glossinessFactor", 0, 0
  870. // Sheen
  871. // -----
  872. // Sheen base RGB color. Default {0,0,0}
  873. #define AI_MATKEY_SHEEN_COLOR_FACTOR "$clr.sheen.factor", 0, 0
  874. // Sheen Roughness Factor.
  875. #define AI_MATKEY_SHEEN_ROUGHNESS_FACTOR "$mat.sheen.roughnessFactor", 0, 0
  876. #define AI_MATKEY_SHEEN_COLOR_TEXTURE aiTextureType_SHEEN, 0
  877. #define AI_MATKEY_SHEEN_ROUGHNESS_TEXTURE aiTextureType_SHEEN, 1
  878. // Clearcoat
  879. // ---------
  880. // Clearcoat layer intensity. 0.0 = none (disabled)
  881. #define AI_MATKEY_CLEARCOAT_FACTOR "$mat.clearcoat.factor", 0, 0
  882. #define AI_MATKEY_CLEARCOAT_ROUGHNESS_FACTOR "$mat.clearcoat.roughnessFactor", 0, 0
  883. #define AI_MATKEY_CLEARCOAT_TEXTURE aiTextureType_CLEARCOAT, 0
  884. #define AI_MATKEY_CLEARCOAT_ROUGHNESS_TEXTURE aiTextureType_CLEARCOAT, 1
  885. #define AI_MATKEY_CLEARCOAT_NORMAL_TEXTURE aiTextureType_CLEARCOAT, 2
  886. // Transmission
  887. // ------------
  888. // https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_transmission
  889. // Base percentage of light transmitted through the surface. 0.0 = Opaque, 1.0 = Fully transparent
  890. #define AI_MATKEY_TRANSMISSION_FACTOR "$mat.transmission.factor", 0, 0
  891. // Texture defining percentage of light transmitted through the surface.
  892. // Multiplied by AI_MATKEY_TRANSMISSION_FACTOR
  893. #define AI_MATKEY_TRANSMISSION_TEXTURE aiTextureType_TRANSMISSION, 0
  894. // Volume
  895. // ------------
  896. // https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_volume
  897. // 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.
  898. #define AI_MATKEY_VOLUME_THICKNESS_FACTOR "$mat.volume.thicknessFactor", 0, 0
  899. // Texture that defines the thickness.
  900. // Multiplied by AI_MATKEY_THICKNESS_FACTOR
  901. #define AI_MATKEY_VOLUME_THICKNESS_TEXTURE aiTextureType_TRANSMISSION, 1
  902. // Density of the medium given as the average distance that light travels in the medium before interacting with a particle.
  903. #define AI_MATKEY_VOLUME_ATTENUATION_DISTANCE "$mat.volume.attenuationDistance", 0, 0
  904. // The color that white light turns into due to absorption when reaching the attenuation distance.
  905. #define AI_MATKEY_VOLUME_ATTENUATION_COLOR "$mat.volume.attenuationColor", 0, 0
  906. // Emissive
  907. // --------
  908. #define AI_MATKEY_USE_EMISSIVE_MAP "$mat.useEmissiveMap", 0, 0
  909. #define AI_MATKEY_EMISSIVE_INTENSITY "$mat.emissiveIntensity", 0, 0
  910. #define AI_MATKEY_USE_AO_MAP "$mat.useAOMap", 0, 0
  911. // ---------------------------------------------------------------------------
  912. // Pure key names for all texture-related properties
  913. //! @cond MATS_DOC_FULL
  914. #define _AI_MATKEY_TEXTURE_BASE "$tex.file"
  915. #define _AI_MATKEY_UVWSRC_BASE "$tex.uvwsrc"
  916. #define _AI_MATKEY_TEXOP_BASE "$tex.op"
  917. #define _AI_MATKEY_MAPPING_BASE "$tex.mapping"
  918. #define _AI_MATKEY_TEXBLEND_BASE "$tex.blend"
  919. #define _AI_MATKEY_MAPPINGMODE_U_BASE "$tex.mapmodeu"
  920. #define _AI_MATKEY_MAPPINGMODE_V_BASE "$tex.mapmodev"
  921. #define _AI_MATKEY_TEXMAP_AXIS_BASE "$tex.mapaxis"
  922. #define _AI_MATKEY_UVTRANSFORM_BASE "$tex.uvtrafo"
  923. #define _AI_MATKEY_TEXFLAGS_BASE "$tex.flags"
  924. //! @endcond
  925. // ---------------------------------------------------------------------------
  926. #define AI_MATKEY_TEXTURE(type, N) _AI_MATKEY_TEXTURE_BASE, type, N
  927. // For backward compatibility and simplicity
  928. //! @cond MATS_DOC_FULL
  929. #define AI_MATKEY_TEXTURE_DIFFUSE(N) \
  930. AI_MATKEY_TEXTURE(aiTextureType_DIFFUSE, N)
  931. #define AI_MATKEY_TEXTURE_SPECULAR(N) \
  932. AI_MATKEY_TEXTURE(aiTextureType_SPECULAR, N)
  933. #define AI_MATKEY_TEXTURE_AMBIENT(N) \
  934. AI_MATKEY_TEXTURE(aiTextureType_AMBIENT, N)
  935. #define AI_MATKEY_TEXTURE_EMISSIVE(N) \
  936. AI_MATKEY_TEXTURE(aiTextureType_EMISSIVE, N)
  937. #define AI_MATKEY_TEXTURE_NORMALS(N) \
  938. AI_MATKEY_TEXTURE(aiTextureType_NORMALS, N)
  939. #define AI_MATKEY_TEXTURE_HEIGHT(N) \
  940. AI_MATKEY_TEXTURE(aiTextureType_HEIGHT, N)
  941. #define AI_MATKEY_TEXTURE_SHININESS(N) \
  942. AI_MATKEY_TEXTURE(aiTextureType_SHININESS, N)
  943. #define AI_MATKEY_TEXTURE_OPACITY(N) \
  944. AI_MATKEY_TEXTURE(aiTextureType_OPACITY, N)
  945. #define AI_MATKEY_TEXTURE_DISPLACEMENT(N) \
  946. AI_MATKEY_TEXTURE(aiTextureType_DISPLACEMENT, N)
  947. #define AI_MATKEY_TEXTURE_LIGHTMAP(N) \
  948. AI_MATKEY_TEXTURE(aiTextureType_LIGHTMAP, N)
  949. #define AI_MATKEY_TEXTURE_REFLECTION(N) \
  950. AI_MATKEY_TEXTURE(aiTextureType_REFLECTION, N)
  951. //! @endcond
  952. // ---------------------------------------------------------------------------
  953. #define AI_MATKEY_UVWSRC(type, N) _AI_MATKEY_UVWSRC_BASE, type, N
  954. // For backward compatibility and simplicity
  955. //! @cond MATS_DOC_FULL
  956. #define AI_MATKEY_UVWSRC_DIFFUSE(N) \
  957. AI_MATKEY_UVWSRC(aiTextureType_DIFFUSE, N)
  958. #define AI_MATKEY_UVWSRC_SPECULAR(N) \
  959. AI_MATKEY_UVWSRC(aiTextureType_SPECULAR, N)
  960. #define AI_MATKEY_UVWSRC_AMBIENT(N) \
  961. AI_MATKEY_UVWSRC(aiTextureType_AMBIENT, N)
  962. #define AI_MATKEY_UVWSRC_EMISSIVE(N) \
  963. AI_MATKEY_UVWSRC(aiTextureType_EMISSIVE, N)
  964. #define AI_MATKEY_UVWSRC_NORMALS(N) \
  965. AI_MATKEY_UVWSRC(aiTextureType_NORMALS, N)
  966. #define AI_MATKEY_UVWSRC_HEIGHT(N) \
  967. AI_MATKEY_UVWSRC(aiTextureType_HEIGHT, N)
  968. #define AI_MATKEY_UVWSRC_SHININESS(N) \
  969. AI_MATKEY_UVWSRC(aiTextureType_SHININESS, N)
  970. #define AI_MATKEY_UVWSRC_OPACITY(N) \
  971. AI_MATKEY_UVWSRC(aiTextureType_OPACITY, N)
  972. #define AI_MATKEY_UVWSRC_DISPLACEMENT(N) \
  973. AI_MATKEY_UVWSRC(aiTextureType_DISPLACEMENT, N)
  974. #define AI_MATKEY_UVWSRC_LIGHTMAP(N) \
  975. AI_MATKEY_UVWSRC(aiTextureType_LIGHTMAP, N)
  976. #define AI_MATKEY_UVWSRC_REFLECTION(N) \
  977. AI_MATKEY_UVWSRC(aiTextureType_REFLECTION, N)
  978. //! @endcond
  979. // ---------------------------------------------------------------------------
  980. #define AI_MATKEY_TEXOP(type, N) _AI_MATKEY_TEXOP_BASE, type, N
  981. // For backward compatibility and simplicity
  982. //! @cond MATS_DOC_FULL
  983. #define AI_MATKEY_TEXOP_DIFFUSE(N) \
  984. AI_MATKEY_TEXOP(aiTextureType_DIFFUSE, N)
  985. #define AI_MATKEY_TEXOP_SPECULAR(N) \
  986. AI_MATKEY_TEXOP(aiTextureType_SPECULAR, N)
  987. #define AI_MATKEY_TEXOP_AMBIENT(N) \
  988. AI_MATKEY_TEXOP(aiTextureType_AMBIENT, N)
  989. #define AI_MATKEY_TEXOP_EMISSIVE(N) \
  990. AI_MATKEY_TEXOP(aiTextureType_EMISSIVE, N)
  991. #define AI_MATKEY_TEXOP_NORMALS(N) \
  992. AI_MATKEY_TEXOP(aiTextureType_NORMALS, N)
  993. #define AI_MATKEY_TEXOP_HEIGHT(N) \
  994. AI_MATKEY_TEXOP(aiTextureType_HEIGHT, N)
  995. #define AI_MATKEY_TEXOP_SHININESS(N) \
  996. AI_MATKEY_TEXOP(aiTextureType_SHININESS, N)
  997. #define AI_MATKEY_TEXOP_OPACITY(N) \
  998. AI_MATKEY_TEXOP(aiTextureType_OPACITY, N)
  999. #define AI_MATKEY_TEXOP_DISPLACEMENT(N) \
  1000. AI_MATKEY_TEXOP(aiTextureType_DISPLACEMENT, N)
  1001. #define AI_MATKEY_TEXOP_LIGHTMAP(N) \
  1002. AI_MATKEY_TEXOP(aiTextureType_LIGHTMAP, N)
  1003. #define AI_MATKEY_TEXOP_REFLECTION(N) \
  1004. AI_MATKEY_TEXOP(aiTextureType_REFLECTION, N)
  1005. //! @endcond
  1006. // ---------------------------------------------------------------------------
  1007. #define AI_MATKEY_MAPPING(type, N) _AI_MATKEY_MAPPING_BASE, type, N
  1008. // For backward compatibility and simplicity
  1009. //! @cond MATS_DOC_FULL
  1010. #define AI_MATKEY_MAPPING_DIFFUSE(N) \
  1011. AI_MATKEY_MAPPING(aiTextureType_DIFFUSE, N)
  1012. #define AI_MATKEY_MAPPING_SPECULAR(N) \
  1013. AI_MATKEY_MAPPING(aiTextureType_SPECULAR, N)
  1014. #define AI_MATKEY_MAPPING_AMBIENT(N) \
  1015. AI_MATKEY_MAPPING(aiTextureType_AMBIENT, N)
  1016. #define AI_MATKEY_MAPPING_EMISSIVE(N) \
  1017. AI_MATKEY_MAPPING(aiTextureType_EMISSIVE, N)
  1018. #define AI_MATKEY_MAPPING_NORMALS(N) \
  1019. AI_MATKEY_MAPPING(aiTextureType_NORMALS, N)
  1020. #define AI_MATKEY_MAPPING_HEIGHT(N) \
  1021. AI_MATKEY_MAPPING(aiTextureType_HEIGHT, N)
  1022. #define AI_MATKEY_MAPPING_SHININESS(N) \
  1023. AI_MATKEY_MAPPING(aiTextureType_SHININESS, N)
  1024. #define AI_MATKEY_MAPPING_OPACITY(N) \
  1025. AI_MATKEY_MAPPING(aiTextureType_OPACITY, N)
  1026. #define AI_MATKEY_MAPPING_DISPLACEMENT(N) \
  1027. AI_MATKEY_MAPPING(aiTextureType_DISPLACEMENT, N)
  1028. #define AI_MATKEY_MAPPING_LIGHTMAP(N) \
  1029. AI_MATKEY_MAPPING(aiTextureType_LIGHTMAP, N)
  1030. #define AI_MATKEY_MAPPING_REFLECTION(N) \
  1031. AI_MATKEY_MAPPING(aiTextureType_REFLECTION, N)
  1032. //! @endcond
  1033. // ---------------------------------------------------------------------------
  1034. #define AI_MATKEY_TEXBLEND(type, N) _AI_MATKEY_TEXBLEND_BASE, type, N
  1035. // For backward compatibility and simplicity
  1036. //! @cond MATS_DOC_FULL
  1037. #define AI_MATKEY_TEXBLEND_DIFFUSE(N) \
  1038. AI_MATKEY_TEXBLEND(aiTextureType_DIFFUSE, N)
  1039. #define AI_MATKEY_TEXBLEND_SPECULAR(N) \
  1040. AI_MATKEY_TEXBLEND(aiTextureType_SPECULAR, N)
  1041. #define AI_MATKEY_TEXBLEND_AMBIENT(N) \
  1042. AI_MATKEY_TEXBLEND(aiTextureType_AMBIENT, N)
  1043. #define AI_MATKEY_TEXBLEND_EMISSIVE(N) \
  1044. AI_MATKEY_TEXBLEND(aiTextureType_EMISSIVE, N)
  1045. #define AI_MATKEY_TEXBLEND_NORMALS(N) \
  1046. AI_MATKEY_TEXBLEND(aiTextureType_NORMALS, N)
  1047. #define AI_MATKEY_TEXBLEND_HEIGHT(N) \
  1048. AI_MATKEY_TEXBLEND(aiTextureType_HEIGHT, N)
  1049. #define AI_MATKEY_TEXBLEND_SHININESS(N) \
  1050. AI_MATKEY_TEXBLEND(aiTextureType_SHININESS, N)
  1051. #define AI_MATKEY_TEXBLEND_OPACITY(N) \
  1052. AI_MATKEY_TEXBLEND(aiTextureType_OPACITY, N)
  1053. #define AI_MATKEY_TEXBLEND_DISPLACEMENT(N) \
  1054. AI_MATKEY_TEXBLEND(aiTextureType_DISPLACEMENT, N)
  1055. #define AI_MATKEY_TEXBLEND_LIGHTMAP(N) \
  1056. AI_MATKEY_TEXBLEND(aiTextureType_LIGHTMAP, N)
  1057. #define AI_MATKEY_TEXBLEND_REFLECTION(N) \
  1058. AI_MATKEY_TEXBLEND(aiTextureType_REFLECTION, N)
  1059. //! @endcond
  1060. // ---------------------------------------------------------------------------
  1061. #define AI_MATKEY_MAPPINGMODE_U(type, N) _AI_MATKEY_MAPPINGMODE_U_BASE, type, N
  1062. // For backward compatibility and simplicity
  1063. //! @cond MATS_DOC_FULL
  1064. #define AI_MATKEY_MAPPINGMODE_U_DIFFUSE(N) \
  1065. AI_MATKEY_MAPPINGMODE_U(aiTextureType_DIFFUSE, N)
  1066. #define AI_MATKEY_MAPPINGMODE_U_SPECULAR(N) \
  1067. AI_MATKEY_MAPPINGMODE_U(aiTextureType_SPECULAR, N)
  1068. #define AI_MATKEY_MAPPINGMODE_U_AMBIENT(N) \
  1069. AI_MATKEY_MAPPINGMODE_U(aiTextureType_AMBIENT, N)
  1070. #define AI_MATKEY_MAPPINGMODE_U_EMISSIVE(N) \
  1071. AI_MATKEY_MAPPINGMODE_U(aiTextureType_EMISSIVE, N)
  1072. #define AI_MATKEY_MAPPINGMODE_U_NORMALS(N) \
  1073. AI_MATKEY_MAPPINGMODE_U(aiTextureType_NORMALS, N)
  1074. #define AI_MATKEY_MAPPINGMODE_U_HEIGHT(N) \
  1075. AI_MATKEY_MAPPINGMODE_U(aiTextureType_HEIGHT, N)
  1076. #define AI_MATKEY_MAPPINGMODE_U_SHININESS(N) \
  1077. AI_MATKEY_MAPPINGMODE_U(aiTextureType_SHININESS, N)
  1078. #define AI_MATKEY_MAPPINGMODE_U_OPACITY(N) \
  1079. AI_MATKEY_MAPPINGMODE_U(aiTextureType_OPACITY, N)
  1080. #define AI_MATKEY_MAPPINGMODE_U_DISPLACEMENT(N) \
  1081. AI_MATKEY_MAPPINGMODE_U(aiTextureType_DISPLACEMENT, N)
  1082. #define AI_MATKEY_MAPPINGMODE_U_LIGHTMAP(N) \
  1083. AI_MATKEY_MAPPINGMODE_U(aiTextureType_LIGHTMAP, N)
  1084. #define AI_MATKEY_MAPPINGMODE_U_REFLECTION(N) \
  1085. AI_MATKEY_MAPPINGMODE_U(aiTextureType_REFLECTION, N)
  1086. //! @endcond
  1087. // ---------------------------------------------------------------------------
  1088. #define AI_MATKEY_MAPPINGMODE_V(type, N) _AI_MATKEY_MAPPINGMODE_V_BASE, type, N
  1089. // For backward compatibility and simplicity
  1090. //! @cond MATS_DOC_FULL
  1091. #define AI_MATKEY_MAPPINGMODE_V_DIFFUSE(N) \
  1092. AI_MATKEY_MAPPINGMODE_V(aiTextureType_DIFFUSE, N)
  1093. #define AI_MATKEY_MAPPINGMODE_V_SPECULAR(N) \
  1094. AI_MATKEY_MAPPINGMODE_V(aiTextureType_SPECULAR, N)
  1095. #define AI_MATKEY_MAPPINGMODE_V_AMBIENT(N) \
  1096. AI_MATKEY_MAPPINGMODE_V(aiTextureType_AMBIENT, N)
  1097. #define AI_MATKEY_MAPPINGMODE_V_EMISSIVE(N) \
  1098. AI_MATKEY_MAPPINGMODE_V(aiTextureType_EMISSIVE, N)
  1099. #define AI_MATKEY_MAPPINGMODE_V_NORMALS(N) \
  1100. AI_MATKEY_MAPPINGMODE_V(aiTextureType_NORMALS, N)
  1101. #define AI_MATKEY_MAPPINGMODE_V_HEIGHT(N) \
  1102. AI_MATKEY_MAPPINGMODE_V(aiTextureType_HEIGHT, N)
  1103. #define AI_MATKEY_MAPPINGMODE_V_SHININESS(N) \
  1104. AI_MATKEY_MAPPINGMODE_V(aiTextureType_SHININESS, N)
  1105. #define AI_MATKEY_MAPPINGMODE_V_OPACITY(N) \
  1106. AI_MATKEY_MAPPINGMODE_V(aiTextureType_OPACITY, N)
  1107. #define AI_MATKEY_MAPPINGMODE_V_DISPLACEMENT(N) \
  1108. AI_MATKEY_MAPPINGMODE_V(aiTextureType_DISPLACEMENT, N)
  1109. #define AI_MATKEY_MAPPINGMODE_V_LIGHTMAP(N) \
  1110. AI_MATKEY_MAPPINGMODE_V(aiTextureType_LIGHTMAP, N)
  1111. #define AI_MATKEY_MAPPINGMODE_V_REFLECTION(N) \
  1112. AI_MATKEY_MAPPINGMODE_V(aiTextureType_REFLECTION, N)
  1113. //! @endcond
  1114. // ---------------------------------------------------------------------------
  1115. #define AI_MATKEY_TEXMAP_AXIS(type, N) _AI_MATKEY_TEXMAP_AXIS_BASE, type, N
  1116. // For backward compatibility and simplicity
  1117. //! @cond MATS_DOC_FULL
  1118. #define AI_MATKEY_TEXMAP_AXIS_DIFFUSE(N) \
  1119. AI_MATKEY_TEXMAP_AXIS(aiTextureType_DIFFUSE, N)
  1120. #define AI_MATKEY_TEXMAP_AXIS_SPECULAR(N) \
  1121. AI_MATKEY_TEXMAP_AXIS(aiTextureType_SPECULAR, N)
  1122. #define AI_MATKEY_TEXMAP_AXIS_AMBIENT(N) \
  1123. AI_MATKEY_TEXMAP_AXIS(aiTextureType_AMBIENT, N)
  1124. #define AI_MATKEY_TEXMAP_AXIS_EMISSIVE(N) \
  1125. AI_MATKEY_TEXMAP_AXIS(aiTextureType_EMISSIVE, N)
  1126. #define AI_MATKEY_TEXMAP_AXIS_NORMALS(N) \
  1127. AI_MATKEY_TEXMAP_AXIS(aiTextureType_NORMALS, N)
  1128. #define AI_MATKEY_TEXMAP_AXIS_HEIGHT(N) \
  1129. AI_MATKEY_TEXMAP_AXIS(aiTextureType_HEIGHT, N)
  1130. #define AI_MATKEY_TEXMAP_AXIS_SHININESS(N) \
  1131. AI_MATKEY_TEXMAP_AXIS(aiTextureType_SHININESS, N)
  1132. #define AI_MATKEY_TEXMAP_AXIS_OPACITY(N) \
  1133. AI_MATKEY_TEXMAP_AXIS(aiTextureType_OPACITY, N)
  1134. #define AI_MATKEY_TEXMAP_AXIS_DISPLACEMENT(N) \
  1135. AI_MATKEY_TEXMAP_AXIS(aiTextureType_DISPLACEMENT, N)
  1136. #define AI_MATKEY_TEXMAP_AXIS_LIGHTMAP(N) \
  1137. AI_MATKEY_TEXMAP_AXIS(aiTextureType_LIGHTMAP, N)
  1138. #define AI_MATKEY_TEXMAP_AXIS_REFLECTION(N) \
  1139. AI_MATKEY_TEXMAP_AXIS(aiTextureType_REFLECTION, N)
  1140. //! @endcond
  1141. // ---------------------------------------------------------------------------
  1142. #define AI_MATKEY_UVTRANSFORM(type, N) _AI_MATKEY_UVTRANSFORM_BASE, type, N
  1143. // For backward compatibility and simplicity
  1144. //! @cond MATS_DOC_FULL
  1145. #define AI_MATKEY_UVTRANSFORM_DIFFUSE(N) \
  1146. AI_MATKEY_UVTRANSFORM(aiTextureType_DIFFUSE, N)
  1147. #define AI_MATKEY_UVTRANSFORM_SPECULAR(N) \
  1148. AI_MATKEY_UVTRANSFORM(aiTextureType_SPECULAR, N)
  1149. #define AI_MATKEY_UVTRANSFORM_AMBIENT(N) \
  1150. AI_MATKEY_UVTRANSFORM(aiTextureType_AMBIENT, N)
  1151. #define AI_MATKEY_UVTRANSFORM_EMISSIVE(N) \
  1152. AI_MATKEY_UVTRANSFORM(aiTextureType_EMISSIVE, N)
  1153. #define AI_MATKEY_UVTRANSFORM_NORMALS(N) \
  1154. AI_MATKEY_UVTRANSFORM(aiTextureType_NORMALS, N)
  1155. #define AI_MATKEY_UVTRANSFORM_HEIGHT(N) \
  1156. AI_MATKEY_UVTRANSFORM(aiTextureType_HEIGHT, N)
  1157. #define AI_MATKEY_UVTRANSFORM_SHININESS(N) \
  1158. AI_MATKEY_UVTRANSFORM(aiTextureType_SHININESS, N)
  1159. #define AI_MATKEY_UVTRANSFORM_OPACITY(N) \
  1160. AI_MATKEY_UVTRANSFORM(aiTextureType_OPACITY, N)
  1161. #define AI_MATKEY_UVTRANSFORM_DISPLACEMENT(N) \
  1162. AI_MATKEY_UVTRANSFORM(aiTextureType_DISPLACEMENT, N)
  1163. #define AI_MATKEY_UVTRANSFORM_LIGHTMAP(N) \
  1164. AI_MATKEY_UVTRANSFORM(aiTextureType_LIGHTMAP, N)
  1165. #define AI_MATKEY_UVTRANSFORM_REFLECTION(N) \
  1166. AI_MATKEY_UVTRANSFORM(aiTextureType_REFLECTION, N)
  1167. #define AI_MATKEY_UVTRANSFORM_UNKNOWN(N) \
  1168. AI_MATKEY_UVTRANSFORM(aiTextureType_UNKNOWN, N)
  1169. //! @endcond
  1170. // ---------------------------------------------------------------------------
  1171. #define AI_MATKEY_TEXFLAGS(type, N) _AI_MATKEY_TEXFLAGS_BASE, type, N
  1172. // For backward compatibility and simplicity
  1173. //! @cond MATS_DOC_FULL
  1174. #define AI_MATKEY_TEXFLAGS_DIFFUSE(N) \
  1175. AI_MATKEY_TEXFLAGS(aiTextureType_DIFFUSE, N)
  1176. #define AI_MATKEY_TEXFLAGS_SPECULAR(N) \
  1177. AI_MATKEY_TEXFLAGS(aiTextureType_SPECULAR, N)
  1178. #define AI_MATKEY_TEXFLAGS_AMBIENT(N) \
  1179. AI_MATKEY_TEXFLAGS(aiTextureType_AMBIENT, N)
  1180. #define AI_MATKEY_TEXFLAGS_EMISSIVE(N) \
  1181. AI_MATKEY_TEXFLAGS(aiTextureType_EMISSIVE, N)
  1182. #define AI_MATKEY_TEXFLAGS_NORMALS(N) \
  1183. AI_MATKEY_TEXFLAGS(aiTextureType_NORMALS, N)
  1184. #define AI_MATKEY_TEXFLAGS_HEIGHT(N) \
  1185. AI_MATKEY_TEXFLAGS(aiTextureType_HEIGHT, N)
  1186. #define AI_MATKEY_TEXFLAGS_SHININESS(N) \
  1187. AI_MATKEY_TEXFLAGS(aiTextureType_SHININESS, N)
  1188. #define AI_MATKEY_TEXFLAGS_OPACITY(N) \
  1189. AI_MATKEY_TEXFLAGS(aiTextureType_OPACITY, N)
  1190. #define AI_MATKEY_TEXFLAGS_DISPLACEMENT(N) \
  1191. AI_MATKEY_TEXFLAGS(aiTextureType_DISPLACEMENT, N)
  1192. #define AI_MATKEY_TEXFLAGS_LIGHTMAP(N) \
  1193. AI_MATKEY_TEXFLAGS(aiTextureType_LIGHTMAP, N)
  1194. #define AI_MATKEY_TEXFLAGS_REFLECTION(N) \
  1195. AI_MATKEY_TEXFLAGS(aiTextureType_REFLECTION, N)
  1196. #define AI_MATKEY_TEXFLAGS_UNKNOWN(N) \
  1197. AI_MATKEY_TEXFLAGS(aiTextureType_UNKNOWN, N)
  1198. //! @endcond
  1199. //!
  1200. // ---------------------------------------------------------------------------
  1201. /** @brief Retrieve a material property with a specific key from the material
  1202. *
  1203. * @param pMat Pointer to the input material. May not be NULL
  1204. * @param pKey Key to search for. One of the AI_MATKEY_XXX constants.
  1205. * @param type Specifies the type of the texture to be retrieved (
  1206. * e.g. diffuse, specular, height map ...)
  1207. * @param index Index of the texture to be retrieved.
  1208. * @param pPropOut Pointer to receive a pointer to a valid aiMaterialProperty
  1209. * structure or NULL if the key has not been found. */
  1210. // ---------------------------------------------------------------------------
  1211. ASSIMP_API C_ENUM aiReturn aiGetMaterialProperty(
  1212. const C_STRUCT aiMaterial *pMat,
  1213. const char *pKey,
  1214. unsigned int type,
  1215. unsigned int index,
  1216. const C_STRUCT aiMaterialProperty **pPropOut);
  1217. // ---------------------------------------------------------------------------
  1218. /** @brief Retrieve an array of float values with a specific key
  1219. * from the material
  1220. *
  1221. * Pass one of the AI_MATKEY_XXX constants for the last three parameters (the
  1222. * example reads the #AI_MATKEY_UVTRANSFORM property of the first diffuse texture)
  1223. * @code
  1224. * aiUVTransform trafo;
  1225. * unsigned int max = sizeof(aiUVTransform);
  1226. * if (AI_SUCCESS != aiGetMaterialFloatArray(mat, AI_MATKEY_UVTRANSFORM(aiTextureType_DIFFUSE,0),
  1227. * (float*)&trafo, &max) || sizeof(aiUVTransform) != max)
  1228. * {
  1229. * // error handling
  1230. * }
  1231. * @endcode
  1232. *
  1233. * @param pMat Pointer to the input material. May not be NULL
  1234. * @param pKey Key to search for. One of the AI_MATKEY_XXX constants.
  1235. * @param pOut Pointer to a buffer to receive the result.
  1236. * @param pMax Specifies the size of the given buffer, in float's.
  1237. * Receives the number of values (not bytes!) read.
  1238. * @param type (see the code sample above)
  1239. * @param index (see the code sample above)
  1240. * @return Specifies whether the key has been found. If not, the output
  1241. * arrays remains unmodified and pMax is set to 0.*/
  1242. // ---------------------------------------------------------------------------
  1243. ASSIMP_API C_ENUM aiReturn aiGetMaterialFloatArray(
  1244. const C_STRUCT aiMaterial *pMat,
  1245. const char *pKey,
  1246. unsigned int type,
  1247. unsigned int index,
  1248. ai_real *pOut,
  1249. unsigned int *pMax);
  1250. // ---------------------------------------------------------------------------
  1251. /** @brief Retrieve a single float property with a specific key from the material.
  1252. *
  1253. * Pass one of the AI_MATKEY_XXX constants for the last three parameters (the
  1254. * example reads the #AI_MATKEY_SHININESS_STRENGTH property of the first diffuse texture)
  1255. * @code
  1256. * float specStrength = 1.f; // default value, remains unmodified if we fail.
  1257. * aiGetMaterialFloat(mat, AI_MATKEY_SHININESS_STRENGTH,
  1258. * (float*)&specStrength);
  1259. * @endcode
  1260. *
  1261. * @param pMat Pointer to the input material. May not be NULL
  1262. * @param pKey Key to search for. One of the AI_MATKEY_XXX constants.
  1263. * @param pOut Receives the output float.
  1264. * @param type (see the code sample above)
  1265. * @param index (see the code sample above)
  1266. * @return Specifies whether the key has been found. If not, the output
  1267. * float remains unmodified.*/
  1268. // ---------------------------------------------------------------------------
  1269. inline aiReturn aiGetMaterialFloat(const C_STRUCT aiMaterial *pMat,
  1270. const char *pKey,
  1271. unsigned int type,
  1272. unsigned int index,
  1273. ai_real *pOut) {
  1274. return aiGetMaterialFloatArray(pMat, pKey, type, index, pOut, (unsigned int *)0x0);
  1275. }
  1276. // ---------------------------------------------------------------------------
  1277. /** @brief Retrieve an array of integer values with a specific key
  1278. * from a material
  1279. *
  1280. * See the sample for aiGetMaterialFloatArray for more information.*/
  1281. ASSIMP_API C_ENUM aiReturn aiGetMaterialIntegerArray(const C_STRUCT aiMaterial *pMat,
  1282. const char *pKey,
  1283. unsigned int type,
  1284. unsigned int index,
  1285. int *pOut,
  1286. unsigned int *pMax);
  1287. // ---------------------------------------------------------------------------
  1288. /** @brief Retrieve an integer property with a specific key from a material
  1289. *
  1290. * See the sample for aiGetMaterialFloat for more information.*/
  1291. // ---------------------------------------------------------------------------
  1292. inline aiReturn aiGetMaterialInteger(const C_STRUCT aiMaterial *pMat,
  1293. const char *pKey,
  1294. unsigned int type,
  1295. unsigned int index,
  1296. int *pOut) {
  1297. return aiGetMaterialIntegerArray(pMat, pKey, type, index, pOut, (unsigned int *)0x0);
  1298. }
  1299. // ---------------------------------------------------------------------------
  1300. /** @brief Retrieve a color value from the material property table
  1301. *
  1302. * See the sample for aiGetMaterialFloat for more information*/
  1303. // ---------------------------------------------------------------------------
  1304. ASSIMP_API C_ENUM aiReturn aiGetMaterialColor(const C_STRUCT aiMaterial *pMat,
  1305. const char *pKey,
  1306. unsigned int type,
  1307. unsigned int index,
  1308. C_STRUCT aiColor4D *pOut);
  1309. // ---------------------------------------------------------------------------
  1310. /** @brief Retrieve a aiUVTransform value from the material property table
  1311. *
  1312. * See the sample for aiGetMaterialFloat for more information*/
  1313. // ---------------------------------------------------------------------------
  1314. ASSIMP_API C_ENUM aiReturn aiGetMaterialUVTransform(const C_STRUCT aiMaterial *pMat,
  1315. const char *pKey,
  1316. unsigned int type,
  1317. unsigned int index,
  1318. C_STRUCT aiUVTransform *pOut);
  1319. // ---------------------------------------------------------------------------
  1320. /** @brief Retrieve a string from the material property table
  1321. *
  1322. * See the sample for aiGetMaterialFloat for more information.*/
  1323. // ---------------------------------------------------------------------------
  1324. ASSIMP_API C_ENUM aiReturn aiGetMaterialString(const C_STRUCT aiMaterial *pMat,
  1325. const char *pKey,
  1326. unsigned int type,
  1327. unsigned int index,
  1328. C_STRUCT aiString *pOut);
  1329. // ---------------------------------------------------------------------------
  1330. /** Get the number of textures for a particular texture type.
  1331. * @param[in] pMat Pointer to the input material. May not be NULL
  1332. * @param type Texture type to check for
  1333. * @return Number of textures for this type.
  1334. * @note A texture can be easily queried using #aiGetMaterialTexture() */
  1335. // ---------------------------------------------------------------------------
  1336. ASSIMP_API unsigned int aiGetMaterialTextureCount(const C_STRUCT aiMaterial *pMat,
  1337. C_ENUM aiTextureType type);
  1338. // ---------------------------------------------------------------------------
  1339. /** @brief Helper function to get all values pertaining to a particular
  1340. * texture slot from a material structure.
  1341. *
  1342. * This function is provided just for convenience. You could also read the
  1343. * texture by parsing all of its properties manually. This function bundles
  1344. * all of them in a huge function monster.
  1345. *
  1346. * @param[in] mat Pointer to the input material. May not be NULL
  1347. * @param[in] type Specifies the texture stack to read from (e.g. diffuse,
  1348. * specular, height map ...).
  1349. * @param[in] index Index of the texture. The function fails if the
  1350. * requested index is not available for this texture type.
  1351. * #aiGetMaterialTextureCount() can be used to determine the number of
  1352. * textures in a particular texture stack.
  1353. * @param[out] path Receives the output path
  1354. * If the texture is embedded, receives a '*' followed by the id of
  1355. * the texture (for the textures stored in the corresponding scene) which
  1356. * can be converted to an int using a function like atoi.
  1357. * This parameter must be non-null.
  1358. * @param mapping The texture mapping mode to be used.
  1359. * Pass NULL if you're not interested in this information.
  1360. * @param[out] uvindex For UV-mapped textures: receives the index of the UV
  1361. * source channel. Unmodified otherwise.
  1362. * Pass NULL if you're not interested in this information.
  1363. * @param[out] blend Receives the blend factor for the texture
  1364. * Pass NULL if you're not interested in this information.
  1365. * @param[out] op Receives the texture blend operation to be perform between
  1366. * this texture and the previous texture.
  1367. * Pass NULL if you're not interested in this information.
  1368. * @param[out] mapmode Receives the mapping modes to be used for the texture.
  1369. * Pass NULL if you're not interested in this information. Otherwise,
  1370. * pass a pointer to an array of two aiTextureMapMode's (one for each
  1371. * axis, UV order).
  1372. * @param[out] flags Receives the the texture flags.
  1373. * @return AI_SUCCESS on success, otherwise something else. Have fun.*/
  1374. // ---------------------------------------------------------------------------
  1375. #ifdef __cplusplus
  1376. ASSIMP_API aiReturn aiGetMaterialTexture(const C_STRUCT aiMaterial *mat,
  1377. aiTextureType type,
  1378. unsigned int index,
  1379. aiString *path,
  1380. aiTextureMapping *mapping = NULL,
  1381. unsigned int *uvindex = NULL,
  1382. ai_real *blend = NULL,
  1383. aiTextureOp *op = NULL,
  1384. aiTextureMapMode *mapmode = NULL,
  1385. unsigned int *flags = NULL);
  1386. #else
  1387. C_ENUM aiReturn aiGetMaterialTexture(const C_STRUCT aiMaterial *mat,
  1388. C_ENUM aiTextureType type,
  1389. unsigned int index,
  1390. C_STRUCT aiString *path,
  1391. C_ENUM aiTextureMapping *mapping /*= NULL*/,
  1392. unsigned int *uvindex /*= NULL*/,
  1393. ai_real *blend /*= NULL*/,
  1394. C_ENUM aiTextureOp *op /*= NULL*/,
  1395. C_ENUM aiTextureMapMode *mapmode /*= NULL*/,
  1396. unsigned int *flags /*= NULL*/);
  1397. #endif // !#ifdef __cplusplus
  1398. #ifdef __cplusplus
  1399. }
  1400. #include "material.inl"
  1401. #endif //!__cplusplus
  1402. #endif //!!AI_MATERIAL_H_INC