Added OpenAL
This commit is contained in:
@@ -1,46 +0,0 @@
|
||||
#include "AABB.h"
|
||||
|
||||
AABB::AABB(glm::vec3 _volumeVector, glm::vec3 _origin)
|
||||
{
|
||||
volumeVector = _volumeVector;
|
||||
origin = _origin;
|
||||
|
||||
CreateBB();
|
||||
}
|
||||
|
||||
void AABB::CreateBB()
|
||||
{
|
||||
// Cube 1x1x1, centered on origin
|
||||
GLfloat vertices[] = {
|
||||
origin.x - 0.5, origin.y - 0.5, origin.z - 0.5, 1.0,
|
||||
origin.x + 0.5, origin.y - 0.5, origin.z - 0.5, 1.0,
|
||||
origin.x + 0.5, origin.y + 0.5, origin.z - 0.5, 1.0,
|
||||
origin.x - 0.5, origin.y + 0.5, origin.z - 0.5, 1.0,
|
||||
origin.x - 0.5, origin.y - 0.5, origin.z + 0.5, 1.0,
|
||||
origin.x + 0.5, origin.y - 0.5, origin.z + 0.5, 1.0,
|
||||
origin.x + 0.5, origin.y + 0.5, origin.z + 0.5, 1.0,
|
||||
origin.x - 0.5, origin.y + 0.5, origin.z + 0.5, 1.0,
|
||||
};
|
||||
GLuint vbo_vertices;
|
||||
glGenBuffers(1, &vbo_vertices);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_vertices);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
GLushort elements[] = {
|
||||
0, 1, 2, 3,
|
||||
4, 5, 6, 7,
|
||||
0, 4, 1, 5,
|
||||
2, 6, 3, 7
|
||||
};
|
||||
GLuint ibo_elements;
|
||||
glGenBuffers(1, &ibo_elements);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo_elements);
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(elements), elements, GL_STATIC_DRAW);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
|
||||
glm::vec3 size = glm::vec3(glm::abs(origin.x-volumeVector.x), glm::abs(origin.y-volumeVector.y), glm::abs(origin.z-volumeVector.z));
|
||||
glm::mat4 transform = glm::translate(glm::mat4(1), origin) * glm::scale(glm::mat4(1), size);
|
||||
|
||||
for (int i = 0; i < )
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
#ifndef AABB_h__
|
||||
#define AABB_h__
|
||||
|
||||
#include <GL/glew.h>
|
||||
//#define GLFW_INCLUDE_GLU
|
||||
//#include <GLFW/glfw3.h>
|
||||
//#include <glext.h>
|
||||
#include <glm/common.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
|
||||
class AABB
|
||||
{
|
||||
public:
|
||||
AABB(glm::vec3, glm::vec3);
|
||||
void CreateBB(void);
|
||||
|
||||
|
||||
private:
|
||||
glm::vec3 origin;
|
||||
glm::vec3 volumeVector; //The vector that defines the volume of the BB, it goes from one corner to the opposite one
|
||||
|
||||
};
|
||||
#endif // !AABB_h__
|
||||
@@ -2,14 +2,17 @@
|
||||
#define Bounds_h__
|
||||
|
||||
#include "Component.h"
|
||||
#include "AABB.h"
|
||||
#include <glm/common.hpp>
|
||||
|
||||
|
||||
namespace Components
|
||||
{
|
||||
|
||||
struct Bounds : Component
|
||||
{
|
||||
AABB BB; //Axis Aligned Bounding Box
|
||||
//Axis Aligned Bounding Box
|
||||
glm::vec3 origin;
|
||||
glm::vec3 volumeVector; //The vector that defines the volume of the BB, it goes from one corner to the opposite one
|
||||
};
|
||||
REGISTER_COMPONENT("Bounds", Bounds);
|
||||
|
||||
|
||||
@@ -98,7 +98,6 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Engine.h" />
|
||||
<ClCompile Include="AABB.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
<ClCompile Include="Model.cpp" />
|
||||
<ClCompile Include="Renderer\Renderer.cpp" />
|
||||
@@ -112,7 +111,6 @@
|
||||
<ClCompile Include="Systems\SoundsSystem.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="AABB.h" />
|
||||
<ClInclude Include="Color.h" />
|
||||
<ClInclude Include="Component.h" />
|
||||
<ClInclude Include="ComponentFactory.h" />
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
</ClCompile>
|
||||
<ClCompile Include="Model.cpp" />
|
||||
<ClCompile Include="Engine.h" />
|
||||
<ClCompile Include="AABB.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Component.h" />
|
||||
@@ -103,7 +102,6 @@
|
||||
<ClInclude Include="Components\SoundEmitter.h">
|
||||
<Filter>Components</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="AABB.h" />
|
||||
<ClInclude Include="Color.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user