This commit is contained in:
tleety
2015-10-01 14:24:06 +02:00
10 changed files with 442 additions and 599 deletions
Regular → Executable
+47 -6
View File
@@ -52,6 +52,8 @@
#include "Physics/CRectangleShape.h"
#include "Physics/ESetImpulse.h"
#include "Physics/CWaterVolume.h"
#include "Physics/CParticle.h"
#include "Physics/CParticleEmitter.h"
#include "Game/EGameStart.h"
#include "Sound/EPlaySound.h"
@@ -129,6 +131,8 @@ public:
m_World->ComponentFactory.Register<Components::Template>();
m_World->ComponentFactory.Register<Components::PointLight>();
m_World->ComponentFactory.Register<Components::WaterVolume>();
m_World->ComponentFactory.Register<Components::Particle>();
m_World->ComponentFactory.Register<Components::ParticleEmitter>();
m_World->Initialize();
@@ -165,7 +169,7 @@ public:
pl->Radius = 20.f;
pl->Diffuse = glm::vec3(0.8f, 0.7f, 0.05f);
auto model = m_World->AddComponent<Components::Model>(t_Light);
model->ModelFile = "Core/UnitSphere.obj";
model->ModelFile = "Models/Core/UnitSphere.obj";
m_World->CommitEntity(t_Light);
}
{
@@ -176,7 +180,7 @@ public:
pl->Radius = 15.f;
pl->Diffuse = glm::vec3(0.1f, 0.5f, 0.8f);
auto model = m_World->AddComponent<Components::Model>(t_Light);
model->ModelFile = "Core/UnitSphere.obj";
model->ModelFile = "Models/Core/UnitSphere.obj";
m_World->CommitEntity(t_Light);
}
@@ -188,7 +192,7 @@ public:
transform->Scale = glm::vec3(6.f, 6.f, 10.f);
auto model = m_World->AddComponent<Components::Model>(t_halfPipe);
model->ModelFile = "Models/Test/halfpipe/Halfpipe.obj";
model->Color = glm::vec4(1.f, 1.f, 1.f, 0.3f);
model->Color = glm::vec4(1.f, 0.f, 0.f, 0.3f);
m_World->CommitEntity(t_halfPipe);
}
@@ -203,6 +207,44 @@ public:
m_World->CommitEntity(background);
}
//ParticleTest
// {
// auto Pe = m_World->CreateEntity();
// auto transform = m_World->AddComponent<Components::Transform>(Pe);
// auto particleEmitter= m_World->AddComponent<Components::ParticleEmitter>(Pe);
//
// transform->Position = glm::vec3(0.f, -5.f, -10.f);
// particleEmitter->GravityScale = 0.0f;
// particleEmitter->SpawnRate = 1.0f;
//
// {
// auto Pt = m_World->CreateEntity(Pe);
// auto PtTransform = m_World->AddComponent<Components::Transform>(Pt);
// auto PtSprite = m_World->AddComponent<Components::Sprite>(Pt);
// //auto PtModel = m_World->AddComponent<Components::Model>(Pt);
// auto PtParticle = m_World->AddComponent<Components::Particle>(Pt);
// auto PtTemplate = m_World->AddComponent<Components::Template>(Pt);
//
// PtTransform->Velocity = glm::vec3(1.0f, 0.f, 0.f);
// PtTransform->Position = transform->Position;
// PtSprite->SpriteFile = "Textures/Ball.png";
//
// //PtModel->ModelFile = "Models/Brick/Brick.obj";
// PtParticle->LifeTime = 1000.f;
// PtParticle->Flags = ParticleFlags::Type::powderParticle;
// }
// m_World->CommitEntity(Pe);
// }
// {
// auto Pt = m_World->CreateEntity();
// auto PtTransform = m_World->AddComponent<Components::Transform>(Pt);
// auto PtSprite = m_World->AddComponent<Components::Sprite>(Pt);
//
// PtTransform->Position = glm::vec3(2.f, 0.f, -10.f);
// PtSprite->SpriteFile = "Textures/Ball.png";
// }
//Water test
{
auto t_waterBody = m_World->CreateEntity();
@@ -213,6 +255,7 @@ public:
auto body = m_World->AddComponent<Components::RectangleShape>(t_waterBody);
m_World->CommitEntity(t_waterBody);
}
//TODO: Why does the ball not collide with these bricks?
//BottomBox
{
@@ -360,7 +403,7 @@ public:
// Swap event queues to get fresh input data in the read queue
//m_EventBroker->Swap();
ResourceManager::Update();
//ResourceManager::Update();
if (m_GameIsRunning) {
m_World->Update(dt);
}
@@ -449,7 +492,6 @@ public:
auto spriteComponent = m_World->GetComponent<Components::Sprite>(entity);
if (spriteComponent)
{
std::string normal = spriteComponent->NormalTexture;
std::string spec = spriteComponent->SpecularTexture;
@@ -472,7 +514,6 @@ public:
EnqueueSprite(texturediff, texturenorm, texturespec, modelMatrix, spriteComponent->Color, absoluteTransform.Position.z);
}
}
}
//TODO: Get this out of engine.h
+26 -38
View File
@@ -16,8 +16,8 @@
along with Daydream Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef Renderer_h__
#define Renderer_h__
#ifndef DD_RENDERER_H__
#define DD_RENDERER_H__
#include "Util/Rectangle.h"
#include "Camera.h"
@@ -30,8 +30,6 @@ namespace dd
class Renderer
{
public:
//Render();
GLFWwindow* Window() const { return m_Window; }
Rectangle Resolution() const { return m_Resolution; }
void SetResolution(const Rectangle& resolution) { m_Resolution = resolution; }
@@ -39,8 +37,6 @@ public:
void SetFullscreen(bool fullscreen) { m_Fullscreen = fullscreen; }
bool VSYNC() const { return m_VSYNC; }
void SetVSYNC(bool vsync) { m_VSYNC = vsync; }
//void SetViewport(const Rectangle& viewport) { m_Viewport = viewport; }
//void SetScissor(const Rectangle& scissor) { m_Scissor = scissor; }
const dd::Camera* Camera() const { return m_Camera; }
void SetCamera(const dd::Camera* camera)
{
@@ -50,7 +46,6 @@ public:
m_Camera = camera;
}
}
void Initialize();
void Draw(RenderQueueCollection& rq);
@@ -58,8 +53,6 @@ private:
Rectangle m_Resolution = Rectangle(1280, 720);
bool m_Fullscreen = false;
bool m_VSYNC = false;
//Rectangle m_Viewport;
//Rectangle m_Scissor;
std::unique_ptr<dd::Camera> m_DefaultCamera = nullptr;
const dd::Camera* m_Camera = nullptr;
@@ -67,42 +60,37 @@ private:
std::string m_GLVendor;
GLFWwindow* m_Window = nullptr;
ShaderProgram* m_spDeferred1;
ShaderProgram* m_spDeferred2;
ShaderProgram* m_spDeferred3;
ShaderProgram* m_spForward;
ShaderProgram* m_spScreen;
ShaderProgram* t_m_spWater;
ShaderProgram* t_m_spWater2;
ShaderProgram* m_SpDeferred1;
ShaderProgram* m_SpDeferred2;
ShaderProgram* m_SpDeferred3;
ShaderProgram* m_SpForward;
ShaderProgram* m_SpScreen;
ShaderProgram* m_SpWater;
ShaderProgram* m_SpWater2;
GLuint m_ScreenQuad = 0;
Model* m_UnitSphere = nullptr;
Model* m_UnitQuad = nullptr;
Texture* m_StandardNormal;
Texture* m_StandardSpecular;
Texture* t_m_WhiteSphereTexture;
GLuint m_rbDepthBuffer = 0;
GLuint m_fbDeferred1 = 0;
GLuint m_GDiffuse = 0;
GLuint m_GPosition = 0;
GLuint m_GNormal = 0;
GLuint m_GSpecular = 0;
GLuint m_fbDeferred2 = 0;
GLuint m_tLighting = 0;
GLuint m_fbDeferred3 = 0;
GLuint m_tFinal = 0;
//Water GTexture
GLuint t_m_Gwater = 0;
//Water blur texture
GLuint t_m_BWater;
GLuint t_m_BWater2;
//WAterpass Framebuffer
GLuint t_m_fbWater;
//Waterpass Framebuffer
GLuint t_m_fbWaterBlur;
GLuint t_m_fbWaterBlur2;
Texture* m_WhiteSphereTexture;
GLuint m_RbDepthBuffer = 0; //DepthBuffer Texture
GLuint m_FbDeferred1 = 0; //Framebuffer for first pass
GLuint m_GDiffuse = 0; //Texture for diffuseColors
GLuint m_GPosition = 0; //Texture for positions
GLuint m_GNormal = 0; //Texture for normals
GLuint m_GSpecular = 0; //Texture for specular
GLuint m_FbDeferred2 = 0; //Framebuffer that handles the lighting pass
GLuint m_TLighting = 0; //Texture for the lighting pass
GLuint m_FbDeferred3 = 0; //Frambuffer for handling the last pass.
GLuint m_TFinal = 0; //Final Texture to be printed to screen
GLuint m_Gwater = 0; //Water Color Texture
GLuint m_BWater; //Water blur texture
GLuint m_BWater2; //Water blur texture
GLuint m_FbWater; //Waterpass Framebuffer
GLuint m_FbWaterBlur; //Waterpass Framebuffer
GLuint m_FbWaterBlur2; //Waterpass Framebuffer
GLuint m_CurrentScreenBuffer = 0;
void LoadShaders();