<commit_before>/*
	This file is part of the E_MinSG library extension Physics.
	Copyright (C) 2013 <NAME> <<EMAIL>>
	Copyright (C) 2013,2015 <NAME> <<EMAIL>>
	Copyright (C) 2013 <NAME>

	This library is subject to the terms of the Mozilla Public License, v. 2.0.
	You should have received a copy of the MPL along with this library; see the
	file LICENSE. If not, you can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifdef MINSG_EXT_PHYSICS

#include "E_PhysicWorld.h"
#include "../../Core/Nodes/E_Node.h"
#include <E_Geometry/E_Box.h>
#include <E_Geometry/E_Plane.h>
#include <E_Geometry/E_Vec3.h>
#include <MinSG/Ext/Physics/PhysicWorld.h>
#include <MinSG/Ext/Physics/CollisionShape.h>
#include <E_Rendering/E_RenderingContext.h>
#include <Util/References.h>
#include <E_Util/E_Utils.h>


namespace E_MinSG {
namespace Physics{
class E_CollisionShape : public EScript::ReferenceObject<Util::Reference<MinSG::Physics::CollisionShape>> {
		ES_PROVIDES_TYPE_NAME(CollisionShape)
	public:
		static EScript::Type * getTypeObject() {
			// E_CollisionShape ---|> Object
			static EScript::ERef<EScript::Type> typeObject = new EScript::Type(EScript::Object::getTypeObject());
			return typeObject.get();
		}
        template<typename...args> explicit E_CollisionShape(args&&... params) :
			ReferenceObject_t(E_CollisionShape::getTypeObject(),std::forward<args>(params)...) {}

		virtual ~E_CollisionShape() {}
};
}
}
ES_CONV_EOBJ_TO_OBJ(E_MinSG::Physics::E_CollisionShape,   					MinSG::Physics::CollisionShape*,		(**eObj).get())
ES_CONV_OBJ_TO_EOBJ(MinSG::Physics::CollisionShape*,      					E_MinSG::Physics::E_CollisionShape,	obj ? new E_MinSG::Physics::E_CollisionShape(obj) : nullptr)
ES_CONV_OBJ_TO_EOBJ(Util::Reference<MinSG::Physics::CollisionShape>,      	E_MinSG::Physics::E_CollisionShape,	obj ? new E_MinSG::Physics::E_CollisionShape(obj) : nullptr)

#include <EScript/Basics.h>
#include <EScript/StdObjects.h>

namespace E_MinSG {
namespace Physics{

	//! (static)
EScript::Type * E_PhysicWorld::getTypeObject() {
	// E_PhysicWorld ---|> Object
	static EScript::ERef<EScript::Type> typeObject = new EScript::Type(EScript::Object::getTypeObject());
	return typeObject.get();
}

//! (static) init members
void E_PhysicWorld::init(EScript::Namespace & lib) {
	EScript::Namespace * ns = new EScript::Namespace;
	declareConstant(&lib,"Physics",ns);

	EScript::Type * typeObject = E_PhysicWorld::getTypeObject();
	declareConstant(ns,getClassName(),typeObject);

	declareConstant(ns,E_CollisionShape::getClassName(),E_CollisionShape::getTypeObject());

	using namespace MinSG::Physics;

	// ---------------------------

	//!	[ESMF] PhysicWorld MinSG.Physics.createBulletWorld()
	ES_FUN(ns,"createBulletWorld",0,0,								EScript::create(PhysicWorld::createBulletWorld()))

	//! [ESMF] thisEObj PhysicWorld.addNodeToPhyiscWorld(Node, CollisionShaoe)
	ES_MFUN(typeObject, PhysicWorld, "addNodeToPhyiscWorld", 2, 2,	(thisObj->addNodeToPhyiscWorld(parameter[0].to<MinSG::Node*>(rt),
																		parameter[1].to<MinSG::Physics::CollisionShape*>(rt)),thisEObj))

    //! [ESMF] thisEObj PhysicWorld.applyHingeConstraint(Node, Node, Geometry::Vec3, Geometry::Vec3)
	ES_MFUN(typeObject, PhysicWorld, "applyHingeConstraint", 4, 4, (thisObj->applyHingeConstraint(parameter[0].to<MinSG::Node*>(rt), parameter[1].to<MinSG::Node*>(rt), parameter[2].to<Geometry::Vec3>(rt), parameter[3].to<Geometry::Vec3>(rt)),thisEObj))

	//! [ESMF] thisEObj PhysicWorld.applyP2PConstraint(Node, Node, Geometry::Vec3)
	ES_MFUN(typeObject, PhysicWorld, "applyP2PConstraint", 3, 3, (thisObj->applyP2PConstraint(parameter[0].to<MinSG::Node*>(rt), parameter[1].to<MinSG::Node*>(rt), parameter[2].to<Geometry::Vec3>(rt)),thisEObj))

	//! [ESMF] thisEObj PhysicWorld.cleanupWorld()
	ES_MFUN(typeObject, PhysicWorld, "cleanupWorld", 0, 0,			(thisObj->cleanupWorld(),thisEObj))

	//! [ESMF] thisEObj PhysicWorld.createGroundPlane(Geometry::Plane)
	ES_MFUN(typeObject, PhysicWorld, "createGroundPlane", 1, 1,		(thisObj->createGroundPlane(parameter[0].to<const Geometry::Plane&>(rt)),thisEObj))

	//! [ESMF] CollisionShape PhysicWorld.createShape_AABB(Geometry::Box)
	ES_MFUN(typeObject, PhysicWorld, "createShape_AABB", 1, 1,		thisObj->createShape_AABB(parameter[0].to<const Geometry::Box&>(rt)))

	//! [ESMF] Geometry.Vec3 PhysicWorld.getGravity()
	ES_MFUN(typeObject, PhysicWorld, "getGravity", 0, 0,			EScript::create((thisObj->getGravity())))

	 //! [ESMF] thisEObj PhysicWorld.initNodeObserver(Node)
	ES_MFUN(typeObject, PhysicWorld, "initNodeObserver", 1, 1,		(thisObj->initNodeObserver(parameter[0].to<MinSG::Node*>(rt)),thisEObj))

	//! [ESMF] thisEObj PhysicWorld.removeConstraints(Node)
	ES_MFUN(typeObject, PhysicWorld, "removeConstraints", 1, 1,	(thisObj->removeConstraints(parameter[0].to<MinSG::Node*>(rt)),thisEObj))

	//! [ESMF] thisEObj PhysicWorld.removeConstraintBetweenNodes(Node, Node)
	ES_MFUN(typeObject, PhysicWorld, "removeConstraintBetweenNodes", 2, 2,	(thisObj->removeConstraintBetweenNodes(parameter[0].to<MinSG::Node*>(rt), parameter[1].to<MinSG::Node*>(rt)),thisEObj))

	//! [ESMF] thisEObj PhysicWorld.removeNode(Node)
	ES_MFUN(typeObject, PhysicWorld, "removeNode", 1, 1,			(thisObj->removeNode(parameter[0].to<MinSG::Node*>(rt)),thisEObj))

	 //! [ESMF] thisEObj PhysicWorld.renderPhysicWorld(RenderingContext)
	ES_MFUN(typeObject, PhysicWorld, "renderPhysicWorld", 1, 1,		(thisObj->renderPhysicWorld(*parameter[0].to<Rendering::RenderingContext*>(rt)),thisEObj))

	//! [ESMF] thisEObj PhysicWorld.setGravity(Geometry.Vec3)
	ES_MFUN(typeObject, PhysicWorld, "setGravity", 1, 1,			(thisObj->setGravity(parameter[0].to<Geometry::Vec3>(rt)),thisEObj))

   //! [ESMF] thisEObj PhysicWorld.stepSimulation(float)
	ES_MFUN(typeObject, PhysicWorld, "stepSimulation", 1, 1,		(thisObj->stepSimulation(parameter[0].toFloat()),thisEObj))

	//! [ESMF] thisEObj PhysicWorld.updateFriction(Node, float)
	ES_MFUN(typeObject, PhysicWorld, "updateFriction", 2, 2,		(thisObj->updateFriction(parameter[0].to<MinSG::Node*>(rt), parameter[1].toFloat() ),thisEObj))

	//! [ESMF] thisEObj PhysicWorld.updateLocalSurfaceVelocity(Node, Vec3)
	ES_MFUN(typeObject, PhysicWorld, "updateLocalSurfaceVelocity", 2, 2,(thisObj->updateLocalSurfaceVelocity(parameter[0].to<MinSG::Node*>(rt), parameter[1].to<Geometry::Vec3>(rt)),thisEObj))

	//! [ESMF] thisEObj PhysicWorld.updateMass(Node, float)
	ES_MFUN(typeObject, PhysicWorld, "updateMass", 2, 2,			(thisObj->updateMass(parameter[0].to<MinSG::Node*>(rt), parameter[1].toFloat() ),thisEObj))

	//! [ESMF] thisEObj PhysicWorld.updateRollingFriction(Node, float)
	ES_MFUN(typeObject, PhysicWorld, "updateRollingFriction", 2, 2,	(thisObj->updateRollingFriction(parameter[0].to<MinSG::Node*>(rt), parameter[1].toFloat() ),thisEObj))

	//! [ESMF] thisEObj PhysicWorld.updateShape(Node, CollisionShape)
	ES_MFUN(typeObject, PhysicWorld, "updateShape", 2, 2,			(thisObj->updateShape(parameter[0].to<MinSG::Node*>(rt),
								  parameter[1].to<MinSG::Physics::CollisionShape*>(rt)) ,thisEObj))

}

}

}

#endif //MINSG_EXT_PHYSICS

<commit_msg>Physics: Redesign handling of physics properties...<commit_after>/*
	This file is part of the E_MinSG library extension Physics.
	Copyright (C) 2013 <NAME> <<EMAIL>>
	Copyright (C) 2013,2015 <NAME> <<EMAIL>>
	Copyright (C) 2013 <NAME>

	This library is subject to the terms of the Mozilla Public License, v. 2.0.
	You should have received a copy of the MPL along with this library; see the
	file LICENSE. If not, you can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifdef MINSG_EXT_PHYSICS

#include "E_PhysicWorld.h"
#include "../../Core/Nodes/E_Node.h"
#include <E_Geometry/E_Box.h>
#include <E_Geometry/E_Plane.h>
#include <E_Geometry/E_Vec3.h>
#include <MinSG/Ext/Physics/PhysicWorld.h>
#include <MinSG/Ext/Physics/CollisionShape.h>
#include <E_Rendering/E_RenderingContext.h>
#include <Util/References.h>
#include <E_Util/E_Utils.h>


namespace E_MinSG {
namespace Physics{
class E_CollisionShape : public EScript::ReferenceObject<Util::Reference<MinSG::Physics::CollisionShape>> {
		ES_PROVIDES_TYPE_NAME(CollisionShape)
	public:
		static EScript::Type * getTypeObject() {
			// E_CollisionShape ---|> Object
			static EScript::ERef<EScript::Type> typeObject = new EScript::Type(EScript::Object::getTypeObject());
			return typeObject.get();
		}
        template<typename...args> explicit E_CollisionShape(args&&... params) :
			ReferenceObject_t(E_CollisionShape::getTypeObject(),std::forward<args>(params)...) {}

		virtual ~E_CollisionShape() {}
};
}
}
ES_CONV_EOBJ_TO_OBJ(E_MinSG::Physics::E_CollisionShape,   					MinSG::Physics::CollisionShape*,		(**eObj).get())
ES_CONV_OBJ_TO_EOBJ(MinSG::Physics::CollisionShape*,      					E_MinSG::Physics::E_CollisionShape,	obj ? new E_MinSG::Physics::E_CollisionShape(obj) : nullptr)
ES_CONV_OBJ_TO_EOBJ(Util::Reference<MinSG::Physics::CollisionShape>,      	E_MinSG::Physics::E_CollisionShape,	obj ? new E_MinSG::Physics::E_CollisionShape(obj) : nullptr)

#include <EScript/Basics.h>
#include <EScript/StdObjects.h>

namespace E_MinSG {
namespace Physics{

	//! (static)
EScript::Type * E_PhysicWorld::getTypeObject() {
	// E_PhysicWorld ---|> Object
	static EScript::ERef<EScript::Type> typeObject = new EScript::Type(EScript::Object::getTypeObject());
	return typeObject.get();
}

//! (static) init members
void E_PhysicWorld::init(EScript::Namespace & lib) {
	EScript::Namespace * ns = new EScript::Namespace;
	declareConstant(&lib,"Physics",ns);

	EScript::Type * typeObject = E_PhysicWorld::getTypeObject();
	declareConstant(ns,getClassName(),typeObject);

	declareConstant(ns,E_CollisionShape::getClassName(),E_CollisionShape::getTypeObject());

	using namespace MinSG::Physics;

	// ---------------------------

	//!	[ESMF] PhysicWorld MinSG.Physics.createBulletWorld()
	ES_FUN(ns,"createBulletWorld",0,0,								EScript::create(PhysicWorld::createBulletWorld()))

	//! [ESMF] thisEObj PhysicWorld.applyProperties(Node)
	ES_MFUN(typeObject, PhysicWorld, "applyProperties", 1, 1,	(thisObj->applyProperties(*parameter[0].to<MinSG::Node*>(rt)),thisEObj))

    //! [ESMF] thisEObj PhysicWorld.applyHingeConstraint(Node, Node, Geometry::Vec3, Geometry::Vec3)
	ES_MFUN(typeObject, PhysicWorld, "applyHingeConstraint", 4, 4, (thisObj->applyHingeConstraint(parameter[0].to<MinSG::Node*>(rt), parameter[1].to<MinSG::Node*>(rt), parameter[2].to<Geometry::Vec3>(rt), parameter[3].to<Geometry::Vec3>(rt)),thisEObj))

	//! [ESMF] thisEObj PhysicWorld.applyP2PConstraint(Node, Node, Geometry::Vec3)
	ES_MFUN(typeObject, PhysicWorld, "applyP2PConstraint", 3, 3, (thisObj->applyP2PConstraint(parameter[0].to<MinSG::Node*>(rt), parameter[1].to<MinSG::Node*>(rt), parameter[2].to<Geometry::Vec3>(rt)),thisEObj))

	//! [ESMF] thisEObj PhysicWorld.cleanupWorld()
	ES_MFUN(typeObject, PhysicWorld, "cleanupWorld", 0, 0,			(thisObj->cleanupWorld(),thisEObj))

	//! [ESMF] thisEObj PhysicWorld.createGroundPlane(Geometry::Plane)
	ES_MFUN(typeObject, PhysicWorld, "createGroundPlane", 1, 1,		(thisObj->createGroundPlane(parameter[0].to<const Geometry::Plane&>(rt)),thisEObj))

	//! [ESMF] CollisionShape PhysicWorld.createShape_AABB(Geometry::Box)
	ES_MFUN(typeObject, PhysicWorld, "createShape_AABB", 1, 1,		thisObj->createShape_AABB(parameter[0].to<const Geometry::Box&>(rt)))

	//! [ESMF] Geometry.Vec3 PhysicWorld.getGravity()
	ES_MFUN(typeObject, PhysicWorld, "getGravity", 0, 0,			EScript::create((thisObj->getGravity())))

	 //! [ESMF] thisEObj PhysicWorld.initNodeObserver(Node)
	ES_MFUN(typeObject, PhysicWorld, "initNodeObserver", 1, 1,		(thisObj->initNodeObserver(parameter[0].to<MinSG::Node*>(rt)),thisEObj))

	//! [ESMF] thisEObj PhysicWorld.removeConstraints(Node)
	ES_MFUN(typeObject, PhysicWorld, "removeConstraints", 1, 1,	(thisObj->removeConstraints(parameter[0].to<MinSG::Node*>(rt)),thisEObj))

	//! [ESMF] thisEObj PhysicWorld.removeConstraintBetweenNodes(Node, Node)
	ES_MFUN(typeObject, PhysicWorld, "removeConstraintBetweenNodes", 2, 2,	(thisObj->removeConstraintBetweenNodes(parameter[0].to<MinSG::Node*>(rt), parameter[1].to<MinSG::Node*>(rt)),thisEObj))

	//! [ESMF] thisEObj PhysicWorld.removeNode(Node)
	ES_MFUN(typeObject, PhysicWorld, "removeNode", 1, 1,			(thisObj->removeNode(parameter[0].to<MinSG::Node*>(rt)),thisEObj))

	 //! [ESMF] thisEObj PhysicWorld.renderPhysicWorld(RenderingContext)
	ES_MFUN(typeObject, PhysicWorld, "renderPhysicWorld", 1, 1,		(thisObj->renderPhysicWorld(*parameter[0].to<Rendering::RenderingContext*>(rt)),thisEObj))

	//! [ESMF] thisEObj PhysicWorld.setGravity(Geometry.Vec3)
	ES_MFUN(typeObject, PhysicWorld, "setGravity", 1, 1,			(thisObj->setGravity(parameter[0].to<Geometry::Vec3>(rt)),thisEObj))

   //! [ESMF] thisEObj PhysicWorld.stepSimulation(float)
	ES_MFUN(typeObject, PhysicWorld, "stepSimulation", 1, 1,		(thisObj->stepSimulation(parameter[0].toFloat()),thisEObj))

	//! [ESMF] thisEObj PhysicWorld.updateFriction(Node, float)
	ES_MFUN(typeObject, PhysicWorld, "updateFriction", 2, 2,		(thisObj->updateFriction(parameter[0].to<MinSG::Node*>(rt), parameter[1].toFloat() ),thisEObj))

	//! [ESMF] thisEObj PhysicWorld.updateLocalSurfaceVelocity(Node, Vec3)
	ES_MFUN(typeObject, PhysicWorld, "updateLocalSurfaceVelocity", 2, 2,(thisObj->updateLocalSurfaceVelocity(parameter[0].to<MinSG::Node*>(rt), parameter[1].to<Geometry::Vec3>(rt)),thisEObj))

	//! [ESMF] thisEObj PhysicWorld.updateMass(Node, float)
	ES_MFUN(typeObject, PhysicWorld, "updateMass", 2, 2,			(thisObj->updateMass(parameter[0].to<MinSG::Node*>(rt), parameter[1].toFloat() ),thisEObj))

	//! [ESMF] thisEObj PhysicWorld.updateRollingFriction(Node, float)
	ES_MFUN(typeObject, PhysicWorld, "updateRollingFriction", 2, 2,	(thisObj->updateRollingFriction(parameter[0].to<MinSG::Node*>(rt), parameter[1].toFloat() ),thisEObj))

	//! [ESMF] thisEObj PhysicWorld.updateShape(Node, CollisionShape)
	ES_MFUN(typeObject, PhysicWorld, "updateShape", 2, 2,			(thisObj->updateShape(parameter[0].to<MinSG::Node*>(rt),
								  parameter[1].to<MinSG::Physics::CollisionShape*>(rt)) ,thisEObj))

}

}

}

#endif //MINSG_EXT_PHYSICS


{'fraction_non_alphanumeric': 0.17053215708594194, 'fraction_numerical': 0.014726807057484349, 'mean_word_length': 7.2108644859813085, 'pattern_counts': {'":': 0, '<': 100, '<?xml version=': 0, '>': 142, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2241269', 'n_tokens_mistral': 5319, 'n_tokens_neox': 4988, 'n_words': 755}