From 0775c60b388c4e672e4848f7b97d27a7c34d42b5 Mon Sep 17 00:00:00 2001 From: Hugo Willaume Date: Mon, 27 May 2019 15:53:55 +0900 Subject: [PATCH] Fix merge problems --- BaseGLProject/MyGLWindow.cpp | 81 ++++-------------------------------- 1 file changed, 9 insertions(+), 72 deletions(-) diff --git a/BaseGLProject/MyGLWindow.cpp b/BaseGLProject/MyGLWindow.cpp index 65fb7f8..8f69720 100644 --- a/BaseGLProject/MyGLWindow.cpp +++ b/BaseGLProject/MyGLWindow.cpp @@ -150,13 +150,13 @@ void MyGlWindow::multipassSetup() _multipassManager.setDrawBuffers(); - _multipassManager.shader.addSubroutine(GL_FRAGMENT_SHADER, "depthing"); - _multipassManager.shader.addSubroutine(GL_FRAGMENT_SHADER, "blurring"); - _multipassManager.shader.addSubroutine(GL_FRAGMENT_SHADER, "sharpening"); - _multipassManager.shader.addSubroutine(GL_FRAGMENT_SHADER, "sepia"); - _multipassManager.shader.addSubroutine(GL_FRAGMENT_SHADER, "grayscale"); - _multipassManager.shader.addSubroutine(GL_FRAGMENT_SHADER, "sobel_filter"); - _multipassManager.shader.addSubroutine(GL_FRAGMENT_SHADER, "absolutely_no_postprocess"); + _multipassManager.shader->addSubroutine(GL_FRAGMENT_SHADER, "depthing"); + _multipassManager.shader->addSubroutine(GL_FRAGMENT_SHADER, "blurring"); + _multipassManager.shader->addSubroutine(GL_FRAGMENT_SHADER, "sharpening"); + _multipassManager.shader->addSubroutine(GL_FRAGMENT_SHADER, "sepia"); + _multipassManager.shader->addSubroutine(GL_FRAGMENT_SHADER, "grayscale"); + _multipassManager.shader->addSubroutine(GL_FRAGMENT_SHADER, "sobel_filter"); + _multipassManager.shader->addSubroutine(GL_FRAGMENT_SHADER, "absolutely_no_postprocess"); } void MyGlWindow::setup() @@ -196,61 +196,6 @@ void MyGlWindow::setup() meshes[cube_name]->addStartRotation(glm::vec4(0, 0, 1, std::rand() % 360)); } - - //meshes.emplace("Ogre", new Mesh("ogre/ogre.obj", shaders["TexNmapLight"])); - //meshes["Ogre"]->addTranslation(glm::vec4(-0.5, 1, 0, 0)); - //meshes["Ogre"]->assignTexture(_scnctx.textures["OgreTex"]); - //meshes["Ogre"]->assignTexture(_scnctx.textures["OgreNmap"]); - - //meshes.emplace("Cube", new Mesh("cube/cube.obj", shaders["TexNmapLight"])); - //meshes["Cube"]->addTranslation(glm::vec4(0.5, 1, 0, 0)); - //meshes["Cube"]->assignTexture(_scnctx.textures["CubeTex"]); - //meshes["Cube"]->assignTexture(_scnctx.textures["CubeNmap"]); - - //meshes["Buddha"]->addScaling(glm::vec4(4, 4, 4, 0)); - //meshes["Buddha"]->addRotation(glm::vec4(0, 1, 0, 180)); - - //meshes.emplace("Buddha", new Mesh("buddha.obj", shaders["BaseLight"])); - //meshes["Buddha"]->addTranslation(glm::vec4(-4, 3, -4, 0)); - //meshes["Buddha"]->addScaling(glm::vec4(4, 4, 4, 0)); - //meshes["Buddha"]->addRotation(glm::vec4(0, 1, 0, 180)); - - Dataset moddata; - //moddata.simpleCube(); - //meshes.emplace("Cube", new Mesh(moddata, shaders["TexBaseLight"])); - //meshes["Cube"]->assignTexture(_scnctx.textures["BrickTex"]); - //meshes["Cube"]->assignTexture(_scnctx.textures["MossTex"]); - //meshes["Cube"]->addTranslation(glm::vec4(4, 3, -4, 0)); - - //meshes.emplace("Mountain", new Mesh("mountain/mount.blend1.obj", shaders["TexBaseLight"])); - - //meshes.emplace("Sponza", new Mesh("sponza/sponza.obj", shaders["TexBaseLight"])); - //meshes["Sponza"]->addTranslation(glm::vec4(0, -200, 0, 1)); - - - moddata.checkeredFloor(20, 20, glm::vec3(0.1, 0.1, 0.1), glm::vec3(0.7, 0.7, 0.7)); - meshes.emplace("Floor", new Mesh(moddata, shaders["LightPOV"])); - meshes["Floor"]->addTranslation(glm::vec4(0, -0.05, 0, 1)); - meshes["Floor"]->cullMode = BACK; - - //moddata.simpleCube(); - //meshes.emplace("Cube", new Mesh(moddata, shaders["BrickBaseLight"])); - //meshes["Cube"]->addTranslation(glm::vec4(0, 1, 0, 1)); - - //moddata.sphere(1, 100, 100); - //meshes.emplace("Sphere", new Mesh(moddata, shaders["TexBaseLight"])); - //meshes["Sphere"]->assignTexture(_scnctx.textures["EarthTex"]); - //meshes["Sphere"]->addTranslation(glm::vec4(-5, 1, -3, 1)); - - //meshes.emplace("TeapotSilhouette", new Mesh("teapot.obj", shaders["Silhouette"])); - //meshes["TeapotSilhouette"]->addTranslation(glm::vec4(5, 0 ,3, 1)); - //meshes["TeapotSilhouette"]->cullMode = FRONT; - meshes.emplace("Teapot", new Mesh("teapot.obj", shaders["LightPOV"])); - meshes["Teapot"]->addTranslation(glm::vec4(5, 0, 3, 1)); - meshes["Teapot"]->cullMode = BACK; - - //meshes.emplace("Teapot", new Mesh("teapot.obj", shaders["Skybox"])); - } void MyGlWindow::draw() @@ -262,19 +207,11 @@ void MyGlWindow::draw() glm::vec3 look(viewer.getViewCenter().x, viewer.getViewCenter().y, viewer.getViewCenter().z); glm::vec3 up(viewer.getUpVector().x, viewer.getUpVector().y, viewer.getUpVector().z); glm::mat4 view = lookAt(eye, look, up); //Calculate view matrix from parameters of m_viewer - glm::mat4 projection = perspective(45.0f, (float)_scnctx.width / (float)_scnctx.height, 0.1f, 40.0f); + glm::mat4 projection = perspective(45.0f, (float)_scnctx.width / (float)_scnctx.height, 0.1f, 1000.0f); _scnctx.viewMatrix = view; _scnctx.projectionMatrix = projection; - - // Light POV matrixes - glm::mat4 lightMVP = glm::ortho(-25.0f, 25.0f, -25.0f, 25.0f, 0.1f, 40.0f) * - lookAt(glm::vec3(_scnctx.lights["Spotlight1"].location), glm::vec3(0) , glm::vec3(0, 1, 0)) * - glm::mat4(1.0); - - shaders["LightPOV"]->addUniform("lightmvp", lightMVP); - _multipassManager.enableFrameBufferTexture("depth_tex"); glClearColor(_scnctx.bg.r, _scnctx.bg.g, _scnctx.bg.b, _scnctx.bg.a); glViewport(0, 0, _scnctx.width, _scnctx.height); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -283,7 +220,7 @@ void MyGlWindow::draw() for (auto it = meshes.begin(); it != meshes.end(); it++) (*it).second->draw(_scnctx); - _multipassManager.drawResultToScreen(_scnctx); + //_multipassManager.drawResultToScreen(_scnctx); }