Fix merge problems

This commit is contained in:
Hugo Willaume 2019-05-27 15:53:55 +09:00
parent 41798d428a
commit 0775c60b38

View File

@ -150,13 +150,13 @@ void MyGlWindow::multipassSetup()
_multipassManager.setDrawBuffers(); _multipassManager.setDrawBuffers();
_multipassManager.shader.addSubroutine(GL_FRAGMENT_SHADER, "depthing"); _multipassManager.shader->addSubroutine(GL_FRAGMENT_SHADER, "depthing");
_multipassManager.shader.addSubroutine(GL_FRAGMENT_SHADER, "blurring"); _multipassManager.shader->addSubroutine(GL_FRAGMENT_SHADER, "blurring");
_multipassManager.shader.addSubroutine(GL_FRAGMENT_SHADER, "sharpening"); _multipassManager.shader->addSubroutine(GL_FRAGMENT_SHADER, "sharpening");
_multipassManager.shader.addSubroutine(GL_FRAGMENT_SHADER, "sepia"); _multipassManager.shader->addSubroutine(GL_FRAGMENT_SHADER, "sepia");
_multipassManager.shader.addSubroutine(GL_FRAGMENT_SHADER, "grayscale"); _multipassManager.shader->addSubroutine(GL_FRAGMENT_SHADER, "grayscale");
_multipassManager.shader.addSubroutine(GL_FRAGMENT_SHADER, "sobel_filter"); _multipassManager.shader->addSubroutine(GL_FRAGMENT_SHADER, "sobel_filter");
_multipassManager.shader.addSubroutine(GL_FRAGMENT_SHADER, "absolutely_no_postprocess"); _multipassManager.shader->addSubroutine(GL_FRAGMENT_SHADER, "absolutely_no_postprocess");
} }
void MyGlWindow::setup() void MyGlWindow::setup()
@ -196,61 +196,6 @@ void MyGlWindow::setup()
meshes[cube_name]->addStartRotation(glm::vec4(0, 0, 1, std::rand() % 360)); 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() void MyGlWindow::draw()
@ -262,19 +207,11 @@ void MyGlWindow::draw()
glm::vec3 look(viewer.getViewCenter().x, viewer.getViewCenter().y, viewer.getViewCenter().z); 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::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 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.viewMatrix = view;
_scnctx.projectionMatrix = projection; _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); glClearColor(_scnctx.bg.r, _scnctx.bg.g, _scnctx.bg.b, _scnctx.bg.a);
glViewport(0, 0, _scnctx.width, _scnctx.height); glViewport(0, 0, _scnctx.width, _scnctx.height);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 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++) for (auto it = meshes.begin(); it != meshes.end(); it++)
(*it).second->draw(_scnctx); (*it).second->draw(_scnctx);
_multipassManager.drawResultToScreen(_scnctx); //_multipassManager.drawResultToScreen(_scnctx);
} }