Browse Source

Delete raycast.*

Daniele Bartolini 10 years ago
parent
commit
fbb60e2f93
2 changed files with 0 additions and 139 deletions
  1. 0 71
      src/physics/raycast.cpp
  2. 0 68
      src/physics/raycast.h

+ 0 - 71
src/physics/raycast.cpp

@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2012-2015 Daniele Bartolini and individual contributors.
- * License: https://github.com/taylor001/crown/blob/master/LICENSE
- */
-
-#include "raycast.h"
-#include "actor.h"
-#include "array.h"
-#include "string_utils.h"
-#include "PxRigidActor.h"
-
-using physx::PxRigidActor;
-
-namespace crown
-{
-
-Raycast::Raycast(PxScene* scene, CollisionMode::Enum mode, CollisionType::Enum type)
-	: m_scene(scene)
-	, m_buffer(m_hits, CE_MAX_RAY_INTERSECTIONS)
-	, m_mode(mode)
-	, m_type(type)
-{
-	switch (m_type)
-	{
-		case CollisionType::BOTH: break;
-		case CollisionType::STATIC: m_fd.flags = PxQueryFlag::eSTATIC; break;
-		case CollisionType::DYNAMIC: m_fd.flags = PxQueryFlag::eDYNAMIC; break;
-	}
-
-	switch (m_mode)
-	{
-		case CollisionMode::CLOSEST: break;
-		case CollisionMode::ANY: m_fd.flags |= PxQueryFlag::eANY_HIT; break;
-		case CollisionMode::ALL: break;
-	}
-}
-
-void Raycast::cast(const Vector3& from, const Vector3& dir, const float length, Array<RaycastHit>& hits)
-{
-	m_scene->raycast(PxVec3(from.x, from.y, from.z), PxVec3(dir.x, dir.y, dir.z), length, m_buffer, PxHitFlags(PxHitFlag::eDEFAULT), m_fd);
-
-	for (uint32_t i = 0; i < m_buffer.getNbAnyHits(); i++)
-	{
-		PxRaycastHit rh = m_buffer.getAnyHit(i);
-
-		RaycastHit hit;
-
-		hit.position.x = rh.position.x;
-		hit.position.y = rh.position.y;
-		hit.position.z = rh.position.z;
-		hit.distance = rh.distance;
-		hit.normal.x = rh.normal.x;
-		hit.normal.y = rh.normal.y;
-		hit.normal.z = rh.normal.z;
-		hit.actor = (Actor*)(rh.actor->userData);
-
-		array::push_back(hits, hit);
-	}
-}
-
-CollisionMode::Enum Raycast::mode() const
-{
-	return m_mode;
-}
-
-CollisionType::Enum Raycast::type() const
-{
-	return m_type;
-}
-
-} // namespace crown

+ 0 - 68
src/physics/raycast.h

@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2012-2015 Daniele Bartolini and individual contributors.
- * License: https://github.com/taylor001/crown/blob/master/LICENSE
- */
-
-#include "math_types.h"
-#include "container_types.h"
-#include "physics_types.h"
-#include "PxQueryFiltering.h"
-#include "PxScene.h"
-#include "PxVec3.h"
-
-using physx::PxQueryFilterData;
-using physx::PxQueryFlag;
-using physx::PxHitFlag;
-using physx::PxHitFlags;
-using physx::PxRaycastHit;
-using physx::PxRaycastBuffer;
-using physx::PxScene;
-using physx::PxVec3;
-
-namespace crown
-{
-
-struct Actor;
-
-///
-/// @ingroup Physics
-struct RaycastHit
-{
-	Vector3 position;
-	float distance;
-	Vector3 normal;
-	Actor* actor;
-};
-
-
-///
-/// @ingroup Physics
-struct Raycast
-{
-	/// Constructor
-	Raycast(PxScene* scene, CollisionMode::Enum mode, CollisionType::Enum type);
-
-	/// Performs a raycast against objects in the scene. The ray is casted from position @a from, has direction @a dir and is long @a length
-	/// If any actor is hit along the ray, @a EventStream is filled according to @a mode previously specified and callback will be called for processing.
-	/// @a CollisionMode::ANY: the callback is called with just true or false depending on whether the ray hit anything or not.
-	/// @a CollisionMode::CLOSEST: the first argument will tell if there was a hit or not, as before.
-	/// If there was a hit, the callback will also be called with the position of the hit, the distance from the origin, the normal of the surface that
-	/// was hit and the actor that was hit.
-	/// @a CollisionMode::ALL: as @a CollisionMode::CLOSEST, with more tuples
-	void					cast(const Vector3& from, const Vector3& dir, const float length, Array<RaycastHit>& hits);
-
-	CollisionMode::Enum 	mode() const;
-
-	CollisionType::Enum 	type() const;
-
-private:
-
-	PxScene* 				m_scene;
-	PxRaycastHit 			m_hits[CE_MAX_RAY_INTERSECTIONS];
-	PxRaycastBuffer			m_buffer;
-	PxQueryFilterData 		m_fd;
-	CollisionMode::Enum		m_mode;
-	CollisionType::Enum		m_type;
-};
-
-} // namespace crown