#pragma once
#pragma unmanaged
#include "BulletDynamics/Dynamics/btRigidBody.h"
#pragma managed
#include "LinearMath/DefaultMotionState.h"
#include "BulletCollision/CollisionShapes/ICollisionShape.h"

using namespace System;
using namespace Microsoft::Xna::Framework;

namespace BulletCLI
{
    public enum class CollisionFlags
	{
		CF_STATIC_OBJECT= 1,
		CF_KINEMATIC_OBJECT= 2,
		CF_NO_CONTACT_RESPONSE = 4,
		CF_CUSTOM_MATERIAL_CALLBACK = 8,//this allows per-triangle material (friction/restitution)
		CF_CHARACTER_OBJECT = 16,
		CF_DISABLE_VISUALIZE_OBJECT = 32, //disable debug drawing
		CF_DISABLE_SPU_COLLISION_PROCESSING = 64//disable parallel/SPU processing
	};
	public ref class RigidBody
	{
	private:
		btRigidBody* m_p;
        btVector3* inertia;
    internal:
        btRigidBody* GetPtr(){return m_p;}
        bool m_bRegisterd;
    public:
		RigidBody(float mass, DefaultMotionState^ motionState, ICollisionShape^ collisionShape,Vector3 localInertia);
		virtual ~RigidBody();
		!RigidBody();
        
        void SetCollisionFlags(CollisionFlags flag);
        void SetDamping(float lin_damping, float ang_damping);
        void SetFriction(float friction);
        void SetRestitution(float restitution);
        void SetActivationState(int state);
        int GetActivationState();
        Matrix GetWorldTransform();
        Matrix GetWorldTransformSmart();
        void SetWorldTransformByMotionState(Matrix^ matrix);
        void SetWorldTransform(Matrix^ matrix);
        //void SetDeactivationTime(float time);
        void Activate(bool forceActivation);
        //void ForceActivationState(int state);
        void ResetVelocity();
    };
}