M3DMaterials.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. Open Asset Import Library (assimp)
  3. ----------------------------------------------------------------------
  4. Copyright (c) 2006-2020, assimp team
  5. Copyright (c) 2019 bzt
  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
  9. following 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 M3DMaterials.h
  35. * @brief Declares the Assimp and Model 3D file material type relations
  36. */
  37. #ifndef AI_M3DMATERIALS_H_INC
  38. #define AI_M3DMATERIALS_H_INC
  39. /*
  40. * In the m3d.h header, there's a static array which defines the material
  41. * properties, called m3d_propertytypes. These must have the same size, and
  42. * list the matching Assimp materials for those properties. Used by both the
  43. * M3DImporter and the M3DExporter, so you have to define these relations
  44. * only once. D.R.Y. and K.I.S.S.
  45. */
  46. typedef struct {
  47. const char *pKey;
  48. unsigned int type;
  49. unsigned int index;
  50. } aiMatProp;
  51. /* --- Scalar Properties --- !!!!! must match m3d_propertytypes !!!!! */
  52. static const aiMatProp aiProps[] = {
  53. { AI_MATKEY_COLOR_DIFFUSE }, /* m3dp_Kd */
  54. { AI_MATKEY_COLOR_AMBIENT }, /* m3dp_Ka */
  55. { AI_MATKEY_COLOR_SPECULAR }, /* m3dp_Ks */
  56. { AI_MATKEY_SHININESS }, /* m3dp_Ns */
  57. { AI_MATKEY_COLOR_EMISSIVE }, /* m3dp_Ke */
  58. { AI_MATKEY_COLOR_REFLECTIVE }, /* m3dp_Tf */
  59. { AI_MATKEY_BUMPSCALING }, /* m3dp_Km */
  60. { AI_MATKEY_OPACITY }, /* m3dp_d */
  61. { AI_MATKEY_SHADING_MODEL }, /* m3dp_il */
  62. { nullptr, 0, 0 }, /* m3dp_Pr */
  63. { AI_MATKEY_REFLECTIVITY }, /* m3dp_Pm */
  64. { nullptr, 0, 0 }, /* m3dp_Ps */
  65. { AI_MATKEY_REFRACTI }, /* m3dp_Ni */
  66. { nullptr, 0, 0 }, /* m3dp_Nt */
  67. { nullptr, 0, 0 },
  68. { nullptr, 0, 0 },
  69. { nullptr, 0, 0 }
  70. };
  71. /* --- Texture Map Properties --- !!!!! must match m3d_propertytypes !!!!! */
  72. static const aiMatProp aiTxProps[] = {
  73. { AI_MATKEY_TEXTURE_DIFFUSE(0) }, /* m3dp_map_Kd */
  74. { AI_MATKEY_TEXTURE(aiTextureType_AMBIENT_OCCLUSION,0) },/* m3dp_map_Ka */
  75. { AI_MATKEY_TEXTURE_SPECULAR(0) }, /* m3dp_map_Ks */
  76. { AI_MATKEY_TEXTURE_SHININESS(0) }, /* m3dp_map_Ns */
  77. { AI_MATKEY_TEXTURE_EMISSIVE(0) }, /* m3dp_map_Ke */
  78. { nullptr, 0, 0 }, /* m3dp_map_Tf */
  79. { AI_MATKEY_TEXTURE_HEIGHT(0) }, /* m3dp_bump */
  80. { AI_MATKEY_TEXTURE_OPACITY(0) }, /* m3dp_map_d */
  81. { AI_MATKEY_TEXTURE_NORMALS(0) }, /* m3dp_map_N */
  82. { AI_MATKEY_TEXTURE(aiTextureType_DIFFUSE_ROUGHNESS,0) },/* m3dp_map_Pr */
  83. { AI_MATKEY_TEXTURE(aiTextureType_METALNESS,0) }, /* m3dp_map_Pm */
  84. { nullptr, 0, 0 }, /* m3dp_map_Ps */
  85. { AI_MATKEY_TEXTURE(aiTextureType_REFLECTION,0) }, /* m3dp_map_Ni */
  86. { nullptr, 0, 0 }, /* m3dp_map_Nt */
  87. { nullptr, 0, 0 },
  88. { nullptr, 0, 0 },
  89. { nullptr, 0, 0 }
  90. };
  91. #endif // AI_M3DMATERIALS_H_INC