You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

307 regels
9.9 KiB

  1. /*
  2. ---------------------------------------------------------------------------
  3. Open Asset Import Library (ASSIMP)
  4. ---------------------------------------------------------------------------
  5. Copyright (c) 2006-2009, ASSIMP Development 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 Development 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. /**
  35. * Contains the data structures which store the hierarchy fo the imported data.
  36. */
  37. module assimp.scene;
  38. import assimp.animation;
  39. import assimp.camera;
  40. import assimp.light;
  41. import assimp.math;
  42. import assimp.mesh;
  43. import assimp.material;
  44. import assimp.texture;
  45. import assimp.types;
  46. extern ( C ) {
  47. /**
  48. * A node in the imported hierarchy.
  49. *
  50. * Each node has name, a parent node (except for the root node), a
  51. * transformation relative to its parent and possibly several child nodes.
  52. * Simple file formats don't support hierarchical structures, for these
  53. * formats the imported scene does consist of only a single root node with
  54. * no childs.
  55. */
  56. struct aiNode {
  57. /**
  58. * The name of the node.
  59. *
  60. * The name might be empty (length of zero) but all nodes which need to
  61. * be accessed afterwards by bones or animations are usually named.
  62. * Multiple nodes may have the same name, but nodes which are accessed
  63. * by bones (see <code>aiBone</code> and <code>aiMesh.mBones</code>)
  64. * <em>must</em> be unique.
  65. *
  66. * Cameras and lights are assigned to a specific node name – if there are
  67. * multiple nodes with this name, they are assigned to each of them.
  68. *
  69. * There are no limitations regarding the characters contained in this
  70. * string. You should be able to handle stuff like whitespace, tabs,
  71. * linefeeds, quotation marks, ampersands, …
  72. */
  73. aiString mName;
  74. /**
  75. * The transformation relative to the node's parent.
  76. */
  77. aiMatrix4x4 mTransformation;
  78. /**
  79. * Parent node.
  80. *
  81. * null if this node is the root node.
  82. */
  83. aiNode* mParent;
  84. /**
  85. * The number of child nodes of this node.
  86. */
  87. uint mNumChildren;
  88. /**
  89. * The child nodes of this node.
  90. *
  91. * null if <code>mNumChildren</code> is 0.
  92. */
  93. aiNode** mChildren;
  94. /**
  95. * The number of meshes of this node.
  96. */
  97. int mNumMeshes;
  98. /**
  99. * The meshes of this node.
  100. *
  101. * Each entry is an index for <code>aiScene.mMeshes</code>.
  102. */
  103. uint* mMeshes;
  104. }
  105. /**
  106. * Flags which are combinated in <code>aiScene.mFlags</code> to store
  107. * auxiliary information about the imported scene.
  108. */
  109. enum aiSceneFlags : uint {
  110. /**
  111. * Specifies that the scene data structure that was imported is not
  112. * complete.
  113. *
  114. * This flag bypasses some internal validations and allows the import of
  115. * animation skeletons, material libraries or camera animation paths
  116. * using Assimp. Most applications won't support such data.
  117. */
  118. INCOMPLETE = 0x1,
  119. /**
  120. * This flag is set by the validation post-processing step
  121. * (<code>aiProcess.ValidateDS</code>) if the validation was successful.
  122. *
  123. * In a validated scene you can be sure that any cross references in the
  124. * data structure (e.g. vertex indices) are valid.
  125. */
  126. VALIDATED = 0x2,
  127. /**
  128. * This flag is set by the validation post-processing step
  129. * (<code>aiProcess.ValidateDS</code>) if the validation is successful
  130. * but some issues have been found.
  131. *
  132. * This can for example mean that a texture that does not exist is
  133. * referenced by a material or that the bone weights for a vertex don't
  134. * sum to 1. In most cases you should still be able to use the import.
  135. *
  136. * This flag could be useful for applications which don't capture
  137. * Assimp's log output.
  138. */
  139. VALIDATION_WARNING = 0x4,
  140. /**
  141. * This flag is currently only set by the
  142. * <code>aiProcess.JoinIdenticalVertices</code> post-processing step. It
  143. * indicates that the vertices of the output meshes aren't in the
  144. * internal verbose format anymore. In the verbose format all vertices
  145. * are unique, no vertex is ever referenced by more than one face.
  146. */
  147. NON_VERBOSE_FORMAT = 0x8,
  148. /**
  149. * Denotes pure height-map terrain data. Pure terrains usually consist of
  150. * quads, sometimes triangles, in a regular grid. The x,y coordinates of
  151. * all vertex positions refer to the x,y coordinates on the terrain
  152. * height map, the z-axis stores the elevation at a specific point.
  153. *
  154. * TER (Terragen) and HMP (3D Game Studio) are height map formats.
  155. *
  156. * Note: Assimp is probably not the best choice for loading <em>huge</em>
  157. * terrains – fully triangulated data takes extremely much storage
  158. * space and should be avoided as long as possible (typically you will
  159. * perform the triangulation when you actually need to render it).
  160. */
  161. FLAGS_TERRAIN = 0x10
  162. }
  163. /**
  164. * The root structure of the imported data.
  165. *
  166. * Everything that was imported from the given file can be accessed from here.
  167. * Objects of this class are generally maintained and owned by Assimp, not
  168. * by the caller. You shouldn't want to instance it, nor should you ever try to
  169. * delete a given scene on your own.
  170. */
  171. struct aiScene {
  172. /**
  173. * Any combination of the <code>aiSceneFlags</code>. By default, this
  174. * value is 0, no flags are set.
  175. *
  176. * Most applications will want to reject all scenes with the
  177. * <code>aiSceneFlags.INCOMPLETE</code> bit set.
  178. */
  179. uint mFlags;
  180. /**
  181. * The root node of the hierarchy.
  182. *
  183. * There will always be at least the root node if the import was
  184. * successful (and no special flags have been set). Presence of further
  185. * nodes depends on the format and contents of the imported file.
  186. */
  187. aiNode* mRootNode;
  188. /**
  189. * The number of meshes in the scene.
  190. */
  191. uint mNumMeshes;
  192. /**
  193. * The array of meshes.
  194. *
  195. * Use the indices given in the <code>aiNode</code> structure to access
  196. * this array. The array is <code>mNumMeshes</code> in size.
  197. *
  198. * If the <code>aiSceneFlags.INCOMPLETE</code> flag is not set, there
  199. * will always be at least one mesh.
  200. */
  201. aiMesh** mMeshes;
  202. /**
  203. * The number of materials in the scene.
  204. */
  205. uint mNumMaterials;
  206. /**
  207. * The array of meshes.
  208. *
  209. * Use the indices given in the <code>aiMesh</code> structure to access
  210. * this array. The array is <code>mNumMaterials</code> in size.
  211. *
  212. * If the <code>aiSceneFlags.INCOMPLETE</code> flag is not set, there
  213. * will always be at least one material.
  214. */
  215. aiMaterial** mMaterials;
  216. /**
  217. * The number of animations in the scene.
  218. */
  219. uint mNumAnimations;
  220. /**
  221. * The array of animations.
  222. *
  223. * All animations imported from the given file are listed here. The array
  224. * is <code>mNumAnimations</code> in size.
  225. */
  226. aiAnimation** mAnimations;
  227. /**
  228. * The number of textures embedded into the file.
  229. */
  230. uint mNumTextures;
  231. /**
  232. * The array of embedded textures.
  233. *
  234. * Not many file formats embed their textures into the file. An example
  235. * is Quake's <code>MDL</code> format (which is also used by some
  236. * GameStudio versions).
  237. */
  238. aiTexture** mTextures;
  239. /**
  240. * The number of light sources in the scene.
  241. *
  242. * Light sources are fully optional, in most cases this attribute will be
  243. * 0.
  244. */
  245. uint mNumLights;
  246. /**
  247. * The array of light sources.
  248. *
  249. * All light sources imported from the given file are listed here. The
  250. * array is <code>mNumLights</code> in size.
  251. */
  252. aiLight** mLights;
  253. /**
  254. * The number of cameras in the scene.
  255. *
  256. * Cameras are fully optional, in most cases this attribute
  257. * will be 0.
  258. */
  259. uint mNumCameras;
  260. /**
  261. * The array of cameras.
  262. *
  263. * All cameras imported from the given file are listed here. The array is
  264. * <code>mNumCameras</code> in size.
  265. *
  266. * The first camera in the array (if existing) is the default camera view
  267. * at the scene.
  268. */
  269. aiCamera** mCameras;
  270. }
  271. }