//********************************************************************
// This source file is part of Ninfa3D Engine
// 
// Copyright (C) 2008-2009 Viz_fuerte.
// All rights reserved.
// 
// LIMITED WARRANTY
// This software is provided "as-is", without any express or implied warranty.
// In no event shall the author be held liable for any damages arising from the use of this software.
// This is a contract. By accepting the Ninfa3D Engine (the SOFTWARE), 
// you (either an individual or a single entity, the LICENSEE) accept the terms and conditions of this licensing agreement.
// 
// If the LICENSEE does not accept the terms and conditions, then LICENSEE must not accept the SOFTWARE.
// If at a later time the LICENSEE decides not to continue licensing the SOFTWARE under these terms and 
// conditions, then the LICENSEE must delete permanently all files constituting the SOFTWARE.
//
// File: CJointSceneNode.h
//********************************************************************

/*--------------------------------------------------------------------
Includos*/

	#include "..\Header Files\Ninfa3D.h"

	class CJointSceneNode : public ISceneNode
	{
	public:

		CJointSceneNode(ISceneNode* parent,ISceneManager* mgr,s32 id);
		~CJointSceneNode();

		void addJointBall(float X,float Y,float Z,float DX,float DY,float DZ,NewtonBody* B1,NewtonBody* B2);
		void addJointHinge(float X,float Y,float Z,float DX,float DY,float DZ,NewtonBody* B1,NewtonBody* B2);
		void addJointSlider(float X,float Y,float Z,float DX,float DY,float DZ,NewtonBody* B1,NewtonBody* B2);
		void addJointCorkscrew(float X,float Y,float Z,float DX,float DY,float DZ,NewtonBody* B1,NewtonBody* B2);
		void addJointUpVector(float X,float Y,float Z,NewtonBody* B1);

		void setBallLimits(float maxConeAngle,float minTwistAngle,float maxTwistAngle);
		void setHingeLimits(float minAngle,float maxAngle);
		void setSliderLimits(float minDist,float maxDist);
		void setCorkScrewLinearLimits(float minDist,float maxDist);
		void setCorkScrewAngularLimits(float minDist,float maxDist);

		void setCollisionState(int state);
		
		virtual void setParent(ISceneNode* newParent);
		virtual void remove();

		virtual void OnPreRender();
		virtual void render();

		virtual SMaterial& getMaterial(s32 i);
		virtual const aabbox3d<f32>& getBoundingBox() const;

	private:

		aabbox3d<f32> BBox;
		SMaterial material;

		NewtonCustomJoint* Joint;

	};