//------------------------------------------------------------------------------------
// irr::core::vector3df wrappers
//------------------------------------------------------------------------------------
extern "C" {

	// defaults: x=0.0f, y=0.0f, z=0.0f
	vector3df* IrrCore_Vector3df_new(f32 x,f32 y,f32 z)
	{
		vector3df* pRetVal=new vector3df(x,y,z);
		return pRetVal;
	}

	vector3df* IrrCore_Vector3df_newFromVal(f32 n)
	{
		return new vector3df(n);
	}
	
	vector3df* IrrCore_Vector3df_newFromVect(vector3df* other)
	{
		vector3df* pRetVal=new vector3df(*other);
		return pRetVal;
	}
	
	void IrrCore_Vector3df_del(vector3df* delVect)
	{
		if (delVect>0)
			delete delVect;
		delVect=0;
	}
	
	vector3df* IrrCore_Vector3df_set(vector3df* vect,f32 x,f32 y,f32 z)
	{
		if (vect>0)
			return &(vect->set(x,y,z));
		else return 0;
	}
	
	vector3df* IrrCore_Vector3df_setFromVect(vector3df* vect,vector3df* other)
	{
		if (vect>0)
			return &(vect->set(*other));
		else return 0;
	}
	
	f32 IrrCore_Vector3df_getX(vector3df* vect)
	{
		f32 fRetVal=0.0;
	
		if (vect>0)
			fRetVal=vect->X;
	
		return fRetVal;
	}
	
	f32 IrrCore_Vector3df_getY(vector3df* vect)
	{
		f32 fRetVal=0.0;
	
		if (vect>0)
			fRetVal=vect->Y;
	
		return fRetVal;
	}
	
	f32 IrrCore_Vector3df_getZ(vector3df* vect)
	{
		f32 fRetVal=0.0;
	
		if (vect>0)
			fRetVal=vect->Z;
	
		return fRetVal;
	}
	
	void IrrCore_Vector3df_setX(vector3df* vect,f32 x)
	{
		if (vect>0)
			vect->X=x;
	}
	
	void IrrCore_Vector3df_setY(vector3df* vect,f32 y)
	{
		if (vect>0)
			vect->Y=y;
	}
	
	void IrrCore_Vector3df_setZ(vector3df* vect,f32 z)
	{
		if (vect>0)
			vect->Z=z;
	}
	
	f64 IrrCore_Vector3df_getLength(vector3df* vect)
	{
		f64 fRetVal=0.0;
	
		if (vect>0)
			fRetVal=vect->getLength();
	
		return fRetVal;
	}
	
	f32 IrrCore_Vector3df_getLengthSQ(vector3df* vect)
	{
		f32 fRetVal=0.0;
	
		if (vect>0)
			fRetVal=vect->getLengthSQ();
	
		return fRetVal;
	}
	
	f32 IrrCore_Vector3df_dotProduct(vector3df* vect,vector3df* other)
	{
		f32 fRetVal=0.0;
	
		if (vect>0)
			fRetVal=vect->dotProduct(*other);
	
		return fRetVal;
	}
	
	f32 IrrCore_Vector3df_getDistanceFrom(vector3df* vect,vector3df* other)
	{
		f32 fRetVal=0.0;
	
		if (vect>0)
			fRetVal=vect->getDistanceFrom(*other);
	
		return fRetVal;
	}
	
	f32 IrrCore_Vector3df_getDistanceFromSQ(vector3df* vect,vector3df* other)
	{
		f32 fRetVal=0.0;
	
		if (vect>0)
			fRetVal=vect->getDistanceFromSQ(*other);
	
		return fRetVal;
	}
	
	vector3df* IrrCore_Vector3df_crossProduct(vector3df* vect,vector3df* other)
	{
		vector3df* pRetVal=0;
	
		if (vect>0)
			pRetVal=new vector3df(vect->crossProduct(*other));
	
		return pRetVal;
	}
	
	bool IrrCore_Vector3df_isBetweenPoints (vector3df* vect,vector3df* begin,vector3df* end) 
	{
		bool lRetVal=false;
	
		if (vect>0)
			lRetVal=vect->isBetweenPoints(*begin,*end);
	
		return lRetVal;
	}
	
	// do not delete
	vector3df* IrrCore_Vector3df_normalize(vector3df* vect)
	{
		if (vect>0)
			return &vect->normalize();	
		else return 0;
	}
	
	vector3df* IrrCore_Vector3df_setLength(vector3df* vect,f32 newlength)
	{
		if (vect>0)
			return &(vect->setLength(newlength));
		else return 0;	
	}
	
	vector3df* IrrCore_Vector3df_invert(vector3df* vect)
	{
		if (vect>0)
			return &(vect->invert());
		else return 0;	
	}
	
	vector3df* IrrCore_Vector3df_getInterpolated(vector3df* vect,vector3df* other,f64 d)
	{
		vector3df* pRetVal=0;
	
		if (vect>0)
			pRetVal=new vector3df(vect->getInterpolated(*other,d));
	
		return pRetVal;
	}
	
	void IrrCore_Vector3df_rotateXZBy(vector3df* vect,f64 degrees,vector3df* center = 0)
	{
		if (vect>0)
			vect->rotateXZBy(degrees,(center ? *center: vector3df()));
	}
	
	void IrrCore_Vector3df_rotateXYBy(vector3df* vect,f64 degrees,vector3df* center = 0)
	{
		if (vect>0)
			vect->rotateXYBy(degrees,(center ? *center: vector3df()));
	}
	
	void IrrCore_Vector3df_rotateYZBy(vector3df* vect,f64 degrees,vector3df* center = 0)
	{
		if (vect>0)
			vect->rotateYZBy(degrees,(center ? *center: vector3df()));
	}
	
	vector3df* IrrCore_Vector3df_setEq(vector3df* vect,vector3df* other)
	{
		if (vect>0) {
			*vect=*other;
			return vect;
		} else return 0;
	}
	
	bool IrrCore_Vector3df_EqEq(vector3df* vect,vector3df* other)
	{
		bool lRetVal=false;
	
		if (vect>0)
			lRetVal=(*vect==*other);
	
		return lRetVal;
	}
	
	bool IrrCore_Vector3df_NotEq(vector3df* vect,vector3df* other)
	{
		bool lRetVal=false;
	
		if (vect>0)
			lRetVal=(*vect!=*other);
	
		return lRetVal;
	}
	
	bool IrrCore_Vector3df_GreatEq(vector3df* vect,vector3df* other)
	{
		bool lRetVal=false;
	
		if (vect>0)
			lRetVal=(*vect>=*other);
	
		return lRetVal;
	}
	
	bool IrrCore_Vector3df_LessEq(vector3df* vect,vector3df* other)
	{
		bool lRetVal=false;
	
		if (vect>0)
			lRetVal=(*vect<=*other);
	
		return lRetVal;
	}
	
	vector3df* IrrCore_Vector3df_Plus(vector3df* vect,vector3df* other)
	{
		vector3df* pRetVal=new vector3df((*vect+*other));
		return pRetVal;
	}
	
	vector3df* IrrCore_Vector3df_PlusEq(vector3df* vect,vector3df* other)
	{
		if (vect>0) {
			*vect+=*other;
			return vect;
		} else return 0;
	}
	
	vector3df* IrrCore_Vector3df_PlusVal(vector3df* vect, f32 val)
	{
		vector3df* pRetVal=new vector3df((*vect + val));
		return pRetVal;
	}
	
	vector3df* IrrCore_Vector3df_PlusEqVal(vector3df* vect, f32 val)
	{
		if (vect>0) {
			*vect += val;
			return vect;
		} else return 0;
	}

	vector3df* IrrCore_Vector3df_Minus(vector3df* vect,vector3df* other)
	{
		vector3df* pRetVal=new vector3df((*vect-*other));
		return pRetVal;
	}
	
	vector3df* IrrCore_Vector3df_MinusEq(vector3df* vect,vector3df* other)
	{
		if (vect>0) {
			*vect-=*other;
			return vect;
		} else return 0;
	}
	
	vector3df* IrrCore_Vector3df_MinusVal(vector3df* vect, f32 val)
	{
		vector3df* pRetVal=new vector3df((*vect-val));
		return pRetVal;
	}
	
	vector3df* IrrCore_Vector3df_MinusEqVal(vector3df* vect,f32 val)
	{
		if (vect>0) {
			*vect-=val;
			return vect;
		} else return 0;
	}

	vector3df* IrrCore_Vector3df_MultVect(vector3df* vect,vector3df* other)
	{
		vector3df* pRetVal=new vector3df((*vect * *other));
		return pRetVal;
	}
	
	vector3df* IrrCore_Vector3df_Mult(vector3df* vect,f32 v)
	{
		vector3df* pRetVal=new vector3df((*vect*v));
		return pRetVal;
	}
	
	vector3df* IrrCore_Vector3df_MultEqVect(vector3df* vect,vector3df* other)
	{
		if (vect>0) {
			*vect*=*other;
			return vect;
		} else return 0;
	}
	
	vector3df* IrrCore_Vector3df_MultEq(vector3df* vect,f32 v)
	{
		if (vect>0) {
			*vect*=v;
			return vect;
		} else return 0;
	}
	
	vector3df* IrrCore_Vector3df_DivVect(vector3df* vect,vector3df* other)
	{
		vector3df* pRetVal=new vector3df((*vect / *other));
		return pRetVal;
	}
	
	vector3df* IrrCore_Vector3df_Div(vector3df* vect,f32 v)
	{
		vector3df* pRetVal=new vector3df((*vect / v));
		return pRetVal;
	}
	
	vector3df* IrrCore_Vector3df_DivEqVect(vector3df* vect,vector3df* other)
	{
		if (vect>0) {
			*vect/=*other;
			return vect;
		} else return 0;
	}
	
	vector3df* IrrCore_Vector3df_DivEq(vector3df* vect,f32 v)
	{
		if (vect>0) {
			*vect/=v;
			return vect;
		} else return 0;
	}
		
	// must delete this pointer
	void IrrCore_Vector3df_getAs4Values(vector3df* vect,f32* vals)
	{
		if (vect)
			vect->getAs4Values(vals);
	}
	
	vector3df* IrrCore_Vector3df_getHorizontalAngle(vector3df* vect)
	{
		if (vect)
			return new vector3df(vect->getHorizontalAngle());
		else return 0;
	}

	bool IrrCore_Vector3df_Less(vector3df* vect,const vector3df& other)
	{
		if (vect)
			return *vect < other;
		else return false;
	}
	
	bool IrrCore_Vector3df_Great(vector3df* vect,const vector3df& other)
	{
		if (vect)
			return *vect > other;
		else return false;
	}
		
	bool IrrCore_Vector3df_equals(vector3df* vect,const vector3df& other, const f32 tolerance = ROUNDING_ERROR_f32 )
	{
		if (vect)
			return vect->equals(other,tolerance);
		else return false;
	}
	
	vector3df* IrrCore_Vector3df_getInterpolated_quadratic(vector3df* vect,const vector3df& v2, const vector3df& v3, const f64 d)
	{
		if (vect)
			return new vector3df(vect->getInterpolated_quadratic(v2,v3,d));
		else return 0;
	}
	
	// do not delete
	vector3df* IrrCore_Vector3df_interpolate(vector3df* vect, const vector3df* a, const vector3df* b, f64 d)
	{
		if (vect)
			return &(vect->interpolate(*a, *b, d));
		else return 0;
	}
	
	// must delete
	vector3df* IrrCore_Vector3df_rotationToDirection(vector3df* vect, const vector3df* forwards = 0)
	{
		if (vect) 
			return new vector3df(vect->rotationToDirection((forwards ? *forwards : vector3df(0, 0, 1))));
		else return 0;
		
	}
	
	// must delete
	vector3df* IrrCore_Vector3df_getSphericalCoordinateAngles(vector3df* vect)
	{
		if (vect)
			return new vector3df(vect->getSphericalCoordinateAngles());
		else return 0;
	}
}
//------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------