wrapping C code - my exercise in incompetence.
- Posted by ssallen Mar 12, 2013
- 3218 views
Hello benevolent Eu masters. As mentioned previously, I am working on wrapping the ASSIMP library. Things are going moderately, kinda, OK but I am having some issues with either total incompetence or some deeper and more sinister, intellectual defect. What I present here, is my humble efforts at peeking and poking my way through the mother of all C structures. So much peeking and poking in fact that I somewhat suspect it could be considered sexual harrassment in some states.
Anyways, I have the following C Structures which I am trying to get all the data out of and place in Eu sequences. Some of it works perfectly and some doesn't work at all as noted.
C:
struct aiScene { /** Any combination of the AI_SCENE_FLAGS_XXX flags. By default * this value is 0, no flags are set. Most applications will * want to reject all scenes with the AI_SCENE_FLAGS_INCOMPLETE * bit set. */ unsigned int mFlags; /** The root node of the hierarchy. * * There will always be at least the root node if the import * was successful (and no special flags have been set). * Presence of further nodes depends on the format and content * of the imported file. */ C_STRUCT aiNode* mRootNode; /** The number of meshes in the scene. */ unsigned int mNumMeshes; /** The array of meshes. * * Use the indices given in the aiNode structure to access * this array. The array is mNumMeshes in size. If the * AI_SCENE_FLAGS_INCOMPLETE flag is not set there will always * be at least ONE material. */ C_STRUCT aiMesh** mMeshes; /** The number of materials in the scene. */ unsigned int mNumMaterials; /** The array of materials. * * Use the index given in each aiMesh structure to access this * array. The array is mNumMaterials in size. If the * AI_SCENE_FLAGS_INCOMPLETE flag is not set there will always * be at least ONE material. */ C_STRUCT aiMaterial** mMaterials; /** The number of animations in the scene. */ unsigned int mNumAnimations; /** The array of animations. * * All animations imported from the given file are listed here. * The array is mNumAnimations in size. */ C_STRUCT aiAnimation** mAnimations; /** The number of textures embedded into the file */ unsigned int mNumTextures; /** The array of embedded textures. * * Not many file formats embed their textures into the file. * An example is Quake's MDL format (which is also used by * some GameStudio versions) */ C_STRUCT aiTexture** mTextures; /** The number of light sources in the scene. Light sources * are fully optional, in most cases this attribute will be 0 */ unsigned int mNumLights; /** The array of light sources. * * All light sources imported from the given file are * listed here. The array is mNumLights in size. */ C_STRUCT aiLight** mLights; /** The number of cameras in the scene. Cameras * are fully optional, in most cases this attribute will be 0 */ unsigned int mNumCameras; /** The array of cameras. * * All cameras imported from the given file are listed here. * The array is mNumCameras in size. The first camera in the * array (if existing) is the default camera view into * the scene. */ C_STRUCT aiCamera** mCameras; } aiMaterial /** List of all material properties loaded. */ C_STRUCT aiMaterialProperty** mProperties; /** Number of properties in the data base */ unsigned int mNumProperties; /** Storage allocated */ unsigned int mNumAllocated; aiMaterialProperty struct aiMaterialProperty { /** Specifies the name of the property (key) * Keys are generally case insensitive. */ C_STRUCT aiString mKey; /** Textures: Specifies their exact usage semantic. * For non-texture properties, this member is always 0 * (or, better-said, #aiTextureType_NONE). */ unsigned int mSemantic; /** Textures: Specifies the index of the texture. * For non-texture properties, this member is always 0. */ unsigned int mIndex; /** Size of the buffer mData is pointing to, in bytes. * This value may not be 0. */ unsigned int mDataLength; /** Type information for the property. * * Defines the data layout inside the data buffer. This is used * by the library internally to perform debug checks and to * utilize proper type conversions. * (It's probably a hacky solution, but it works.) */ C_ENUM aiPropertyTypeInfo mType; /** Binary buffer to hold the property's value. * The size of the buffer is always mDataLength. */ char* mData;