Commit ddac3893 authored by Dario Seyb's avatar Dario Seyb

fixed error message

parent b02df7df
......@@ -60,8 +60,8 @@ void BloomPostFX::startup() {
m_events->subscribe<"DrawUI"_sh>([this]() {
ImGui::Begin("Bloom", 0, ImGuiWindowFlags_AlwaysAutoResize);
ImGui::Image((void*)m_extractBuffer->getObjectName(), glm::vec2{ 1280, 720 } *0.2f, { 0, 1 }, { 1, 0 });
ImGui::Image((void*)m_blurBuffer->getObjectName(), glm::vec2{ 1280, 720 } *0.2f, { 0, 1 }, { 1, 0 });
ImGui::Image((void*)m_extractTexture->getObjectName(), glm::vec2{ 1280, 720 } *0.2f, { 0, 1 }, { 1, 0 });
ImGui::Image((void*)m_blurTexture->getObjectName(), glm::vec2{ 1280, 720 } *0.2f, { 0, 1 }, { 1, 0 });
ImGui::End();
});
}
......
......@@ -128,7 +128,7 @@ bool RendererSystem::startup() {
m_blitProgram = ShaderProgramFileManager::the()->get(ShaderProgramCreator("Blit"));
m_passBlitProgram = ShaderProgramFileManager::the()->get(ShaderProgramCreator("PassBlit"));
m_shadowMapProg = ShaderProgramFileManager::the()->get(ShaderProgramCreator("ShadowMap"));
m_txaaProg = ShaderProgramFileManager::the()->get(ShaderProgramCreator("TXAA").fragmentDataLocations(m_primaryCompositingBuffer->getAttachmentLocations()));
m_txaaProg = ShaderProgramFileManager::the()->get(ShaderProgramCreator("TXAA").fragmentDataLocations(m_secondaryCompositingBuffer->getAttachmentLocations()));
m_tfShaderProg = ShaderProgramFileManager::the()->get(ShaderProgramCreator("TerrainTransformFeedback"));
......@@ -263,8 +263,6 @@ void RendererSystem::render(RenderPass& pass, double interp, double totalTime) {
glPatchParameteri(GL_PATCH_VERTICES, 3);
// First pass - render to the transform feedback buffer:
//glEnable(GL_RASTERIZER_DISCARD);
//PrimitiveQuery *q = new PrimitiveQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN);
for (size_t i = 0; i < pass.submittedDrawCallsOpaque.size(); i++) {
......@@ -448,6 +446,7 @@ void RendererSystem::render(RenderPass& pass, double interp, double totalTime) {
m_deferredCombineProgram->setUniform("uLightHasShadow", hasShadow);
m_deferredCombineProgram->setUniform("uLightIsDirectional", light.type == LightType::DIRECTIONAL);
if (light.type == LightType::DIRECTIONAL) {
m_deferredCombineProgram->setUniform("uLightDir", light.dir);
}
......@@ -462,6 +461,7 @@ void RendererSystem::render(RenderPass& pass, double interp, double totalTime) {
m_deferredCombineProgram->setUniform(
"uOneOverShadowTexSize", glm::vec2{ 1.0f / size.x, 1.0f / size.y });
}
glm::vec3 interpolatedLight = light.lastSimulateTransform.pos + (light.thisSimulateTransform.pos - light.lastSimulateTransform.pos) * interp - origPos;
m_deferredCombineProgram->setUniform("uLightPosition", interpolatedLight);
m_deferredCombineProgram->setUniform("uLightColor", light.color);
......@@ -505,6 +505,8 @@ void RendererSystem::render(RenderPass& pass, double interp, double totalTime) {
glDisable(GL_DEPTH_TEST);
glCullFace(GL_BACK);
// TXAA
glDisable(GL_BLEND);
pass.compositingTarget->bind();
......@@ -539,12 +541,26 @@ void RendererSystem::render(RenderPass& pass, double interp, double totalTime) {
pass.compositingTarget = pass.txaaHistory;
pass.txaaHistory = temp;
trans->lastRenderTransform = camTransform;
pass.submittedDrawCallsOpaque.reset();
pass.submittedDrawCallsTransparent.reset();
pass.submittedLights.reset();
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, 0);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, 0);
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, 0);
glActiveTexture(GL_TEXTURE3);
glBindTexture(GL_TEXTURE_2D, 0);
glActiveTexture(GL_TEXTURE4);
glBindTexture(GL_TEXTURE_2D, 0);
glActiveTexture(GL_TEXTURE5);
glBindTexture(GL_TEXTURE_2D, 0);
}
void RendererSystem::frame(double interp, double totalTime) {
......@@ -584,7 +600,7 @@ void RendererSystem::frame(double interp, double totalTime) {
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); // create 2 triangles (defined in shader) with no attributes
openGLCriticalError();
glGetError();
m_lastPostprocessingTime = (double)(SDL_GetPerformanceCounter() - counterStart) * 1000.0 / SDL_GetPerformanceFrequency();
......
......@@ -52,7 +52,7 @@ bool AtmosphereTestScene::startup() {
geom1.vao->setMode(GL_PATCHES);
// Create a material that uses the loaded shader program
Material sunMaterial = { glm::vec4{ 1, 1, 1, 1 }, glm::vec4{ 2, 2, 1, 1 }, checkboardTexture, sunShader, false, RenderQueue::OPAQUE };
Material sunMaterial = { glm::vec4{ 1, 1, 1, 1 }, glm::vec4{ 2, 2, 1, 6 }, checkboardTexture, sunShader, false, RenderQueue::OPAQUE };
// Let's create a placeholder sun
sun = m_sceneGraph->create();
......@@ -69,14 +69,13 @@ bool AtmosphereTestScene::startup() {
// mass radius e a i N w
earth = m_orbitals->addPlanet(sunTransform, "Earth", 0.000002988, 0.009153735632184, 0.016713, 1.000000, 0.0000000, 0.00000, 4.93533, 0);
// create cockpit
auto vaoCockpit = VertexArrayObjectCreator("cockpit.obj").create();
auto cockpitShader = ShaderProgramCreator("PBR")
.attributeLocations(vaoCockpit->getAttributeLocations())
.fragmentDataLocations(m_renderer->getGBufferLocations()).create();
{
// create cockpit
auto vaoCockpit = VertexArrayObjectCreator("cockpit.obj").create();
auto cockpitShader = ShaderProgramCreator("PBR")
.attributeLocations(vaoCockpit->getAttributeLocations())
.fragmentDataLocations(m_renderer->getGBufferLocations()).create();
Material cockpitMaterial{ glm::vec4{0.4, 0.4, 0.4, 1}, glm::vec4{0, 0, 0, 1}, checkboardTexture, cockpitShader, true, RenderQueue::OPAQUE };
Geometry cockpitGeom{ vaoCockpit };
cockpitGeom.vao->setMode(GL_PATCHES);
......
......@@ -251,6 +251,7 @@ void UISystem::renderDrawLists(ImDrawData *drawData) {
glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->TextureId);
glScissor((int)pcmd->ClipRect.x, (int)(fb_height - pcmd->ClipRect.w), (int)(pcmd->ClipRect.z - pcmd->ClipRect.x), (int)(pcmd->ClipRect.w - pcmd->ClipRect.y));
glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer_offset);
glGetError();
}
idx_buffer_offset += pcmd->ElemCount;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment