
extern "C" 
{

	// -------------------------------------------------------------------------
	// SMD3AnimationInfo
	// -------------------------------------------------------------------------
	s32 IrrScene_SMD3AnimationInfo_getFirst(SMD3AnimationInfo* info)
	{
		if (info)
			return info->first;
		else return -1;
	}

	void IrrScene_SMD3AnimationInfo_setFirst(SMD3AnimationInfo* info,s32 first)
	{
		if (info)
			info->first=first;
	}

	s32 IrrScene_SMD3AnimationInfo_getNum(SMD3AnimationInfo* info)
	{
		if (info)
			return info->num;
		else return -1;
	}

	void IrrScene_SMD3AnimationInfo_setNum(SMD3AnimationInfo* info,s32 num)
	{
		if (info)
			info->num=num;
	}

	s32 IrrScene_SMD3AnimationInfo_getLooping(SMD3AnimationInfo* info)
	{
		if (info)
			return info->looping;
		else return -1;
	}

	void IrrScene_SMD3AnimationInfo_setLooping(SMD3AnimationInfo* info,s32 looping)
	{
		if (info)
			info->looping=looping;
	}

	s32 IrrScene_SMD3AnimationInfo_getFPS(SMD3AnimationInfo* info)
	{
		if (info)
			return info->fps;
		else return -1;
	}

	void IrrScene_SMD3AnimationInfo_setFPS(SMD3AnimationInfo* info,s32 fps)
	{
		if (info)
			info->fps=fps;
	}

	// -------------------------------------------------------------------------
	// SMD3Header
	// -------------------------------------------------------------------------
	const c8* IrrScene_SMD3Header_getHeaderID(SMD3Header* header)
	{
		if (header)
			return header->headerID;
		else return 0;
	}

	s32 IrrScene_SMD3Header_getVersion(SMD3Header* header)
	{
		if (header)
			return header->Version;
		else return -1;
	}

	const c8* IrrScene_SMD3Header_getFileName(SMD3Header* header)
	{
		if (header)
			return stringc(header->fileName).c_str();
		else return "";
	}

	s32 IrrScene_SMD3Header_getNumFrames(SMD3Header* header)
	{
		if (header)
			return header->numFrames;
		else return -1;
	}

	s32 IrrScene_SMD3Header_getNumTags(SMD3Header* header)
	{
		if (header)
			return header->numTags;
		else return -1;
	}

	s32 IrrScene_SMD3Header_getNumMeshes(SMD3Header* header)
	{
		if (header)
			return header->numMeshes;
		else return -1;
	}

	s32 IrrScene_SMD3Header_getNumMaxSkins(SMD3Header* header)
	{
		if (header)
			return header->numMaxSkins;
		else return -1;
	}

	s32 IrrScene_SMD3Header_getFrameStart(SMD3Header* header)
	{
		if (header)
			return header->frameStart;
		else return -1;
	}

	s32 IrrScene_SMD3Header_getTagStart(SMD3Header* header)
	{
		if (header)
			return header->tagStart;
		else return -1;
	}

	s32 IrrScene_SMD3Header_getTagEnd(SMD3Header* header)
	{
		if (header)
			return header->tagEnd;
		else return -1;
	}

	s32 IrrScene_SMD3Header_getFileSize(SMD3Header* header)
	{
		if (header)
			return header->fileSize;
		else return -1;
	}

	// -------------------------------------------------------------------------
	// SMD3MeshHeader
	// -------------------------------------------------------------------------
	const c8* IrrScene_SMD3MeshHeader_getMeshID(SMD3MeshHeader* header)
	{
		if (header)
			return header->meshID;
		else return "";
	}
	
	const c8* IrrScene_SMD3MeshHeader_getMeshName(SMD3MeshHeader* header)
	{
		if (header)
			return header->meshName;
		else return "";
	}

	s32 IrrScene_SMD3MeshHeader_getNumFrames(SMD3MeshHeader* header)
	{
		if (header)
			return header->numFrames;
		else return -1;
	}

	s32 IrrScene_SMD3MeshHeader_getNumShader(SMD3MeshHeader* header)
	{
		if (header)
			return header->numShader;
		else return -1;
	}

	s32 IrrScene_SMD3MeshHeader_getNumVertices(SMD3MeshHeader* header)
	{
		if (header)
			return header->numVertices;
		else return -1;
	}

	s32 IrrScene_SMD3MeshHeader_getNumTriangles(SMD3MeshHeader* header)
	{
		if (header)
			return header->numTriangles;
		else return -1;
	}

	s32 IrrScene_SMD3MeshHeader_getOffset_Triangles(SMD3MeshHeader* header)
	{
		if (header)
			return header->offset_triangles;
		else return -1;
	}

	s32 IrrScene_SMD3MeshHeader_getOffset_Shaders(SMD3MeshHeader* header)
	{
		if (header)
			return header->offset_shaders;
		else return -1;
	}
	
	s32 IrrScene_SMD3MeshHeader_getOffset_St(SMD3MeshHeader* header)
	{
		if (header)
			return header->offset_st;
		else return -1;
	}
	
	s32 IrrScene_SMD3MeshHeader_getVertexStart(SMD3MeshHeader* header)
	{
		if (header)
			return header->vertexStart;
		else return -1;
	}
	
	s32 IrrScene_SMD3MeshHeader_getOffset_End(SMD3MeshHeader* header)
	{
		if (header)
			return header->offset_end;
		else return -1;
	}
	
	// -------------------------------------------------------------------------
	// SMD3Vertex
	// -------------------------------------------------------------------------
	s16* IrrScene_SMD3Vertex_getPosition(SMD3Vertex* header)
	{
		if (header)
			return header->position;
		else return 0;
	}

	u8* IrrScene_SMD3Vertex_getNormal(SMD3Vertex* header)
	{
		if (header)
			return header->normal;
		else return 0;
	}

	// -------------------------------------------------------------------------
	// SMD3TexCoord
	// -------------------------------------------------------------------------
	f32 IrrScene_SMD3TexCoord_getU(SMD3TexCoord* coord)
	{
		if (coord)
			return coord->u;
		else return 0.0;
	}

	f32 IrrScene_SMD3TexCoord_getV(SMD3TexCoord* coord)
	{
		if (coord)
			return coord->v;
		else return 0.0;
	}

	// -------------------------------------------------------------------------
	// SMD3Face
	// -------------------------------------------------------------------------
	s32* IrrScene_SMD3Face_getIndex(SMD3Face* face)
	{
		if (face)
			return face->Index;
		else return 0;
	}

	// -------------------------------------------------------------------------
	// SMD3MeshBuffer
	// -------------------------------------------------------------------------

	bool IrrScene_SMD3MeshBuffer_drop(SMD3MeshBuffer* unk)
	{
		if (unk)
			return unk->drop();
		else return 0;
	}
	
	const c8* IrrScene_SMD3MeshBuffer_getDebugName(SMD3MeshBuffer* unk)
	{
		if (unk)
			return unk->getDebugName();
		else return "";
	}
	
	void IrrScene_SMD3MeshBuffer_grab(SMD3MeshBuffer* unk)
	{
		if (unk)
			unk->grab();
	}
	
	// do not delete
	SMD3MeshHeader* IrrScene_SMD3MeshBuffer_getMeshHeader(SMD3MeshBuffer* mb)
	{
		if (mb)
			return &mb->MeshHeader;
		else return 0;
	}
	
	// do not delete
	const c8* IrrScene_SMD3MeshBuffer_getShader(SMD3MeshBuffer* mb)
	{
		if (mb)	{
			return mb->Shader.c_str();
		} else return "";
	}

	// do not delete
	s32 IrrScene_SMD3MeshBuffer_getVertices(SMD3MeshBuffer* mb,u32** vertices)
	{
		if (mb)	{
			Irr_ptrarray_allocate(vertices,mb->Vertices.size());
			for (u32 i=0; i<mb->Vertices.size(); i++) {
				((u32*)*vertices)[i]=(u32)&(mb->Vertices[i]);
			}

			return mb->Vertices.size();
		} else return 0;
	}	

	// do not delete
	s32 IrrScene_SMD3MeshBuffer_getTexCoords(SMD3MeshBuffer* mb,u32** tcoords)
	{
		if (mb)	{
			Irr_ptrarray_allocate(tcoords,mb->Tex.size());
			for (u32 i=0; i<mb->Tex.size(); i++) {
				((u32*)*tcoords)[i]=(u32)&(mb->Tex[i]);
			}

			return mb->Tex.size();
		} else return 0;
	}
	
	s32 IrrScene_SMD3MeshBuffer_getIndices(SMD3MeshBuffer* mb,u32** indices)
	{
		if (mb)	{
			Irr_ptrarray_allocate(indices,mb->Indices.size());
			for (u32 i=0; i<mb->Indices.size(); i++) {
				((u32*)*indices)[i]=mb->Indices[i];
			}

			return mb->Indices.size();
		} else return 0;
	}

	// -------------------------------------------------------------------------
	// SMD3QuaternionTag
	// -------------------------------------------------------------------------

	void IrrScene_SMD3QuaternionTag_setto(SMD3QuaternionTag* tag,core::matrix4& m)
	{
		if (tag)
			tag->setto(m);
	}

	// do not delete
	const c8* IrrScene_SMD3QuaternionTag_getName(SMD3QuaternionTag* tag)
	{
		if (tag)
			return tag->Name.c_str();
		else return "";
	}
	
	// do not delete
	vector3df* IrrScene_SMD3QuaternionTag_getPosition(SMD3QuaternionTag* tag)
	{
		if (tag)
			return &tag->position;
		else return 0;
	}

	// do not delete
	quaternion* IrrScene_SMD3QuaternionTag_getRotation(SMD3QuaternionTag* tag)
	{
		if (tag)
			return &tag->rotation;
		else return 0;
	}

	bool IrrScene_SMD3QuaternionTag_EqEq(SMD3QuaternionTag* tag, SMD3QuaternionTag* other)
	{
		if (tag)
			return (*tag == *other);
		else return false;
	}

	// -------------------------------------------------------------------------
	// SMD3QuaternionTagList
	// -------------------------------------------------------------------------

	// do not delete
	SMD3QuaternionTag* IrrScene_SMD3QuaternionTagList_get(SMD3QuaternionTagList* taglist,const c8* name)
	{
		if (taglist)
			return taglist->get(stringc(name));
		else return 0;
	}

	u32 IrrScene_SMD3QuaternionTagList_getSize(SMD3QuaternionTagList* taglist)
	{
		if (taglist)
			return taglist->size();
		else return 0;
	}
	
	// do not delete
	SMD3QuaternionTag* IrrScene_SMD3QuaternionTagList_Index(SMD3QuaternionTagList* taglist,u32 index)
	{
		if (taglist) {
			return &(*taglist)[index];
		} else return 0;
	}
	
	// do not delete
	SMD3QuaternionTagList* IrrScene_SMD3QuaternionTagList_setEq(SMD3QuaternionTagList* taglist, const SMD3QuaternionTagList* copyMe)
	{
		if (taglist) {
			*taglist = *copyMe;
			return taglist;
		} else return 0;
	}

	void IrrScene_SMD3QuaternionTagList_push_back( SMD3QuaternionTagList* taglist, const SMD3QuaternionTag& other )
	{
		if (taglist)
			taglist->push_back(other);
	}
	
	void IrrScene_SMD3QuaternionTagList_set_used( SMD3QuaternionTagList* taglist, u32 new_size)
	{
		if (taglist)
			taglist->set_used(new_size);
	}

	// -------------------------------------------------------------------------
	// SMD3Mesh
	// -------------------------------------------------------------------------
	
	bool IrrScene_SMD3Mesh_drop(SMD3Mesh* unk)
	{
		if (unk)
			return unk->drop();
		else return 0;
	}
	
	const c8* IrrScene_SMD3Mesh_getDebugName(SMD3Mesh* unk)
	{
		if (unk)
			return unk->getDebugName();
		else return "";
	}
	
	void IrrScene_SMD3Mesh_grab(SMD3Mesh* unk)
	{
		if (unk)
			unk->grab();
	}

	// do not delete
	SMD3Header* IrrScene_SMD3Mesh_getMD3Header(SMD3Mesh* mesh)
	{
		if (mesh)
			return &mesh->MD3Header;
		else return 0;
	}

	const c8* IrrScene_SMD3Mesh_getName(SMD3Mesh* mesh)
	{
		if (mesh)
			return mesh->Name.c_str();
		else return "";
	}
	
	// do not delete
	s32 IrrScene_SMD3Mesh_getBuffer(SMD3Mesh* mesh,u32** buffer)
	{
		if (mesh)	{
			Irr_ptrarray_allocate(buffer,mesh->Buffer.size());
			for (u32 i=0; i<mesh->Buffer.size(); i++) {
				((u32*)*buffer)[i]=(u32)mesh->Buffer[i];
			}

			return mesh->Buffer.size();
		} else return 0;
	}

	// do not delete
	SMD3QuaternionTagList* IrrScene_SMD3Mesh_getTagList(SMD3Mesh* mesh)
	{
		if (mesh)
			return &mesh->TagList;
		else return 0;
	}

	// -------------------------------------------------------------------------
	// IAnimatedMeshMD3
	// -------------------------------------------------------------------------

	void IrrScene_IAnimatedMeshMD3_setInterpolationShift(IAnimatedMeshMD3* mesh,u32 shift,u32 loopMode)
	{
		if (mesh)
			mesh->setInterpolationShift(shift,loopMode);
	}
	
	// do not delete
	SMD3QuaternionTagList* IrrScene_IAnimatedMeshMD3_getTagList(IAnimatedMeshMD3* mesh,s32 frame, s32 detailLevel, s32 startFrameLoop, s32 endFrameLoop)
	{
		if (mesh)
			return mesh->getTagList(frame,detailLevel,startFrameLoop,endFrameLoop);
		else return 0;
	}

	// do not delete
	SMD3Mesh* IrrScene_IAnimatedMeshMD3_getOriginalMesh(IAnimatedMeshMD3* mesh)
	{
		if (mesh)
			return mesh->getOriginalMesh();
		else return 0;
	}
	
}