
extern "C" 
{

//------------------------------------------------------------------------------------
// irr::scene::SSkinMeshBuffer wrappers
//------------------------------------------------------------------------------------

	SSkinMeshBuffer* IrrScene_SSkinMeshBuffer_new(E_VERTEX_TYPE vt = EVT_STANDARD)
	{
		return new SSkinMeshBuffer();
	}	

	void IrrScene_SSkinMeshBuffer_convertTo2TCoords(SSkinMeshBuffer* mb)
	{
		if (mb) {
			mb->convertTo2TCoords();
		}
	}

	void IrrScene_SSkinMeshBuffer_convertToTangents(SSkinMeshBuffer* mb)
	{
		if (mb) {
			mb->convertToTangents();
		}
	}
	
	void IrrScene_SSkinMeshBuffer_boundingBoxNeedsRecalculated(SSkinMeshBuffer* mb)
	{
		if (mb)
			mb->boundingBoxNeedsRecalculated();
	}
	

	void IrrScene_SSkinMeshBuffer_append(SSkinMeshBuffer* mb, const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices)
	{
		if (!mb || vertices == mb->getVertices())
			return;

		const u32 vertexCount = mb->getVertexCount();
		u32 i;

		switch (mb->getVertexType())
		{
			case video::EVT_2TCOORDS:				
				mb->Vertices_2TCoords.reallocate(vertexCount+numVertices);
				for (i=0; i<numVertices; ++i)
				{
					mb->Vertices_2TCoords.push_back(reinterpret_cast<const S3DVertex2TCoords*>(vertices)[i]);
					mb->BoundingBox.addInternalPoint(reinterpret_cast<const S3DVertex2TCoords*>(vertices)[i].Pos);
				}				
				break;
			case video::EVT_TANGENTS:
				mb->Vertices_Tangents.reallocate(vertexCount+numVertices);
				for (i=0; i<numVertices; ++i)
				{
					mb->Vertices_Tangents.push_back(reinterpret_cast<const S3DVertexTangents*>(vertices)[i]);
					mb->BoundingBox.addInternalPoint(reinterpret_cast<const S3DVertexTangents*>(vertices)[i].Pos);
				}				
				break;
			default:
				mb->Vertices_Standard.reallocate(vertexCount+numVertices);
				for (i=0; i<numVertices; ++i)
				{
					mb->Vertices_Standard.push_back(reinterpret_cast<const S3DVertex*>(vertices)[i]);
					mb->BoundingBox.addInternalPoint(reinterpret_cast<const S3DVertex*>(vertices)[i].Pos);
				}				
		}

		mb->Indices.reallocate(mb->getIndexCount()+numIndices);
		for (i=0; i<numIndices; ++i)
		{
			mb->Indices.push_back(indices[i]+vertexCount);
		}
	}
}
