From ed638825bf58585b7a82947553f52b5fb81b5725 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anselme=20FRAN=C3=87OIS?= Date: Mon, 11 Jul 2016 20:21:36 +0200 Subject: [PATCH] changed guipipeline for deferredpipeline --- src/main.cpp | 30 ++---------------------------- src/scenetree.cpp | 7 ++++--- src/scenetree.h | 1 - 3 files changed, 6 insertions(+), 32 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 8e4fdb4..eb63389 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include #include "resourcemanager.h" #include "sparrowrenderer.h" @@ -22,45 +22,19 @@ int main(){ engine.createWindow("test"); SceneTree scene; -/* // creating a 2D mesh Mesh* mesh = new Mesh(); mesh->addRectangle2D(50,50,100,100); - // first triangle - mesh->addVertex(glm::vec2(50, 50), glm::vec2(0, 0)); // 2D position and then texture coordinates - mesh->addVertex(glm::vec2(50, 150), glm::vec2(0, 1)); - mesh->addVertex(glm::vec2(150, 50), glm::vec2(1, 0)); - // second triangle - mesh->addVertex(glm::vec2(150, 50), glm::vec2(1, 0)); - mesh->addVertex(glm::vec2(50, 150), glm::vec2(1, 0)); - mesh->addVertex(glm::vec2(150, 150), glm::vec2(1, 1)); - // in the case you don't want to worry about if you defined the triangles in the right order, - // you can call this : mesh->setIsDoubleSided(true); - - - // creating the material PhongMaterial *mat = new PhongMaterial(); - // setting an arbitrary color to the square : (orange) mat->diffuse = glm::vec3(1, 0.5, 0); - // you can set a color texture by calling : - // mat->setTexture(PhongMaterial::DIFFUSE_SLOT, myTexture, "my texture name"); - // or - // mat->texture[PhongMaterial::DIFFUSE_SLOT] = myTexture; - - // don't forget to tell the mesh you want to use this material mesh->setMaterial(mat); - // uploads the mesh to GPU memory mesh->initGL(); - // creating the scene node - MeshNode *node = new MeshNode(mesh); - scene.addObject(scene.getRootObject(), node); -*/ SparrowShell *shell = new SparrowShell(engine.getWindow(),engine.getInput()); scene.addObject(scene.getRootObject(),shell); // the pipeline needs to updates his shaders because the scene changed // this should be handled somewhere else in the future - GuiPipeline* pipeline = (GuiPipeline*)scene.getPipeline(); + DeferredPipeline* pipeline = (DeferredPipeline*)scene.getPipeline(); pipeline->refreshScene(&scene); engine.setScene(&scene); diff --git a/src/scenetree.cpp b/src/scenetree.cpp index e3eae12..66f6533 100644 --- a/src/scenetree.cpp +++ b/src/scenetree.cpp @@ -1,7 +1,7 @@ #include "scenetree.h" #include "resourcemanager.h" #include -#include +#include #include // Scene #include @@ -10,8 +10,9 @@ SceneTree::SceneTree() : Scene(), m_skybox(NULL) { - m_pipeline = new GuiPipeline(); - //m_pipeline->setClearColor(glm::vec3(0.1f, 0.4f, 0.25f)); + DeferredPipeline *pipeline = new DeferredPipeline(); + m_pipeline = pipeline; + pipeline->setRenderTarget(FrameBuffer::screen); } SceneTree::~SceneTree() diff --git a/src/scenetree.h b/src/scenetree.h index 1d6ff26..b286c8c 100644 --- a/src/scenetree.h +++ b/src/scenetree.h @@ -8,7 +8,6 @@ #include "resourcemanager.h" #include -class SimplePipeline; class SceneTree; /**