diff --git a/Escape-the-Dawn/AABB.cpp b/Escape-the-Dawn/AABB.cpp new file mode 100644 index 0000000..72022a6 --- /dev/null +++ b/Escape-the-Dawn/AABB.cpp @@ -0,0 +1,46 @@ +#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 < ) +} \ No newline at end of file diff --git a/Escape-the-Dawn/AABB.h b/Escape-the-Dawn/AABB.h new file mode 100644 index 0000000..c56d5c0 --- /dev/null +++ b/Escape-the-Dawn/AABB.h @@ -0,0 +1,23 @@ +#ifndef AABB_h__ +#define AABB_h__ + +#include +//#define GLFW_INCLUDE_GLU +//#include +//#include +#include +#include + +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__ diff --git a/Escape-the-Dawn/Color.h b/Escape-the-Dawn/Color.h new file mode 100644 index 0000000..015b1bc --- /dev/null +++ b/Escape-the-Dawn/Color.h @@ -0,0 +1,10 @@ +#ifndef Color_h__ +#define Color_h__ + +struct Color +{ + float r; + float g; + float b; +}; +#endif // !Color_h__ diff --git a/Escape-the-Dawn/Components/Bounds.h b/Escape-the-Dawn/Components/Bounds.h new file mode 100644 index 0000000..da97403 --- /dev/null +++ b/Escape-the-Dawn/Components/Bounds.h @@ -0,0 +1,17 @@ +#ifndef Bounds_h__ +#define Bounds_h__ + +#include "Component.h" +#include "AABB.h" + +namespace Components +{ + + struct Bounds : Component + { + AABB BB; //Axis Aligned Bounding Box + }; + REGISTER_COMPONENT("Bounds", Bounds); + +} +#endif // !Bounds_h__ \ No newline at end of file diff --git a/Escape-the-Dawn/Components/Camera.h b/Escape-the-Dawn/Components/Camera.h new file mode 100644 index 0000000..44226e8 --- /dev/null +++ b/Escape-the-Dawn/Components/Camera.h @@ -0,0 +1,18 @@ +#ifndef Camera_h__ +#define Camera_h__ + +#include "Component.h" + +namespace Components +{ + + struct Camera : Component + { + int FOV; + int NearClip; + int FarClip; + }; + REGISTER_COMPONENT("Camera", Camera); + +} +#endif // !Camera_h__ \ No newline at end of file diff --git a/Escape-the-Dawn/Components/Collision.h b/Escape-the-Dawn/Components/Collision.h new file mode 100644 index 0000000..d471d1c --- /dev/null +++ b/Escape-the-Dawn/Components/Collision.h @@ -0,0 +1,18 @@ +#ifndef Collision_h__ +#define Collision_h__ + +#include "Component.h" +#include + +namespace Components +{ + + struct Collision : Component + { + bool Phantom; + std::vector CollidingEntities; + }; + REGISTER_COMPONENT("Collision", Collision); + +} +#endif // !Collision_h__ \ No newline at end of file diff --git a/Escape-the-Dawn/Components/DirectionalLight.h b/Escape-the-Dawn/Components/DirectionalLight.h new file mode 100644 index 0000000..17c578d --- /dev/null +++ b/Escape-the-Dawn/Components/DirectionalLight.h @@ -0,0 +1,20 @@ +#ifndef DirectionalLight_h__ +#define DirectionalLight_h__ + +#include "Component.h" +#include "Color.h" + +namespace Components +{ + + struct DirectionalLight : Component + { + float Intensity; + float MaxRange; + float SpecularIntensity; + Color color; + }; + REGISTER_COMPONENT("DirectionalLight", DirectionalLight); + +} +#endif // !DirectionalLight_h__ \ No newline at end of file diff --git a/Escape-the-Dawn/Components/Input.h b/Escape-the-Dawn/Components/Input.h new file mode 100644 index 0000000..9d0c346 --- /dev/null +++ b/Escape-the-Dawn/Components/Input.h @@ -0,0 +1,19 @@ +#ifndef Input_h__ +#define Input_h__ + +#include "Component.h" +#include + +namespace Components +{ + + struct Input : Component + { + int KeyState[GLFW_KEY_LAST]; + float MouseState[2]; + float dX, dY; + }; + REGISTER_COMPONENT("Input", Input); + +} +#endif // !Input_h__ \ No newline at end of file diff --git a/Escape-the-Dawn/Components/Model.h b/Escape-the-Dawn/Components/Model.h new file mode 100644 index 0000000..37dbdf0 --- /dev/null +++ b/Escape-the-Dawn/Components/Model.h @@ -0,0 +1,18 @@ +#ifndef Model_h__ +#define Model_h__ + +#include "Component.h" +#include "Color.h" + +namespace Components +{ + + struct Model : Component + { + std::string ModelName; + Color color; + }; + REGISTER_COMPONENT("Model", Model); + +} +#endif // !Model_h__ \ No newline at end of file diff --git a/Escape-the-Dawn/Components/ParticleEmitter.h b/Escape-the-Dawn/Components/ParticleEmitter.h new file mode 100644 index 0000000..5850f24 --- /dev/null +++ b/Escape-the-Dawn/Components/ParticleEmitter.h @@ -0,0 +1,26 @@ +#ifndef ParticleEmitter_h__ +#define ParticleEmitter_h__ + +#include "Component.h" +#include "Color.h" +#include + +namespace Components +{ + + struct ParticleEmitter : Component + { + int ParticleTemplate; + float SpawnFrequency; + int SpawnCount; + std::vector ColorSpectrum; + std::vector ScaleSpectrum; + float SpreadAngle; + float LifeTime; + std::vector VelocitySpectrum; + std::vector AngularVelocitySpectrum; + }; + REGISTER_COMPONENT("ParticleEmitter", ParticleEmitter); + +} +#endif // !ParticleEmitter_h__ \ No newline at end of file diff --git a/Escape-the-Dawn/Components/PointLight.h b/Escape-the-Dawn/Components/PointLight.h new file mode 100644 index 0000000..70ec5ac --- /dev/null +++ b/Escape-the-Dawn/Components/PointLight.h @@ -0,0 +1,20 @@ +#ifndef PointLight_h__ +#define PointLight_h__ + +#include "Component.h" +#include "Color.h" + +namespace Components +{ + + struct PointLight : Component + { + float Intensity; + float MaxRange; + float SpecularIntensity; + Color color; + }; + REGISTER_COMPONENT("PointLight", PointLight); + +} +#endif // !PointLight_h__ \ No newline at end of file diff --git a/Escape-the-Dawn/Components/PowerUp.h b/Escape-the-Dawn/Components/PowerUp.h new file mode 100644 index 0000000..012b85c --- /dev/null +++ b/Escape-the-Dawn/Components/PowerUp.h @@ -0,0 +1,16 @@ +#ifndef PowerUp_h__ +#define PowerUp_h__ + +#include "Component.h" + +namespace Components +{ + + struct PowerUp : Component + { + int Speed; + }; + REGISTER_COMPONENT("PowerUp", PowerUp); + +} +#endif // !PowerUp_h__ \ No newline at end of file diff --git a/Escape-the-Dawn/Components/SoundEmitter.h b/Escape-the-Dawn/Components/SoundEmitter.h new file mode 100644 index 0000000..6409ab1 --- /dev/null +++ b/Escape-the-Dawn/Components/SoundEmitter.h @@ -0,0 +1,18 @@ +#ifndef SoundEmitter_h__ +#define SoundEmitter_h__ + +#include "Component.h" + +namespace Components +{ + + struct SoundEmitter : Component + { + std::string SoundFile; + float Volume; + float MaxRange; + }; + REGISTER_COMPONENT("SoundEmitter", SoundEmitter); + +} +#endif // !SoundEmitter_h__ \ No newline at end of file diff --git a/Escape-the-Dawn/Components/Sprite.h b/Escape-the-Dawn/Components/Sprite.h new file mode 100644 index 0000000..a64a3f1 --- /dev/null +++ b/Escape-the-Dawn/Components/Sprite.h @@ -0,0 +1,18 @@ +#ifndef Sprite_h__ +#define Sprite_h__ + +#include "Component.h" +#include "Color.h" + +namespace Components +{ + + struct Sprite : Component + { + std::string SpriteFile; + Color color; + }; + REGISTER_COMPONENT("Sprite", Sprite); + +} +#endif // !Sprite_h__ \ No newline at end of file diff --git a/Escape-the-Dawn/Components/Stat.h b/Escape-the-Dawn/Components/Stat.h new file mode 100644 index 0000000..618adb7 --- /dev/null +++ b/Escape-the-Dawn/Components/Stat.h @@ -0,0 +1,17 @@ +#ifndef Stat_h__ +#define Stat_h__ + +#include "Component.h" + +namespace Components +{ + + struct Stat : Component + { + int Health; + bool Destroyable; + }; + REGISTER_COMPONENT("Stat", Stat); + +} +#endif // !Stat_h__ \ No newline at end of file diff --git a/Escape-the-Dawn/Components/Template.h b/Escape-the-Dawn/Components/Template.h new file mode 100644 index 0000000..465187e --- /dev/null +++ b/Escape-the-Dawn/Components/Template.h @@ -0,0 +1,13 @@ +#ifndef Template_h__ +#define Template_h__ + +#include "Component.h" + +namespace Components +{ + + struct Template : Component { }; + REGISTER_COMPONENT("Template", Template); + +} +#endif // !Template_h__ \ No newline at end of file diff --git a/Escape-the-Dawn/Components/Transform.h b/Escape-the-Dawn/Components/Transform.h index a194e85..66cdb17 100644 --- a/Escape-the-Dawn/Components/Transform.h +++ b/Escape-the-Dawn/Components/Transform.h @@ -2,16 +2,18 @@ #define Transform_h__ #include "Component.h" +#include namespace Components { -struct Transform : Component -{ - float Position[3]; -}; -REGISTER_COMPONENT("Transform", Transform); + struct Transform : Component + { + float Position[3]; + glm::fquat qtrn; //Quaternion with floats + float Velocity[3]; + }; + REGISTER_COMPONENT("Transform", Transform); } - #endif // Transform_h__ diff --git a/Escape-the-Dawn/Escape-the-Dawn.vcxproj b/Escape-the-Dawn/Escape-the-Dawn.vcxproj index df41510..246db81 100644 --- a/Escape-the-Dawn/Escape-the-Dawn.vcxproj +++ b/Escape-the-Dawn/Escape-the-Dawn.vcxproj @@ -88,6 +88,7 @@ + @@ -101,8 +102,23 @@ + + + + + + + + + + + + + + + diff --git a/Escape-the-Dawn/Escape-the-Dawn.vcxproj.filters b/Escape-the-Dawn/Escape-the-Dawn.vcxproj.filters index 3fdf496..48d76c2 100644 --- a/Escape-the-Dawn/Escape-the-Dawn.vcxproj.filters +++ b/Escape-the-Dawn/Escape-the-Dawn.vcxproj.filters @@ -25,9 +25,8 @@ Systems - - Source Files - + + @@ -62,9 +61,48 @@ Components - - Header Files + + + Components + + Components + + + Components + + + Components + + + Components + + + Components + + + Components + + + Components + + + Components + + + Components + + + Components + + + Components + + + Components + + + diff --git a/Escape-the-Dawn/Header.h b/Escape-the-Dawn/Header.h new file mode 100644 index 0000000..bb30b65 --- /dev/null +++ b/Escape-the-Dawn/Header.h @@ -0,0 +1,17 @@ +#ifndef Transform_h__ +#define Transform_h__ + +#include "Component.h" + +namespace Components +{ + + struct Transform : Component + { + float Position[3]; + }; + REGISTER_COMPONENT("Transform", Transform); + +} + +#endif // Transform_h__ \ No newline at end of file diff --git a/Escape-the-Dawn/Source.cpp b/Escape-the-Dawn/Source.cpp new file mode 100644 index 0000000..e69de29