Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

900 rindas
33 KiB

  1. #-*- coding: UTF-8 -*-
  2. from ctypes import POINTER, c_void_p, c_int, c_uint, c_char, c_float, Structure, c_char_p, c_double, c_ubyte, c_size_t, c_uint32
  3. class Vector2D(Structure):
  4. """
  5. See 'aiVector2D.h' for details.
  6. """
  7. _fields_ = [
  8. ("x", c_float),("y", c_float),
  9. ]
  10. class Matrix3x3(Structure):
  11. """
  12. See 'aiMatrix3x3.h' for details.
  13. """
  14. _fields_ = [
  15. ("a1", c_float),("a2", c_float),("a3", c_float),
  16. ("b1", c_float),("b2", c_float),("b3", c_float),
  17. ("c1", c_float),("c2", c_float),("c3", c_float),
  18. ]
  19. class Texel(Structure):
  20. """
  21. See 'aiTexture.h' for details.
  22. """
  23. _fields_ = [
  24. ("b", c_ubyte),("g", c_ubyte),("r", c_ubyte),("a", c_ubyte),
  25. ]
  26. class Color4D(Structure):
  27. """
  28. See 'aiColor4D.h' for details.
  29. """
  30. _fields_ = [
  31. # Red, green, blue and alpha color values
  32. ("r", c_float),("g", c_float),("b", c_float),("a", c_float),
  33. ]
  34. class Plane(Structure):
  35. """
  36. See 'aiTypes.h' for details.
  37. """
  38. _fields_ = [
  39. # Plane equation
  40. ("a", c_float),("b", c_float),("c", c_float),("d", c_float),
  41. ]
  42. class Color3D(Structure):
  43. """
  44. See 'aiTypes.h' for details.
  45. """
  46. _fields_ = [
  47. # Red, green and blue color values
  48. ("r", c_float),("g", c_float),("b", c_float),
  49. ]
  50. class String(Structure):
  51. """
  52. See 'aiTypes.h' for details.
  53. """
  54. MAXLEN = 1024
  55. _fields_ = [
  56. # Binary length of the string excluding the terminal 0. This is NOT the
  57. # logical length of strings containing UTF-8 multibyte sequences! It's
  58. # the number of bytes from the beginning of the string to its end.
  59. ("length", c_size_t),
  60. # String buffer. Size limit is MAXLEN
  61. ("data", c_char*MAXLEN),
  62. ]
  63. class MaterialPropertyString(Structure):
  64. """
  65. See 'aiTypes.h' for details.
  66. The size of length is truncated to 4 bytes on 64-bit platforms when used as a
  67. material property (see MaterialSystem.cpp aiMaterial::AddProperty() for details).
  68. """
  69. MAXLEN = 1024
  70. _fields_ = [
  71. # Binary length of the string excluding the terminal 0. This is NOT the
  72. # logical length of strings containing UTF-8 multibyte sequences! It's
  73. # the number of bytes from the beginning of the string to its end.
  74. ("length", c_uint32),
  75. # String buffer. Size limit is MAXLEN
  76. ("data", c_char*MAXLEN),
  77. ]
  78. class MemoryInfo(Structure):
  79. """
  80. See 'aiTypes.h' for details.
  81. """
  82. _fields_ = [
  83. # Storage allocated for texture data
  84. ("textures", c_uint),
  85. # Storage allocated for material data
  86. ("materials", c_uint),
  87. # Storage allocated for mesh data
  88. ("meshes", c_uint),
  89. # Storage allocated for node data
  90. ("nodes", c_uint),
  91. # Storage allocated for animation data
  92. ("animations", c_uint),
  93. # Storage allocated for camera data
  94. ("cameras", c_uint),
  95. # Storage allocated for light data
  96. ("lights", c_uint),
  97. # Total storage allocated for the full import.
  98. ("total", c_uint),
  99. ]
  100. class Quaternion(Structure):
  101. """
  102. See 'aiQuaternion.h' for details.
  103. """
  104. _fields_ = [
  105. # w,x,y,z components of the quaternion
  106. ("w", c_float),("x", c_float),("y", c_float),("z", c_float),
  107. ]
  108. class Face(Structure):
  109. """
  110. See 'aiMesh.h' for details.
  111. """
  112. _fields_ = [
  113. # Number of indices defining this face.
  114. # The maximum value for this member is
  115. #AI_MAX_FACE_INDICES.
  116. ("mNumIndices", c_uint),
  117. # Pointer to the indices array. Size of the array is given in numIndices.
  118. ("mIndices", POINTER(c_uint)),
  119. ]
  120. class VertexWeight(Structure):
  121. """
  122. See 'aiMesh.h' for details.
  123. """
  124. _fields_ = [
  125. # Index of the vertex which is influenced by the bone.
  126. ("mVertexId", c_uint),
  127. # The strength of the influence in the range (0...1).
  128. # The influence from all bones at one vertex amounts to 1.
  129. ("mWeight", c_float),
  130. ]
  131. class Matrix4x4(Structure):
  132. """
  133. See 'aiMatrix4x4.h' for details.
  134. """
  135. _fields_ = [
  136. ("a1", c_float),("a2", c_float),("a3", c_float),("a4", c_float),
  137. ("b1", c_float),("b2", c_float),("b3", c_float),("b4", c_float),
  138. ("c1", c_float),("c2", c_float),("c3", c_float),("c4", c_float),
  139. ("d1", c_float),("d2", c_float),("d3", c_float),("d4", c_float),
  140. ]
  141. class Vector3D(Structure):
  142. """
  143. See 'aiVector3D.h' for details.
  144. """
  145. _fields_ = [
  146. ("x", c_float),("y", c_float),("z", c_float),
  147. ]
  148. class MeshKey(Structure):
  149. """
  150. See 'aiAnim.h' for details.
  151. """
  152. _fields_ = [
  153. # The time of this key
  154. ("mTime", c_double),
  155. # Index into the aiMesh::mAnimMeshes array of the
  156. # mesh coresponding to the
  157. #aiMeshAnim hosting this
  158. # key frame. The referenced anim mesh is evaluated
  159. # according to the rules defined in the docs for
  160. #aiAnimMesh.
  161. ("mValue", c_uint),
  162. ]
  163. class Node(Structure):
  164. """
  165. See 'aiScene.h' for details.
  166. """
  167. Node._fields_ = [
  168. # The name of the node.
  169. # The name might be empty (length of zero) but all nodes which
  170. # need to be accessed afterwards by bones or anims are usually named.
  171. # Multiple nodes may have the same name, but nodes which are accessed
  172. # by bones (see
  173. #aiBone and
  174. #aiMesh::mBones) *must* be unique.
  175. # Cameras and lights are assigned to a specific node name - if there
  176. # are multiple nodes with this name, they're assigned to each of them.
  177. # <br>
  178. # There are no limitations regarding the characters contained in
  179. # this text. You should be able to handle stuff like whitespace, tabs,
  180. # linefeeds, quotation marks, ampersands, ... .
  181. ("mName", String),
  182. # The transformation relative to the node's parent.
  183. ("mTransformation", Matrix4x4),
  184. # Parent node. NULL if this node is the root node.
  185. ("mParent", POINTER(Node)),
  186. # The number of child nodes of this node.
  187. ("mNumChildren", c_uint),
  188. # The child nodes of this node. NULL if mNumChildren is 0.
  189. ("mChildren", POINTER(POINTER(Node))),
  190. # The number of meshes of this node.
  191. ("mNumMeshes", c_uint),
  192. # The meshes of this node. Each entry is an index into the mesh
  193. ("mMeshes", POINTER(c_uint)),
  194. ]
  195. class Light(Structure):
  196. """
  197. See 'aiLight.h' for details.
  198. """
  199. _fields_ = [
  200. # The name of the light source.
  201. # There must be a node in the scenegraph with the same name.
  202. # This node specifies the position of the light in the scene
  203. # hierarchy and can be animated.
  204. ("mName", String),
  205. # The type of the light source.
  206. # aiLightSource_UNDEFINED is not a valid value for this member.
  207. ("mType", c_uint),
  208. # Position of the light source in space. Relative to the
  209. # transformation of the node corresponding to the light.
  210. # The position is undefined for directional lights.
  211. ("mPosition", Vector3D),
  212. # Direction of the light source in space. Relative to the
  213. # transformation of the node corresponding to the light.
  214. # The direction is undefined for point lights. The vector
  215. # may be normalized, but it needn't.
  216. ("mDirection", Vector3D),
  217. # Constant light attenuation factor.
  218. # The intensity of the light source at a given distance 'd' from
  219. # the light's position is
  220. # @code
  221. # Atten = 1/( att0 + att1
  222. # d + att2
  223. # d*d)
  224. # @endcode
  225. # This member corresponds to the att0 variable in the equation.
  226. # Naturally undefined for directional lights.
  227. ("mAttenuationConstant", c_float),
  228. # Linear light attenuation factor.
  229. # The intensity of the light source at a given distance 'd' from
  230. # the light's position is
  231. # @code
  232. # Atten = 1/( att0 + att1
  233. # d + att2
  234. # d*d)
  235. # @endcode
  236. # This member corresponds to the att1 variable in the equation.
  237. # Naturally undefined for directional lights.
  238. ("mAttenuationLinear", c_float),
  239. # Quadratic light attenuation factor.
  240. # The intensity of the light source at a given distance 'd' from
  241. # the light's position is
  242. # @code
  243. # Atten = 1/( att0 + att1
  244. # d + att2
  245. # d*d)
  246. # @endcode
  247. # This member corresponds to the att2 variable in the equation.
  248. # Naturally undefined for directional lights.
  249. ("mAttenuationQuadratic", c_float),
  250. # Diffuse color of the light source
  251. # The diffuse light color is multiplied with the diffuse
  252. # material color to obtain the final color that contributes
  253. # to the diffuse shading term.
  254. ("mColorDiffuse", Color3D),
  255. # Specular color of the light source
  256. # The specular light color is multiplied with the specular
  257. # material color to obtain the final color that contributes
  258. # to the specular shading term.
  259. ("mColorSpecular", Color3D),
  260. # Ambient color of the light source
  261. # The ambient light color is multiplied with the ambient
  262. # material color to obtain the final color that contributes
  263. # to the ambient shading term. Most renderers will ignore
  264. # this value it, is just a remaining of the fixed-function pipeline
  265. # that is still supported by quite many file formats.
  266. ("mColorAmbient", Color3D),
  267. # Inner angle of a spot light's light cone.
  268. # The spot light has maximum influence on objects inside this
  269. # angle. The angle is given in radians. It is 2PI for point
  270. # lights and undefined for directional lights.
  271. ("mAngleInnerCone", c_float),
  272. # Outer angle of a spot light's light cone.
  273. # The spot light does not affect objects outside this angle.
  274. # The angle is given in radians. It is 2PI for point lights and
  275. # undefined for directional lights. The outer angle must be
  276. # greater than or equal to the inner angle.
  277. # It is assumed that the application uses a smooth
  278. # interpolation between the inner and the outer cone of the
  279. # spot light.
  280. ("mAngleOuterCone", c_float),
  281. ]
  282. class Texture(Structure):
  283. """
  284. See 'aiTexture.h' for details.
  285. """
  286. _fields_ = [
  287. # Width of the texture, in pixels
  288. # If mHeight is zero the texture is compressed in a format
  289. # like JPEG. In this case mWidth specifies the size of the
  290. # memory area pcData is pointing to, in bytes.
  291. ("mWidth", c_uint),
  292. # Height of the texture, in pixels
  293. # If this value is zero, pcData points to an compressed texture
  294. # in any format (e.g. JPEG).
  295. ("mHeight", c_uint),
  296. # A hint from the loader to make it easier for applications
  297. # to determine the type of embedded compressed textures.
  298. # If mHeight != 0 this member is undefined. Otherwise it
  299. # is set set to '\\0\\0\\0\\0' if the loader has no additional
  300. # information about the texture file format used OR the
  301. # file extension of the format without a trailing dot. If there
  302. # are multiple file extensions for a format, the shortest
  303. # extension is chosen (JPEG maps to 'jpg', not to 'jpeg').
  304. # E.g. 'dds\\0', 'pcx\\0', 'jpg\\0'. All characters are lower-case.
  305. # The fourth character will always be '\\0'.
  306. ("achFormatHint", c_char*4),
  307. # Data of the texture.
  308. # Points to an array of mWidth
  309. # mHeight aiTexel's.
  310. # The format of the texture data is always ARGB8888 to
  311. # make the implementation for user of the library as easy
  312. # as possible. If mHeight = 0 this is a pointer to a memory
  313. # buffer of size mWidth containing the compressed texture
  314. # data. Good luck, have fun!
  315. ("pcData", POINTER(Texel)),
  316. ]
  317. class Ray(Structure):
  318. """
  319. See 'aiTypes.h' for details.
  320. """
  321. _fields_ = [
  322. # Position and direction of the ray
  323. ("pos", Vector3D),("dir", Vector3D),
  324. ]
  325. class UVTransform(Structure):
  326. """
  327. See 'aiMaterial.h' for details.
  328. """
  329. _fields_ = [
  330. # Translation on the u and v axes.
  331. # The default value is (0|0).
  332. ("mTranslation", Vector2D),
  333. # Scaling on the u and v axes.
  334. # The default value is (1|1).
  335. ("mScaling", Vector2D),
  336. # Rotation - in counter-clockwise direction.
  337. # The rotation angle is specified in radians. The
  338. # rotation center is 0.5f|0.5f. The default value
  339. # 0.f.
  340. ("mRotation", c_float),
  341. ]
  342. class MaterialProperty(Structure):
  343. """
  344. See 'aiMaterial.h' for details.
  345. """
  346. _fields_ = [
  347. # Specifies the name of the property (key)
  348. # Keys are generally case insensitive.
  349. ("mKey", String),
  350. # Textures: Specifies their exact usage semantic.
  351. # For non-texture properties, this member is always 0
  352. # (or, better-said,
  353. #aiTextureType_NONE).
  354. ("mSemantic", c_uint),
  355. # Textures: Specifies the index of the texture.
  356. # For non-texture properties, this member is always 0.
  357. ("mIndex", c_uint),
  358. # Size of the buffer mData is pointing to, in bytes.
  359. # This value may not be 0.
  360. ("mDataLength", c_uint),
  361. # Type information for the property.
  362. # Defines the data layout inside the data buffer. This is used
  363. # by the library internally to perform debug checks and to
  364. # utilize proper type conversions.
  365. # (It's probably a hacky solution, but it works.)
  366. ("mType", c_uint),
  367. # Binary buffer to hold the property's value.
  368. # The size of the buffer is always mDataLength.
  369. ("mData", POINTER(c_char)),
  370. ]
  371. class Material(Structure):
  372. """
  373. See 'aiMaterial.h' for details.
  374. """
  375. _fields_ = [
  376. # List of all material properties loaded.
  377. ("mProperties", POINTER(POINTER(MaterialProperty))),
  378. # Number of properties in the data base
  379. ("mNumProperties", c_uint),
  380. # Storage allocated
  381. ("mNumAllocated", c_uint),
  382. ]
  383. class Bone(Structure):
  384. """
  385. See 'aiMesh.h' for details.
  386. """
  387. _fields_ = [
  388. # The name of the bone.
  389. ("mName", String),
  390. # The number of vertices affected by this bone
  391. # The maximum value for this member is
  392. #AI_MAX_BONE_WEIGHTS.
  393. ("mNumWeights", c_uint),
  394. # The vertices affected by this bone
  395. ("mWeights", POINTER(VertexWeight)),
  396. # Matrix that transforms from mesh space to bone space in bind pose
  397. ("mOffsetMatrix", Matrix4x4),
  398. ]
  399. class Mesh(Structure):
  400. """
  401. See 'aiMesh.h' for details.
  402. """
  403. AI_MAX_FACE_INDICES = 0x7fff
  404. AI_MAX_BONE_WEIGHTS = 0x7fffffff
  405. AI_MAX_VERTICES = 0x7fffffff
  406. AI_MAX_FACES = 0x7fffffff
  407. AI_MAX_NUMBER_OF_COLOR_SETS = 0x8
  408. AI_MAX_NUMBER_OF_TEXTURECOORDS = 0x8
  409. _fields_ = [
  410. # Bitwise combination of the members of the
  411. #aiPrimitiveType enum.
  412. # This specifies which types of primitives are present in the mesh.
  413. # The "SortByPrimitiveType"-Step can be used to make sure the
  414. # output meshes consist of one primitive type each.
  415. ("mPrimitiveTypes", c_uint),
  416. # The number of vertices in this mesh.
  417. # This is also the size of all of the per-vertex data arrays.
  418. # The maximum value for this member is
  419. #AI_MAX_VERTICES.
  420. ("mNumVertices", c_uint),
  421. # The number of primitives (triangles, polygons, lines) in this mesh.
  422. # This is also the size of the mFaces array.
  423. # The maximum value for this member is
  424. #AI_MAX_FACES.
  425. ("mNumFaces", c_uint),
  426. # Vertex positions.
  427. # This array is always present in a mesh. The array is
  428. # mNumVertices in size.
  429. ("mVertices", POINTER(Vector3D)),
  430. # Vertex normals.
  431. # The array contains normalized vectors, NULL if not present.
  432. # The array is mNumVertices in size. Normals are undefined for
  433. # point and line primitives. A mesh consisting of points and
  434. # lines only may not have normal vectors. Meshes with mixed
  435. # primitive types (i.e. lines and triangles) may have normals,
  436. # but the normals for vertices that are only referenced by
  437. # point or line primitives are undefined and set to QNaN (WARN:
  438. # qNaN compares to inequal to *everything*, even to qNaN itself.
  439. # Using code like this to check whether a field is qnan is:
  440. # @code
  441. #define IS_QNAN(f) (f != f)
  442. # @endcode
  443. # still dangerous because even 1.f == 1.f could evaluate to false! (
  444. # remember the subtleties of IEEE754 artithmetics). Use stuff like
  445. # @c fpclassify instead.
  446. # @note Normal vectors computed by Assimp are always unit-length.
  447. # However, this needn't apply for normals that have been taken
  448. # directly from the model file.
  449. ("mNormals", POINTER(Vector3D)),
  450. # Vertex tangents.
  451. # The tangent of a vertex points in the direction of the positive
  452. # X texture axis. The array contains normalized vectors, NULL if
  453. # not present. The array is mNumVertices in size. A mesh consisting
  454. # of points and lines only may not have normal vectors. Meshes with
  455. # mixed primitive types (i.e. lines and triangles) may have
  456. # normals, but the normals for vertices that are only referenced by
  457. # point or line primitives are undefined and set to qNaN. See
  458. # the
  459. #mNormals member for a detailled discussion of qNaNs.
  460. # @note If the mesh contains tangents, it automatically also
  461. # contains bitangents (the bitangent is just the cross product of
  462. # tangent and normal vectors).
  463. ("mTangents", POINTER(Vector3D)),
  464. # Vertex bitangents.
  465. # The bitangent of a vertex points in the direction of the positive
  466. # Y texture axis. The array contains normalized vectors, NULL if not
  467. # present. The array is mNumVertices in size.
  468. # @note If the mesh contains tangents, it automatically also contains
  469. # bitangents.
  470. ("mBitangents", POINTER(Vector3D)),
  471. # Vertex color sets.
  472. # A mesh may contain 0 to
  473. #AI_MAX_NUMBER_OF_COLOR_SETS vertex
  474. # colors per vertex. NULL if not present. Each array is
  475. # mNumVertices in size if present.
  476. ("mColors", POINTER(Color4D)*AI_MAX_NUMBER_OF_COLOR_SETS),
  477. # Vertex texture coords, also known as UV channels.
  478. # A mesh may contain 0 to AI_MAX_NUMBER_OF_TEXTURECOORDS per
  479. # vertex. NULL if not present. The array is mNumVertices in size.
  480. ("mTextureCoords", POINTER(Vector3D)*AI_MAX_NUMBER_OF_TEXTURECOORDS),
  481. # Specifies the number of components for a given UV channel.
  482. # Up to three channels are supported (UVW, for accessing volume
  483. # or cube maps). If the value is 2 for a given channel n, the
  484. # component p.z of mTextureCoords[n][p] is set to 0.0f.
  485. # If the value is 1 for a given channel, p.y is set to 0.0f, too.
  486. # @note 4D coords are not supported
  487. ("mNumUVComponents", c_uint*AI_MAX_NUMBER_OF_TEXTURECOORDS),
  488. # The faces the mesh is constructed from.
  489. # Each face refers to a number of vertices by their indices.
  490. # This array is always present in a mesh, its size is given
  491. # in mNumFaces. If the
  492. #AI_SCENE_FLAGS_NON_VERBOSE_FORMAT
  493. # is NOT set each face references an unique set of vertices.
  494. ("mFaces", POINTER(Face)),
  495. # The number of bones this mesh contains.
  496. # Can be 0, in which case the mBones array is NULL.
  497. ("mNumBones", c_uint),
  498. # The bones of this mesh.
  499. # A bone consists of a name by which it can be found in the
  500. # frame hierarchy and a set of vertex weights.
  501. ("mBones", POINTER(POINTER(Bone))),
  502. # The material used by this mesh.
  503. # A mesh does use only a single material. If an imported model uses
  504. # multiple materials, the import splits up the mesh. Use this value
  505. # as index into the scene's material list.
  506. ("mMaterialIndex", c_uint),
  507. # Name of the mesh. Meshes can be named, but this is not a
  508. # requirement and leaving this field empty is totally fine.
  509. # There are mainly three uses for mesh names:
  510. # - some formats name nodes and meshes independently.
  511. # - importers tend to split meshes up to meet the
  512. # one-material-per-mesh requirement. Assigning
  513. # the same (dummy) name to each of the result meshes
  514. # aids the caller at recovering the original mesh
  515. # partitioning.
  516. # - Vertex animations refer to meshes by their names.
  517. ("mName", String),
  518. # NOT CURRENTLY IN USE. The number of attachment meshes
  519. ("mNumAnimMeshes", c_uint),
  520. # NOT CURRENTLY IN USE. Attachment meshes for this mesh, for vertex-based animation.
  521. # Attachment meshes carry replacement data for some of the
  522. # mesh'es vertex components (usually positions, normals).
  523. ]
  524. class Camera(Structure):
  525. """
  526. See 'aiCamera.h' for details.
  527. """
  528. _fields_ = [
  529. # The name of the camera.
  530. # There must be a node in the scenegraph with the same name.
  531. # This node specifies the position of the camera in the scene
  532. # hierarchy and can be animated.
  533. ("mName", String),
  534. # Position of the camera relative to the coordinate space
  535. # defined by the corresponding node.
  536. # The default value is 0|0|0.
  537. ("mPosition", Vector3D),
  538. # 'Up' - vector of the camera coordinate system relative to
  539. # the coordinate space defined by the corresponding node.
  540. # The 'right' vector of the camera coordinate system is
  541. # the cross product of the up and lookAt vectors.
  542. # The default value is 0|1|0. The vector
  543. # may be normalized, but it needn't.
  544. ("mUp", Vector3D),
  545. # 'LookAt' - vector of the camera coordinate system relative to
  546. # the coordinate space defined by the corresponding node.
  547. # This is the viewing direction of the user.
  548. # The default value is 0|0|1. The vector
  549. # may be normalized, but it needn't.
  550. ("mLookAt", Vector3D),
  551. # Half horizontal field of view angle, in radians.
  552. # The field of view angle is the angle between the center
  553. # line of the screen and the left or right border.
  554. # The default value is 1/4PI.
  555. ("mHorizontalFOV", c_float),
  556. # Distance of the near clipping plane from the camera.
  557. # The value may not be 0.f (for arithmetic reasons to prevent
  558. # a division through zero). The default value is 0.1f.
  559. ("mClipPlaneNear", c_float),
  560. # Distance of the far clipping plane from the camera.
  561. # The far clipping plane must, of course, be further away than the
  562. # near clipping plane. The default value is 1000.f. The ratio
  563. # between the near and the far plane should not be too
  564. # large (between 1000-10000 should be ok) to avoid floating-point
  565. # inaccuracies which could lead to z-fighting.
  566. ("mClipPlaneFar", c_float),
  567. # Screen aspect ratio.
  568. # This is the ration between the width and the height of the
  569. # screen. Typical values are 4/3, 1/2 or 1/1. This value is
  570. # 0 if the aspect ratio is not defined in the source file.
  571. # 0 is also the default value.
  572. ("mAspect", c_float),
  573. ]
  574. class VectorKey(Structure):
  575. """
  576. See 'aiAnim.h' for details.
  577. """
  578. _fields_ = [
  579. # The time of this key
  580. ("mTime", c_double),
  581. # The value of this key
  582. ("mValue", Vector3D),
  583. ]
  584. class QuatKey(Structure):
  585. """
  586. See 'aiAnim.h' for details.
  587. """
  588. _fields_ = [
  589. # The time of this key
  590. ("mTime", c_double),
  591. # The value of this key
  592. ("mValue", Quaternion),
  593. ]
  594. class NodeAnim(Structure):
  595. """
  596. See 'aiAnim.h' for details.
  597. """
  598. _fields_ = [
  599. # The name of the node affected by this animation. The node
  600. # must exist and it must be unique.
  601. ("mNodeName", String),
  602. # The number of position keys
  603. ("mNumPositionKeys", c_uint),
  604. # The position keys of this animation channel. Positions are
  605. # specified as 3D vector. The array is mNumPositionKeys in size.
  606. # If there are position keys, there will also be at least one
  607. # scaling and one rotation key.
  608. ("mPositionKeys", POINTER(VectorKey)),
  609. # The number of rotation keys
  610. ("mNumRotationKeys", c_uint),
  611. # The rotation keys of this animation channel. Rotations are
  612. # given as quaternions, which are 4D vectors. The array is
  613. # mNumRotationKeys in size.
  614. # If there are rotation keys, there will also be at least one
  615. # scaling and one position key.
  616. ("mRotationKeys", POINTER(QuatKey)),
  617. # The number of scaling keys
  618. ("mNumScalingKeys", c_uint),
  619. # The scaling keys of this animation channel. Scalings are
  620. # specified as 3D vector. The array is mNumScalingKeys in size.
  621. # If there are scaling keys, there will also be at least one
  622. # position and one rotation key.
  623. ("mScalingKeys", POINTER(VectorKey)),
  624. # Defines how the animation behaves before the first
  625. # key is encountered.
  626. # The default value is aiAnimBehaviour_DEFAULT (the original
  627. # transformation matrix of the affected node is used).
  628. ("mPreState", c_uint),
  629. # Defines how the animation behaves after the last
  630. # key was processed.
  631. # The default value is aiAnimBehaviour_DEFAULT (the original
  632. # transformation matrix of the affected node is taken).
  633. ("mPostState", c_uint),
  634. ]
  635. class Animation(Structure):
  636. """
  637. See 'aiAnim.h' for details.
  638. """
  639. _fields_ = [
  640. # The name of the animation. If the modeling package this data was
  641. # exported from does support only a single animation channel, this
  642. # name is usually empty (length is zero).
  643. ("mName", String),
  644. # Duration of the animation in ticks.
  645. ("mDuration", c_double),
  646. # Ticks per second. 0 if not specified in the imported file
  647. ("mTicksPerSecond", c_double),
  648. # The number of bone animation channels. Each channel affects
  649. # a single node.
  650. ("mNumChannels", c_uint),
  651. # The node animation channels. Each channel affects a single node.
  652. # The array is mNumChannels in size.
  653. ("mChannels", POINTER(POINTER(NodeAnim))),
  654. # The number of mesh animation channels. Each channel affects
  655. # a single mesh and defines vertex-based animation.
  656. ("mNumMeshChannels", c_uint),
  657. # The mesh animation channels. Each channel affects a single mesh.
  658. # The array is mNumMeshChannels in size.
  659. ]
  660. class Scene(Structure):
  661. """
  662. See 'aiScene.h' for details.
  663. """
  664. AI_SCENE_FLAGS_INCOMPLETE = 0x1
  665. AI_SCENE_FLAGS_VALIDATED = 0x2
  666. AI_SCENE_FLAGS_VALIDATION_WARNING = 0x4
  667. AI_SCENE_FLAGS_NON_VERBOSE_FORMAT = 0x8
  668. AI_SCENE_FLAGS_TERRAIN = 0x10
  669. _fields_ = [
  670. # Any combination of the AI_SCENE_FLAGS_XXX flags. By default
  671. # this value is 0, no flags are set. Most applications will
  672. # want to reject all scenes with the AI_SCENE_FLAGS_INCOMPLETE
  673. # bit set.
  674. ("mFlags", c_uint),
  675. # The root node of the hierarchy.
  676. # There will always be at least the root node if the import
  677. # was successful (and no special flags have been set).
  678. # Presence of further nodes depends on the format and content
  679. # of the imported file.
  680. ("mRootNode", POINTER(Node)),
  681. # The number of meshes in the scene.
  682. ("mNumMeshes", c_uint),
  683. # The array of meshes.
  684. # Use the indices given in the aiNode structure to access
  685. # this array. The array is mNumMeshes in size. If the
  686. # AI_SCENE_FLAGS_INCOMPLETE flag is not set there will always
  687. # be at least ONE material.
  688. ("mMeshes", POINTER(POINTER(Mesh))),
  689. # The number of materials in the scene.
  690. ("mNumMaterials", c_uint),
  691. # The array of materials.
  692. # Use the index given in each aiMesh structure to access this
  693. # array. The array is mNumMaterials in size. If the
  694. # AI_SCENE_FLAGS_INCOMPLETE flag is not set there will always
  695. # be at least ONE material.
  696. ("mMaterials", POINTER(POINTER(Material))),
  697. # The number of animations in the scene.
  698. ("mNumAnimations", c_uint),
  699. # The array of animations.
  700. # All animations imported from the given file are listed here.
  701. # The array is mNumAnimations in size.
  702. ("mAnimations", POINTER(POINTER(Animation))),
  703. # The number of textures embedded into the file
  704. ("mNumTextures", c_uint),
  705. # The array of embedded textures.
  706. # Not many file formats embed their textures into the file.
  707. # An example is Quake's MDL format (which is also used by
  708. # some GameStudio versions)
  709. ("mTextures", POINTER(POINTER(Texture))),
  710. # The number of light sources in the scene. Light sources
  711. # are fully optional, in most cases this attribute will be 0
  712. ("mNumLights", c_uint),
  713. # The array of light sources.
  714. # All light sources imported from the given file are
  715. # listed here. The array is mNumLights in size.
  716. ("mLights", POINTER(POINTER(Light))),
  717. # The number of cameras in the scene. Cameras
  718. # are fully optional, in most cases this attribute will be 0
  719. ("mNumCameras", c_uint),
  720. # The array of cameras.
  721. # All cameras imported from the given file are listed here.
  722. # The array is mNumCameras in size. The first camera in the
  723. # array (if existing) is the default camera view into
  724. # the scene.
  725. ("mCameras", POINTER(POINTER(Camera))),
  726. ]