//------------------------------------------------------------------------------------
// irr::scene::SViewFrustum wrappers
//------------------------------------------------------------------------------------
extern "C" 
{

	SViewFrustum* IrrScene_SViewFrustum_new()
	{
		return new SViewFrustum();
	}

	SViewFrustum* IrrScene_SViewFrustum_newFromOther(const SViewFrustum& other)
	{
		return new SViewFrustum(other);
	}
	
	SViewFrustum* IrrScene_SViewFrustum_newFromMatrix(const matrix4& mat)
	{
		return new SViewFrustum(mat);
	}
	
	void IrrScene_SViewFrustum_del(SViewFrustum* vf)
	{
		if (vf)
			delete vf;
		vf=0;
	}
	
	aabbox3d<f32>* IrrScene_SViewFrustum_getBoundingBox(SViewFrustum* vf)
	{
		if (vf)
			return new aabbox3d<f32>(vf->getBoundingBox());
		else return 0;
	}
	
	vector3df* IrrScene_SViewFrustum_getFarLeftDown(SViewFrustum* vf)
	{
		if (vf)
			return new vector3df(vf->getFarLeftDown());
		else return 0;
	}
	
	vector3df* IrrScene_SViewFrustum_getFarLeftUp(SViewFrustum* vf)
	{
		if (vf)
			return new vector3df(vf->getFarLeftUp());
		else return 0;
	}
	
	vector3df* IrrScene_SViewFrustum_getFarRightDown(SViewFrustum* vf)
	{
		if (vf)
			return new vector3df(vf->getFarRightDown());
		else return 0;
	}
	
	vector3df* IrrScene_SViewFrustum_getFarRightUp(SViewFrustum* vf)
	{
		if (vf)
			return new vector3df(vf->getFarRightUp());
		else return 0;
	}
	
	void IrrScene_SViewFrustum_recalculateBoundingBox(SViewFrustum* vf)
	{
		if (vf)
			vf->recalculateBoundingBox();
	}
	
	void IrrScene_SViewFrustum_transform(SViewFrustum* vf,const matrix4& mat)
	{
		if (vf)
			vf->transform(mat);
	}
	
	// do not delete
	aabbox3d<f32>* IrrScene_SViewFrustum_boundingBox(SViewFrustum* vf)
	{
		if (vf)
			return &vf->boundingBox;
		else return 0;
	}
	
	// do not delete
	vector3df* IrrScene_SViewFrustum_cameraPosition(SViewFrustum* vf)
	{
		if (vf)
			return &vf->cameraPosition;
		else return 0;
	}
	
	// do not delete
	plane3d<f32>* IrrScene_SViewFrustum_getPlane(SViewFrustum* vf,s32 idx)
	{
		if (vf)
			return &vf->planes[idx];
		else return 0;
	}
	
	// safe to delete plane passed in
	void IrrScene_SViewFrustum_setPlane(SViewFrustum* vf,plane3d<f32>& plane,s32 idx)
	{
		if (vf)
			vf->planes[idx]=plane3d<f32>(plane);
	}

	void IrrScene_SViewFrustum_setFrom(SViewFrustum* vf,const core::matrix4& mat)
	{
		if (vf)
			vf->setFrom(mat);
	}	
	
	
	bool IrrScene_SViewFrustum_clipLine(SViewFrustum* vf, core::line3d<f32>& line)
	{
		if (vf)
			return vf->clipLine(line);
		else return false;
	}
	
	// must delete
	matrix4* IrrScene_SViewFrustum_getTransform(SViewFrustum* vf, video::E_TRANSFORMATION_STATE state )
	{
		if (vf)
			return new matrix4(vf->getTransform(state));
		else return 0;
	}

}



