structs.py 32 KB

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