Просмотр исходного кода

remove trigger, now it's included in Actor

mikymod 12 лет назад
Родитель
Сommit
26251f6273

+ 0 - 2
engine/CMakeLists.txt

@@ -400,7 +400,6 @@ set (PHYSICS_SRC
 	physics/Actor.cpp
 	physics/Controller.cpp
 	physics/PhysicsWorld.cpp
-	physics/Trigger.cpp
 	physics/Joint.cpp
 	physics/Raycast.cpp
 )
@@ -410,7 +409,6 @@ set (PHYSICS_HEADERS
 	physics/Controller.cpp
 	physics/PhysicsTypes.h
 	physics/PhysicsWorld.h
-	physics/Trigger.h
 	physics/Joint.h
 	physics/Raycast.h
 	physics/PhysicsCallback.h

+ 0 - 24
engine/physics/PhysicsWorld.cpp

@@ -31,7 +31,6 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "Quaternion.h"
 #include "SceneGraph.h"
 #include "Controller.h"
-#include "Trigger.h"
 #include "Joint.h"
 #include "PhysicsCallback.h"
 #include "ProxyAllocator.h"
@@ -211,7 +210,6 @@ PhysicsWorld::PhysicsWorld()
 	: m_scene(NULL)
 	, m_actors_pool(default_allocator(), CE_MAX_ACTORS, sizeof(Actor), CE_ALIGNOF(Actor))
 	, m_controllers_pool(default_allocator(), CE_MAX_CONTROLLERS, sizeof(Controller), CE_ALIGNOF(Controller))
-	, m_triggers_pool(default_allocator(), CE_MAX_TRIGGERS, sizeof(Trigger), CE_ALIGNOF(Trigger))
 	, m_joints_pool(default_allocator(), CE_MAX_JOINTS, sizeof(Joint), CE_ALIGNOF(Joint))
 	, m_events(default_allocator())
 	, m_callback(m_events)
@@ -287,22 +285,6 @@ void PhysicsWorld::destroy_controller(ControllerId id)
 	m_controllers.destroy(id);
 }
 
-//-----------------------------------------------------------------------------
-TriggerId PhysicsWorld::create_trigger(const Vector3& half_extents, const Vector3& pos, const Quaternion& rot)
-{
-	Trigger* trigger = CE_NEW(m_triggers_pool, Trigger)(physics_system::s_physics, m_scene, half_extents, pos, rot);
-	return m_triggers.create(trigger);
-}
-
-//-----------------------------------------------------------------------------
-void PhysicsWorld::destroy_trigger(TriggerId id)
-{
-	CE_ASSERT(m_triggers.has(id), "Trigger does not exist");
-
-	CE_DELETE(m_triggers_pool, m_triggers.lookup(id));
-	m_triggers.destroy(id);
-}
-
 //-----------------------------------------------------------------------------
 JointId	PhysicsWorld::create_joint(const PhysicsResource* pr, const uint32_t index, const Actor& actor_0, const Actor& actor_1)
 {
@@ -347,12 +329,6 @@ Controller* PhysicsWorld::lookup_controller(ControllerId id)
 	return m_controllers.lookup(id);
 }
 
-//-----------------------------------------------------------------------------
-Trigger* PhysicsWorld::lookup_trigger(TriggerId id)
-{
-	CE_ASSERT(m_triggers.has(id), "Trigger does not exist");
-	return m_triggers.lookup(id);
-}
 //-----------------------------------------------------------------------------
 Vector3 PhysicsWorld::gravity() const
 {

+ 0 - 7
engine/physics/PhysicsWorld.h

@@ -63,7 +63,6 @@ struct PhysicsActor;
 struct Controller;
 struct Vector3;
 struct Actor;
-struct Trigger;
 struct Joint;
 struct Quaternion;
 class SceneGraph;
@@ -84,16 +83,12 @@ public:
 	ControllerId				create_controller(const PhysicsResource* pr, SceneGraph& sg, int32_t node);
 	void						destroy_controller(ControllerId id);
 
-	TriggerId					create_trigger(const Vector3& half_extents, const Vector3& pos, const Quaternion& rot);
-	void						destroy_trigger(TriggerId id);
-
 	JointId						create_joint(const PhysicsResource* pr, const uint32_t index, const Actor& actor_0, const Actor& actor_1);
 	void						destroy_joint(JointId id);
 
 	Actor*						lookup_actor(StringId32 name);
 	Actor*						lookup_actor(ActorId id);
 	Controller*					lookup_controller(ControllerId id);
-	Trigger*					lookup_trigger(TriggerId id);
 
 	Vector3						gravity() const;
 	void						set_gravity(const Vector3& g);
@@ -113,12 +108,10 @@ public:
 
 	PoolAllocator				m_actors_pool;
 	PoolAllocator				m_controllers_pool;
-	PoolAllocator				m_triggers_pool;
 	PoolAllocator				m_joints_pool;
 
 	IdArray<CE_MAX_ACTORS, Actor*>	m_actors;
 	IdArray<CE_MAX_CONTROLLERS, Controller*> m_controllers;
-	IdArray<CE_MAX_TRIGGERS, Trigger*> m_triggers;
 	IdArray<CE_MAX_JOINTS, Joint*> m_joints;
 
 	// Events management

+ 0 - 80
engine/physics/Trigger.cpp

@@ -1,80 +0,0 @@
-/*
-Copyright (c) 2013 Daniele Bartolini, Michele Rossi
-Copyright (c) 2012 Daniele Bartolini, Simone Boscaratto
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-#include "Matrix4x4.h"
-#include "PxPhysicsAPI.h"
-#include "Quaternion.h"
-#include "Trigger.h"
-#include "Vector3.h"
-
-using physx::PxRigidDynamicFlag;
-using physx::PxMat44;
-using physx::PxTransform;
-using physx::PxActorFlag;
-using physx::PxVec3;
-using physx::PxReal;
-using physx::PxRigidBody;
-using physx::PxRigidDynamic;
-using physx::PxPlaneGeometry;
-using physx::PxSphereGeometry;
-using physx::PxBoxGeometry;
-using physx::PxRigidBodyExt;
-using physx::PxShape;
-using physx::PxShapeFlag;
-
-namespace crown
-{
-	
-//-----------------------------------------------------------------------------
-Trigger::Trigger(PxPhysics* physics, PxScene* scene, const Vector3& half_extents, const Vector3& pos, const Quaternion& rot)
-	: m_scene(scene)
-{
-	Matrix4x4 m(rot, pos);
-	m.transpose();
-	PxMat44 pose((PxReal*)(m.to_float_ptr()));
-
-	m_actor = physics->createRigidStatic(PxTransform(pose));
-	m_actor->userData = NULL;
-
-	m_mat = physics->createMaterial(0.5f, 0.5f, 0.5f);
-	PxShape* shape = m_actor->createShape(PxBoxGeometry(half_extents.x, half_extents.y, half_extents.z), *m_mat);
-	shape->setFlag(PxShapeFlag::eSIMULATION_SHAPE, false);
-	shape->setFlag(PxShapeFlag::eTRIGGER_SHAPE, true);
-
-	m_scene->addActor(*m_actor);
-}
-
-//-----------------------------------------------------------------------------
-Trigger::~Trigger()
-{
-	if (m_actor)
-	{
-		m_scene->removeActor(*m_actor);
-		m_actor->release();
-	}
-}
-
-} // namespace crown

+ 0 - 64
engine/physics/Trigger.h

@@ -1,64 +0,0 @@
-/*
-Copyright (c) 2013 Daniele Bartolini, Michele Rossi
-Copyright (c) 2012 Daniele Bartolini, Simone Boscaratto
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-#pragma once
-
-#include "Types.h"
-#include "PhysicsTypes.h"
-#include "Vector3.h"
-#include "Matrix4x4.h"
-#include "Quaternion.h"
-
-#include "PxPhysics.h"
-#include "PxScene.h"
-#include "PxRigidActor.h"
-
-using physx::PxRigidActor;
-using physx::PxMaterial;
-using physx::PxScene;
-using physx::PxPhysics;
-
-namespace crown
-{
-
-struct Quaternion;
-struct Matrix4x4;
-struct Unit;
-class SceneGraph;
-
-struct Trigger
-{
-						Trigger(PxPhysics* physics, PxScene* scene, const Vector3& half_extents, const Vector3& pos, const Quaternion& rot);
-						~Trigger();
-
-public:
-
-	PxScene*			m_scene;
-	PxRigidActor* 		m_actor;
-	PxMaterial* 		m_mat;
-};
-
-} // namespace crown