/* -----------------------------------------------------------------------------
	GSFramework
	Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
----------------------------------------------------------------------------- */


#ifndef	__NPHYSICITEMDESC__
#define	__NPHYSICITEMDESC__


		#include "physic/physic_shape.h"
		#include "physic/physic_wheel.h"
		#include "memory/bit_field.h"


namespace GS {
	namespace S3D {

//
struct	PhysicItemDesc
{
		/// Physic mode.
enum	Mode
{
		Mode_None				=	0,
		Mode_Static,
		Mode_Kinematic,
		Mode_Dynamic,
		Mode_Character,
		Mode_Vehicle
};

		/// Physic flag.
enum
{
		PhysicFlag_None			=	0,
		PhysicFlag_NoGravity	=	(1 << 0),
		PhysicFlag_Ghost		=	(1 << 1)
};

		Mode			physic_mode;
		BitField		physic_flags;

		uint			self_mask, collision_mask;

		AutoList <PhysicShape *> shape_list;

		float			linear_damping, angular_damping;
		Vector4			linear_factor, angular_factor;

struct	Vehicle
{
		AutoList <PhysicWheel *> wheel_list;
};
		Vehicle			vehicle;

struct	Character
{
		float	radius;
		float	height;
		float	max_step;

		Character() : radius(1), height(1), max_step(0.2f) {}
};
		Character		character;

		float			GetMass() const;

		bool			FromMetaTag(NML::Tag &);
		NML::Tag		*AsMetaTag() const;

		PhysicItemDesc()
		{
			physic_mode = Mode_None;

			linear_factor.Set(1, 1, 1);
			angular_factor.Set(1, 1, 1);
			linear_damping = 1;
			angular_damping = 1;

			self_mask = collision_mask = 1;
		}
};

	} // S3D
} // GS


#endif	// __NPHYSICITEMDESC__
