This commit is contained in:
Lendemor 2016-07-11 20:46:24 +02:00
commit 98646d264d
3 changed files with 6 additions and 32 deletions

View File

@ -2,7 +2,7 @@
#include <input.h>
#include <scene.h>
#include <mesh.h>
#include <guipipeline.h>
#include <deferredpipeline.h>
#include <phongmaterial.h>
#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);

View File

@ -1,7 +1,7 @@
#include "scenetree.h"
#include "resourcemanager.h"
#include <pipeline.h>
#include <guipipeline.h>
#include <deferredpipeline.h>
#include <algorithm>
// Scene
#include <iostream>
@ -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()

View File

@ -8,7 +8,6 @@
#include "resourcemanager.h"
#include <trackballcamera.h>
class SimplePipeline;
class SceneTree;
/**