#include "newtoncube.bmx.release.win32.x86.h"
static BBString _s0={
	&bbStringClass,
	37,
	{78,111,32,84,78,87,111,114,108,100,32,112,97,115,115,101,100
	,32,116,111,32,84,78,101,119,116,111,110,67,117,98,101,46
	,78,101,119,33}
};
struct BBDebugScope_3{int kind; const char *name; BBDebugDecl decls[4]; };
void __m_newtoncube_TNewtonCube_New(struct _m_newtoncube_TNewtonCube_obj* o) {
	__m_newtonbody_TNewtonBody_New(o);
	o->clas = (BBClass*)&_m_newtoncube_TNewtonCube;
	brl_blitz_RuntimeError(&_s0);
}
void __m_newtoncube_TNewtonCube_New_TTNWorldTTMeshf(struct _m_newtoncube_TNewtonCube_obj* o,struct newton_dynamics_TNWorld_obj* bbt_world,struct openb3d_openb3dex_TMesh_obj* bbt__mesh,BBFLOAT bbt__mass) {
	__m_newtonbody_TNewtonBody_New(o);
	o->clas = (BBClass*)&_m_newtoncube_TNewtonCube;
	o->__m_newtonbody_tnewtonbody_mesh =bbt__mesh;
	o->__m_newtonbody_tnewtonbody_mass =bbt__mass;
	struct newton_dynamics_TNCollision_obj* volatile bbt_collider=&bbNullObject;
	struct newton_dynamics_TNMatrix_obj* volatile bbt_matrix=&bbNullObject;
	bbt_collider=(bbt_world)->clas->m_CreateBox_fffiTTNMatrixTTNCollision(bbt_world,openb3d_openb3dex_MeshWidth(o->__m_newtonbody_tnewtonbody_mesh ),openb3d_openb3dex_MeshHeight(o->__m_newtonbody_tnewtonbody_mesh ),openb3d_openb3dex_MeshDepth(o->__m_newtonbody_tnewtonbody_mesh ),0,&bbNullObject,&bbNullObject);
	bbt_matrix=bbObjectAtomicNew(&newton_dynamics_TNMatrix);
	((struct _m_newtonbody_TNewtonBody_obj*)o)->clas->m_AlignNewtonMatrix_TTNMatrix(o,bbt_matrix);
	(bbt_world)->clas->m_CreateDynamicBody_TTNCollisionTTNMatrixTTNBody(bbt_world,bbt_collider,bbt_matrix,((struct newton_dynamics_TNBody_obj*)bbObjectDowncast(o,&newton_dynamics_TNBody)));
	((struct newton_dynamics_TNBody_obj*)o)->clas->m_SetMassProperties_fTTNCollision(o,o->__m_newtonbody_tnewtonbody_mass ,bbt_collider);
	(bbt_collider)->clas->m_Destroy(bbt_collider);
}
struct _m_newtoncube_TNewtonCube_obj* __m_newtoncube_TNewtonCube_New_TTNWorldTTMeshf_ObjectNew(BBClass * clas,struct newton_dynamics_TNWorld_obj* bbt_world,struct openb3d_openb3dex_TMesh_obj* bbt__mesh,BBFLOAT bbt__mass) {
	struct _m_newtoncube_TNewtonCube_obj* o = bbObjectNewNC(clas);
	__m_newtoncube_TNewtonCube_New_TTNWorldTTMeshf(o, bbt_world, bbt__mesh, bbt__mass);
	return o;
}
struct _m_newtoncube_TNewtonCube_obj* _m_newtoncube_TNewtonCube_CreateNewtonMesh_TTNewtonCube_TTNWorldTTMeshfi(struct newton_dynamics_TNWorld_obj* bbt_world,struct openb3d_openb3dex_TMesh_obj* bbt_mesh,BBFLOAT bbt_mass,BBINT bbt_shadow){
	struct _m_newtoncube_TNewtonCube_obj* volatile bbt_cube=__m_newtoncube_TNewtonCube_New_TTNWorldTTMeshf_ObjectNew(&_m_newtoncube_TNewtonCube,bbt_world,bbt_mesh,bbt_mass);
	(bbt_cube)->clas->m_ToggleShadow_i(bbt_cube,bbt_shadow);
	return bbt_cube;
}
struct BBDebugScope_3 _m_newtoncube_TNewtonCube_scope ={
	BBDEBUGSCOPE_USERTYPE,
	"TNewtonCube",
	{
		{
			BBDEBUGDECL_TYPEMETHOD,
			"New",
			"()",
			&__m_newtoncube_TNewtonCube_New
		},
		{
			BBDEBUGDECL_TYPEFUNCTION,
			"New",
			"(:TNWorld,:TMesh,f):TNewtonCube",
			&__m_newtoncube_TNewtonCube_New_TTNWorldTTMeshf
		},
		{
			BBDEBUGDECL_TYPEFUNCTION,
			"CreateNewtonMesh",
			"(:TNWorld,:TMesh,f,i):TNewtonCube",
			&_m_newtoncube_TNewtonCube_CreateNewtonMesh_TTNewtonCube_TTNWorldTTMeshfi
		},
		BBDEBUGDECL_END
	}
};
struct BBClass__m_newtoncube_TNewtonCube _m_newtoncube_TNewtonCube={
	&_m_newtonbody_TNewtonBody,
	bbObjectFree,
	&_m_newtoncube_TNewtonCube_scope,
	sizeof(struct _m_newtoncube_TNewtonCube_obj),
	__m_newtoncube_TNewtonCube_New,
	bbObjectDtor,
	bbObjectToString,
	bbObjectCompare,
	bbObjectSendMessage,
	0,
	0,
	0
	,__m_newtonbody_TNewtonBody_OnForceAndTorque_fi
	,__m_newtonbody_TNewtonBody_OnTransform_pfi
	,_newton_dynamics_TNBody_SetMatrix_TTNMatrix
	,_newton_dynamics_TNBody_GetMatrix_TTNMatrix
	,_newton_dynamics_TNBody_GetMassMatrix_vfvfvfvf
	,_newton_dynamics_TNBody_GetRotation_vfvfvfvf
	,_newton_dynamics_TNBody_GetInvMass_vfvfvfvf
	,_newton_dynamics_TNBody_GetInertiaMatrix_TTNMatrix
	,_newton_dynamics_TNBody_GetInvInertiaMatrix_TTNMatrix
	,_newton_dynamics_TNBody_GetOmega_vfvfvf
	,_newton_dynamics_TNBody_GetVelocity_vfvfvf
	,_newton_dynamics_TNBody_GetForce_vfvfvf
	,_newton_dynamics_TNBody_GetTorque_vfvfvf
	,_newton_dynamics_TNBody_GetForceAcc_vfvfvf
	,_newton_dynamics_TNBody_GetTorqueAcc_vfvfvf
	,_newton_dynamics_TNBody_GetCentreOfMass_vfvfvf
	,_newton_dynamics_TNBody_GetAngularDamping_vfvfvf
	,_newton_dynamics_TNBody_NewtonBodyGetAABB_vfvfvfvfvfvf
	,_newton_dynamics_TNBody_SetAngularDamping_fff
	,_newton_dynamics_TNBody_SetForceAndTorqueCallback_F_TTNBodyfi_v_
	,_newton_dynamics_TNBody_SetTransformCallback_F_TTNBodypfi_v_
	,_newton_dynamics_TNBody_SetOmega_ffff
	,_newton_dynamics_TNBody_SetForce_ffff
	,_newton_dynamics_TNBody_SetVelocity_ffff
	,_newton_dynamics_TNBody_SetTorque_ffff
	,_newton_dynamics_TNBody_SetMassProperties_fTTNCollision
	,_newton_dynamics_TNBody_SetLinearDamping_f
	,_newton_dynamics_TNBody_GetType
	,_newton_dynamics_TNBody_GetCollidable
	,_newton_dynamics_TNBody_SetCollidable_i
	,_newton_dynamics_TNBody_AddForce_fff
	,_newton_dynamics_TNBody_AddTorque_fff
	,_newton_dynamics_TNBody_CalculateInverseDynamicsForce_ffffvfvfvf
	,newton_dynamics_TNBody__forceAndTorqueCallback_v_pbfi
	,newton_dynamics_TNBody__defaultForceAndTorqueCallback_v_pbfi
	,newton_dynamics_TNBody__transformCallback_v_pbpfi
	,newton_dynamics_TNBody__defaultTransformCallback_v_pbpfi
	,_newton_dynamics_TNBody_Destroy
	,__m_newtonbody_TNewtonBody_ToggleShadow_i
	,__m_newtonbody_TNewtonBody_Remove
	,__m_newtonbody_TNewtonBody_AlignNewtonMatrix_TTNMatrix
	,__m_newtonbody_TNewtonBody_AlignEntity_pf
	,_m_newtoncube_TNewtonCube_CreateNewtonMesh_TTNewtonCube_TTNWorldTTMeshfi
};

struct _m_newtoncube_TNewtonCube_obj* _m_newtoncube_CreateNewtonCubeMesh(struct newton_dynamics_TNWorld_obj* bbt_world,struct openb3d_openb3dex_TMesh_obj* bbt_mesh,BBFLOAT bbt_mass,BBINT bbt_shadow){
	return _m_newtoncube_TNewtonCube_CreateNewtonMesh_TTNewtonCube_TTNWorldTTMeshfi(bbt_world,bbt_mesh,bbt_mass,bbt_shadow);
}
static int _bb_newtonb3d_newtoncube_inited = 0;
int _bb_newtonb3d_newtoncube(){
	if (!_bb_newtonb3d_newtoncube_inited) {
		_bb_newtonb3d_newtoncube_inited = 1;
		__bb_brl_blitz_blitz();
		__bb_brl_appstub_appstub();
		__bb_brl_audio_audio();
		__bb_brl_bank_bank();
		__bb_brl_bankstream_bankstream();
		__bb_brl_basic_basic();
		__bb_brl_bmploader_bmploader();
		__bb_brl_d3d7max2d_d3d7max2d();
		__bb_brl_d3d9max2d_d3d9max2d();
		__bb_brl_data_data();
		__bb_brl_directsoundaudio_directsoundaudio();
		__bb_brl_eventqueue_eventqueue();
		__bb_brl_freeaudioaudio_freeaudioaudio();
		__bb_brl_freetypefont_freetypefont();
		__bb_brl_glgraphics_glgraphics();
		__bb_brl_glmax2d_glmax2d();
		__bb_brl_gnet_gnet();
		__bb_brl_jpgloader_jpgloader();
		__bb_brl_map_map();
		__bb_brl_maxlua_maxlua();
		__bb_brl_maxutil_maxutil();
		__bb_brl_oggloader_oggloader();
		__bb_brl_openalaudio_openalaudio();
		__bb_brl_pngloader_pngloader();
		__bb_brl_retro_retro();
		__bb_brl_tgaloader_tgaloader();
		__bb_brl_threads_threads();
		__bb_brl_timer_timer();
		__bb_brl_timerdefault_timerdefault();
		__bb_brl_wavloader_wavloader();
		__bb_pub_freejoy_freejoy();
		__bb_pub_freeprocess_freeprocess();
		__bb_pub_macos_macos();
		__bb_pub_opengles_opengles();
		__bb_pub_vulkan_vulkan();
		__bb_pub_xmmintrin_xmmintrin();
		__bb_newton_dynamics_dynamics();
		__bb_openb3d_b3dglgraphics_b3dglgraphics();
		_bb_newtonb3d_newtonbody();
		bbObjectRegisterType(&_m_newtoncube_TNewtonCube);
		return 0;
	}
	return 0;
}