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
class Vector2D(Structure):
_fields_ = [
("x", c_float),("y", c_float),
]
class Matrix3x3(Structure):
_fields_ = [
("a1", c_float),("a2", c_float),("a3", c_float),
("b1", c_float),("b2", c_float),("b3", c_float),
("c1", c_float),("c2", c_float),("c3", c_float),
]
class Texel(Structure):
_fields_ = [
("b", c_ubyte),("g", c_ubyte),("r", c_ubyte),("a", c_ubyte),
]
class Color4D(Structure):
_fields_ = [
("r", c_float),("g", c_float),("b", c_float),("a", c_float),
]
class Plane(Structure):
_fields_ = [
("a", c_float),("b", c_float),("c", c_float),("d", c_float),
]
class Color3D(Structure):
_fields_ = [
("r", c_float),("g", c_float),("b", c_float),
]
class String(Structure):
MAXLEN = 1024
_fields_ = [
("length", c_size_t),
("data", c_char*MAXLEN),
]
class MaterialPropertyString(Structure):
MAXLEN = 1024
_fields_ = [
("length", c_uint32),
("data", c_char*MAXLEN),
]
class MemoryInfo(Structure):
_fields_ = [
("textures", c_uint),
("materials", c_uint),
("meshes", c_uint),
("nodes", c_uint),
("animations", c_uint),
("cameras", c_uint),
("lights", c_uint),
("total", c_uint),
]
class Quaternion(Structure):
_fields_ = [
("w", c_float),("x", c_float),("y", c_float),("z", c_float),
]
class Face(Structure):
_fields_ = [
("mNumIndices", c_uint),
("mIndices", POINTER(c_uint)),
]
class VertexWeight(Structure):
_fields_ = [
("mVertexId", c_uint),
("mWeight", c_float),
]
class Matrix4x4(Structure):
_fields_ = [
("a1", c_float),("a2", c_float),("a3", c_float),("a4", c_float),
("b1", c_float),("b2", c_float),("b3", c_float),("b4", c_float),
("c1", c_float),("c2", c_float),("c3", c_float),("c4", c_float),
("d1", c_float),("d2", c_float),("d3", c_float),("d4", c_float),
]
class Vector3D(Structure):
_fields_ = [
("x", c_float),("y", c_float),("z", c_float),
]
class MeshKey(Structure):
_fields_ = [
("mTime", c_double),
("mValue", c_uint),
]
class Node(Structure):
Node._fields_ = [
("mName", String),
("mTransformation", Matrix4x4),
("mParent", POINTER(Node)),
("mNumChildren", c_uint),
("mChildren", POINTER(POINTER(Node))),
("mNumMeshes", c_uint),
("mMeshes", POINTER(c_uint)),
]
class Light(Structure):
_fields_ = [
("mName", String),
("mType", c_uint),
("mPosition", Vector3D),
("mDirection", Vector3D),
("mAttenuationConstant", c_float),
("mAttenuationLinear", c_float),
("mAttenuationQuadratic", c_float),
("mColorDiffuse", Color3D),
("mColorSpecular", Color3D),
("mColorAmbient", Color3D),
("mAngleInnerCone", c_float),
("mAngleOuterCone", c_float),
]
class Texture(Structure):
_fields_ = [
("mWidth", c_uint),
("mHeight", c_uint),
("achFormatHint", c_char*4),
("pcData", POINTER(Texel)),
]
class Ray(Structure):
_fields_ = [
("pos", Vector3D),("dir", Vector3D),
]
class UVTransform(Structure):
_fields_ = [
("mTranslation", Vector2D),
("mScaling", Vector2D),
("mRotation", c_float),
]
class MaterialProperty(Structure):
_fields_ = [
("mKey", String),
("mSemantic", c_uint),
("mIndex", c_uint),
("mDataLength", c_uint),
("mType", c_uint),
("mData", POINTER(c_char)),
]
class Material(Structure):
_fields_ = [
("mProperties", POINTER(POINTER(MaterialProperty))),
("mNumProperties", c_uint),
("mNumAllocated", c_uint),
]
class Bone(Structure):
_fields_ = [
("mName", String),
("mNumWeights", c_uint),
("mWeights", POINTER(VertexWeight)),
("mOffsetMatrix", Matrix4x4),
]
class Mesh(Structure):
AI_MAX_FACE_INDICES = 0x7fff
AI_MAX_BONE_WEIGHTS = 0x7fffffff
AI_MAX_VERTICES = 0x7fffffff
AI_MAX_FACES = 0x7fffffff
AI_MAX_NUMBER_OF_COLOR_SETS = 0x8
AI_MAX_NUMBER_OF_TEXTURECOORDS = 0x8
_fields_ = [
("mPrimitiveTypes", c_uint),
("mNumVertices", c_uint),
("mNumFaces", c_uint),
("mVertices", POINTER(Vector3D)),
("mNormals", POINTER(Vector3D)),
("mTangents", POINTER(Vector3D)),
("mBitangents", POINTER(Vector3D)),
("mColors", POINTER(Color4D)*AI_MAX_NUMBER_OF_COLOR_SETS),
("mTextureCoords", POINTER(Vector3D)*AI_MAX_NUMBER_OF_TEXTURECOORDS),
("mNumUVComponents", c_uint*AI_MAX_NUMBER_OF_TEXTURECOORDS),
("mFaces", POINTER(Face)),
("mNumBones", c_uint),
("mBones", POINTER(POINTER(Bone))),
("mMaterialIndex", c_uint),
("mName", String),
("mNumAnimMeshes", c_uint),
]
class Camera(Structure):
_fields_ = [
("mName", String),
("mPosition", Vector3D),
("mUp", Vector3D),
("mLookAt", Vector3D),
("mHorizontalFOV", c_float),
("mClipPlaneNear", c_float),
("mClipPlaneFar", c_float),
("mAspect", c_float),
]
class VectorKey(Structure):
_fields_ = [
("mTime", c_double),
("mValue", Vector3D),
]
class QuatKey(Structure):
_fields_ = [
("mTime", c_double),
("mValue", Quaternion),
]
class NodeAnim(Structure):
_fields_ = [
("mNodeName", String),
("mNumPositionKeys", c_uint),
("mPositionKeys", POINTER(VectorKey)),
("mNumRotationKeys", c_uint),
("mRotationKeys", POINTER(QuatKey)),
("mNumScalingKeys", c_uint),
("mScalingKeys", POINTER(VectorKey)),
("mPreState", c_uint),
("mPostState", c_uint),
]
class Animation(Structure):
_fields_ = [
("mName", String),
("mDuration", c_double),
("mTicksPerSecond", c_double),
("mNumChannels", c_uint),
("mChannels", POINTER(POINTER(NodeAnim))),
("mNumMeshChannels", c_uint),
]
class Scene(Structure):
AI_SCENE_FLAGS_INCOMPLETE = 0x1
AI_SCENE_FLAGS_VALIDATED = 0x2
AI_SCENE_FLAGS_VALIDATION_WARNING = 0x4
AI_SCENE_FLAGS_NON_VERBOSE_FORMAT = 0x8
AI_SCENE_FLAGS_TERRAIN = 0x10
_fields_ = [
("mFlags", c_uint),
("mRootNode", POINTER(Node)),
("mNumMeshes", c_uint),
("mMeshes", POINTER(POINTER(Mesh))),
("mNumMaterials", c_uint),
("mMaterials", POINTER(POINTER(Material))),
("mNumAnimations", c_uint),
("mAnimations", POINTER(POINTER(Animation))),
("mNumTextures", c_uint),
("mTextures", POINTER(POINTER(Texture))),
("mNumLights", c_uint),
("mLights", POINTER(POINTER(Light))),
("mNumCameras", c_uint),
("mCameras", POINTER(POINTER(Camera))),
]
assimp_structs_as_tuple = (Matrix4x4,
Matrix3x3,
Vector2D,
Vector3D,
Color3D,
Color4D,
Quaternion,
Plane,
Texel)