Start of a movement system with collisions against AABBs

This commit is contained in:
2016-01-13 17:53:54 +01:00
parent d6ef527f25
commit 71d936f8d1
10 changed files with 179 additions and 18 deletions
@@ -1,3 +1,6 @@
#ifndef CollidableOctreeSystem_h__
#define CollidableOctreeSystem_h__
#include "../Core/System.h"
#include "../Core/Octree.h"
#include "Collision.h"
@@ -16,4 +19,6 @@ public:
private:
Octree* m_Octree;
};
};
#endif
+6
View File
@@ -45,6 +45,12 @@ bool RayVsModel(const Ray& ray,
float& outUCoord,
float& outVCoord);
bool AABBvsTriangles(const AABB& box,
const std::vector<RawModel::Vertex>& modelVertices,
const std::vector<unsigned int>& modelIndices,
const glm::mat4& modelMatrix,
glm::vec3& outResolutionVector);
//Return true if the boxes are intersecting.
bool AABBVsAABB(const AABB& a, const AABB& b);
//Return true if the boxes are intersecting.
+20
View File
@@ -0,0 +1,20 @@
#ifndef EComponentAttached_h__
#define EComponentAttached_h__
#include "EventBroker.h"
#include "World.h"
#include "Entity.h"
#include "ComponentWrapper.h"
namespace Events
{
struct ComponentAttached : Event
{
EntityWrapper Entity;
ComponentWrapper Component;
};
}
#endif
+18
View File
@@ -4,4 +4,22 @@
typedef unsigned int EntityID;
const static unsigned int EntityID_Invalid = -1;
class World;
struct EntityWrapper
{
EntityWrapper(::World* world, EntityID id)
: World(world)
, ID(id)
{ }
::World* World;
EntityID ID;
bool operator==(const EntityWrapper& e)
{
return (this->World == e.World) && (this->ID == e.ID);
}
operator EntityID() { return this->ID; }
};
#endif