
extern "C" 
{

u32 IrrVideo_Func_getVertexPitchFromType(E_VERTEX_TYPE vertexType) 
{
	return getVertexPitchFromType(vertexType);
}


//------------------------------------------------------------------------------------
// irr::video::S3DVertex wrappers
//
// WARNING: be careful about deleting pointers returned by some of these methods
//------------------------------------------------------------------------------------

S3DVertex* IrrVideo_S3DVertex_new()
{
	return new S3DVertex();
}

S3DVertex* IrrVideo_S3DVertex_newFromVals(f32 x, f32 y, f32 z, f32 nx, f32 ny, f32 nz, SColor* c, f32 tu, f32 tv)
{
	return new S3DVertex(x,y,z,nx,ny,nz,*c,tu,tv);
}

S3DVertex* IrrVideo_S3DVertex_newFromVects(vector3df* pos,vector3df* normal,SColor* color,vector2df* tcoords)
{
	return new S3DVertex(*pos,*normal,*color,*tcoords);
}

void IrrVideo_S3DVertex_del(S3DVertex* del)
{
	if (del)
		delete del;
		
	del=0;
}

bool IrrVideo_S3DVertex_EqEq(S3DVertex* vert,S3DVertex* other)
{
	if (vert)
		return (*vert==*other);
	else
		return false;
}

bool IrrVideo_S3DVertex_NotEq(S3DVertex* vert,S3DVertex* other)
{
	if (vert)
		return (*vert!=*other);
	else
		return true;
}

bool IrrVideo_S3DVertex_Less(S3DVertex* vert,S3DVertex* other)
{
	if (vert)
		return (*vert < *other);
	else
		return true;
}

vector3df* IrrVideo_S3DVertex_getPos(S3DVertex* vert)
{
	if (vert)
		return &vert->Pos;
	else
		return 0;
}

void IrrVideo_S3DVertex_setPos(S3DVertex* vert,vector3df* pos)
{
	if (vert)
		vert->Pos=*pos;
}

vector3df* IrrVideo_S3DVertex_getNormal(S3DVertex* vert)
{
	if (vert)
		return &vert->Normal;
	else
		return 0;
}

void IrrVideo_S3DVertex_setNormal(S3DVertex* vert,vector3df* norm)
{
	if (vert)
		vert->Normal=*norm;
}

vector2df* IrrVideo_S3DVertex_getTCoords(S3DVertex* vert)
{
	if (vert)
		return &vert->TCoords;
	else
		return 0;
}

void IrrVideo_S3DVertex_setTCoords(S3DVertex* vert,vector2df* coords)
{
	if (vert)
		vert->TCoords=*coords;
}

SColor* IrrVideo_S3DVertex_getColor(S3DVertex* vert)
{
	if (vert)
		return &vert->Color;
	else
		return 0;
}

void IrrVideo_S3DVertex_setColor(S3DVertex* vert,SColor* color)
{
	if (vert)
		vert->Color=*color;
}

bool IrrVideo_S3DVertex_getVertexInfo(S3DVertex* vert,f32* pos,f32* norm,f32* tcoords,s32* color)
{
	bool bSuccess=false;
	if (vert) {
		pos[0]=vert->Pos.X;
		pos[1]=vert->Pos.Y;
		pos[2]=vert->Pos.Z;
		norm[0]=vert->Normal.X;
		norm[1]=vert->Normal.Y;
		norm[2]=vert->Normal.Z;
		tcoords[0]=vert->TCoords.X;
		tcoords[1]=vert->TCoords.Y;
		color[0]=vert->Color.getRed();
		color[1]=vert->Color.getGreen();
		color[2]=vert->Color.getBlue();
		color[3]=vert->Color.getAlpha();
	
		bSuccess=true;
	}
	return bSuccess;
}

s32 IrrVideo_S3DVertex_getType(S3DVertex* vert)
{
	if (vert)
		return (int)vert->getType();
}


//------------------------------------------------------------------------------------
// irr::video::S3DVertex2TCoords wrappers
//
// WARNING: be careful about deleting pointers returned by some of these methods
//------------------------------------------------------------------------------------

S3DVertex2TCoords* IrrVideo_S3DVertex2TCoords_new()
{
	return new S3DVertex2TCoords();
}

S3DVertex2TCoords* IrrVideo_S3DVertex2TCoords_newFromValsWithDiffTexCoords(f32 x, f32 y, f32 z, SColor* c, f32 tu, f32 tv, f32 tu2, f32 tv2)
{
	return new S3DVertex2TCoords(x,y,z,*c,tu,tv,tu2,tv2);
}

S3DVertex2TCoords* IrrVideo_S3DVertex2TCoords_newWithDiffTexCoords(vector3df* pos,SColor* color,vector2df* tcoords,core::vector2df* tcoords2)
{
	return new S3DVertex2TCoords(*pos,*color,*tcoords,*tcoords2);
}

S3DVertex2TCoords* IrrVideo_S3DVertex2TCoords_newFromValsWithNormalAndSameTexCoords(f32 x, f32 y, f32 z, f32 nx, f32 ny, f32 nz, SColor* c, f32 tu, f32 tv)
{
	return new S3DVertex2TCoords(x,y,z,nx,ny,nz,*c,tu,tv);
}

S3DVertex2TCoords* IrrVideo_S3DVertex2TCoords_newFromValsWithNormalAndDiffTexCoords(f32 x, f32 y, f32 z, f32 nx, f32 ny, f32 nz, SColor* c, f32 tu, f32 tv, f32 tu2, f32 tv2)
{
	return new S3DVertex2TCoords(x,y,z,nx,ny,nz,*c,tu,tv,tu2,tv2);
}

S3DVertex2TCoords* IrrVideo_S3DVertex2TCoords_newWithNormalAndSameTexCoords(vector3df* pos,vector3df* normal,SColor* color,vector2df* tcoords)
{
	return new S3DVertex2TCoords(*pos,*normal,*color,*tcoords);
}

S3DVertex2TCoords* IrrVideo_S3DVertex2TCoords_newWithNormalAndDiffTexCoords(vector3df* pos,vector3df* normal,SColor* color,vector2df* tcoords,vector2df* tcoords2)
{
	return new S3DVertex2TCoords(*pos,*normal,*color,*tcoords,*tcoords2);
}

S3DVertex2TCoords* IrrVideo_S3DVertex2TCoords_newFromVertex(S3DVertex& o)
{
	return new S3DVertex2TCoords(o);
}

vector2df* IrrVideo_S3DVertex2TCoords_getTCoords2(S3DVertex2TCoords* vert)
{
	if (vert)
		return &vert->TCoords2;
	else
		return 0;
}

void IrrVideo_S3DVertex2TCoords_setTCoords2(S3DVertex2TCoords* vert,vector2df* coords)
{
	if (vert)
		vert->TCoords2=*coords;
}

bool IrrVideo_S3DVertex2TCoords_EqEq(S3DVertex2TCoords* vert,S3DVertex2TCoords* other)
{
	if (vert)
		return (*vert==*other);
	else
		return false;
}

bool IrrVideo_S3DVertex2TCoords_NotEq(S3DVertex2TCoords* vert,S3DVertex2TCoords* other)
{
	if (vert)
		return (*vert!=*other);
	else
		return true;
}

bool IrrVideo_S3DVertex2TCoords_Less(S3DVertex2TCoords* vert,S3DVertex2TCoords* other)
{
	if (vert)
		return (*vert < *other);
	else
		return true;
}

bool IrrVideo_S3DVertex2TCoords_getVertexInfo(S3DVertex2TCoords* vert,f32* pos,f32* norm,f32* tcoords,s32* color,f32* tcoords2)
{
	bool bSuccess=false;
	if (vert) {
		pos[0]=vert->Pos.X;
		pos[1]=vert->Pos.Y;
		pos[2]=vert->Pos.Z;
		norm[0]=vert->Normal.X;
		norm[1]=vert->Normal.Y;
		norm[2]=vert->Normal.Z;
		tcoords[0]=vert->TCoords.X;
		tcoords[1]=vert->TCoords.Y;
		tcoords2[0]=vert->TCoords2.X;
		tcoords2[1]=vert->TCoords2.Y;
		color[0]=vert->Color.getRed();
		color[1]=vert->Color.getGreen();
		color[2]=vert->Color.getBlue();
		color[3]=vert->Color.getAlpha();
	
		bSuccess=true;
	}
	return bSuccess;
}

//------------------------------------------------------------------------------------
// irr::video::S3DVertexTangents wrappers
//
// WARNING: be careful about deleting pointers returned by some of these methods
//------------------------------------------------------------------------------------

S3DVertexTangents* IrrVideo_S3DVertexTangents_new()
{
	return new S3DVertexTangents();
}

S3DVertexTangents* IrrVideo_S3DVertexTangents_newFromVals(f32 x, f32 y, f32 z)
{
	return new S3DVertexTangents(x,y,z);
}

/*
S3DVertexTangents* IrrVideo_S3DVertexTangents_newFromVects(vector3df* pos,vector2df* tcoords,SColor* c)
{
	return new S3DVertexTangents(*pos,*tcoords,*c);
}
*/

void IrrVideo_S3DVertexTangents_del(S3DVertexTangents* del)
{
	if (del)
		delete del;
		
	del=0;
}

vector3df* IrrVideo_S3DVertexTangents_getTangent(S3DVertexTangents* vert)
{
	if (vert)
		return &vert->Tangent;
	else
		return 0;
}

void IrrVideo_S3DVertexTangents_setTangent(S3DVertexTangents* vert,vector3df* tangent)
{
	if (vert)
		vert->Tangent=*tangent;
}

vector3df* IrrVideo_S3DVertexTangents_getBinormal(S3DVertexTangents* vert)
{
	if (vert)
		return &vert->Binormal;
	else
		return 0;
}

void IrrVideo_S3DVertexTangents_setBinormal(S3DVertexTangents* vert,vector3df* binormal)
{
	if (vert)
		vert->Binormal=*binormal;
}

bool IrrVideo_S3DVertexTangents_EqEq(S3DVertexTangents* vert,S3DVertexTangents* other)
{
	if (vert)
		return (*vert==*other);
	else
		return false;
}

bool IrrVideo_S3DVertexTangents_NotEq(S3DVertexTangents* vert,S3DVertexTangents* other)
{
	if (vert)
		return (*vert!=*other);
	else
		return true;
}

bool IrrVideo_S3DVertexTangents_Less(S3DVertexTangents* vert,S3DVertexTangents* other)
{
	if (vert)
		return (*vert < *other);
	else
		return true;
}

bool IrrVideo_S3DVertexTangents_getVertexInfo(S3DVertexTangents* vert,f32* pos,f32* norm,f32* tcoords,s32* color,f32* tangent,f32* binormal)
{
	bool bSuccess=false;
	if (vert) {
		pos[0]=vert->Pos.X;
		pos[1]=vert->Pos.Y;
		pos[2]=vert->Pos.Z;
		norm[0]=vert->Normal.X;
		norm[1]=vert->Normal.Y;
		norm[2]=vert->Normal.Z;
		tcoords[0]=vert->TCoords.X;
		tcoords[1]=vert->TCoords.Y;
		color[0]=vert->Color.getRed();
		color[1]=vert->Color.getGreen();
		color[2]=vert->Color.getBlue();
		color[3]=vert->Color.getAlpha();
		binormal[0]=vert->Binormal.X;
		binormal[1]=vert->Binormal.Y;
		binormal[2]=vert->Binormal.Z;
		tangent[0]=vert->Tangent.X;
		tangent[1]=vert->Tangent.Y;
		tangent[2]=vert->Tangent.Z;
	
		bSuccess=true;
	}
	return bSuccess;
}

} // extern "C" 
