mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-08 04:20:14 -05:00
Some small clean up
This commit is contained in:
@@ -48,8 +48,6 @@
|
|||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
constexpr std::string_view _loggerCat = "RenderableModel";
|
constexpr std::string_view _loggerCat = "RenderableModel";
|
||||||
constexpr std::string_view ProgramName = "ModelProgram";
|
constexpr std::string_view ProgramName = "ModelProgram";
|
||||||
@@ -68,13 +66,10 @@ namespace {
|
|||||||
{ "Color Adding", ColorAddingBlending }
|
{ "Color Adding", ColorAddingBlending }
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr glm::vec4 PosBufferClearVal = { 0.f, 0.f, 0.f, 0.f };
|
const GLenum ColorAttachmentArray[3] = {
|
||||||
|
|
||||||
const GLenum ColorAttachmentArray[4] = {
|
|
||||||
GL_COLOR_ATTACHMENT0,
|
GL_COLOR_ATTACHMENT0,
|
||||||
GL_COLOR_ATTACHMENT1,
|
GL_COLOR_ATTACHMENT1,
|
||||||
GL_COLOR_ATTACHMENT2,
|
GL_COLOR_ATTACHMENT2,
|
||||||
GL_COLOR_ATTACHMENT3
|
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr openspace::properties::Property::PropertyInfo EnableAnimationInfo = {
|
constexpr openspace::properties::Property::PropertyInfo EnableAnimationInfo = {
|
||||||
@@ -645,7 +640,7 @@ void RenderableModel::initializeGL() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (glbinding::Binding::ObjectLabel.isResolved()) {
|
if (glbinding::Binding::ObjectLabel.isResolved()) {
|
||||||
glObjectLabel(GL_FRAMEBUFFER, _framebuffer, -1, "RenderableModel Opacity");
|
glObjectLabel(GL_FRAMEBUFFER, _framebuffer, -1, "RenderableModel Framebuffer");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check status
|
// Check status
|
||||||
@@ -685,7 +680,6 @@ void RenderableModel::updateResolution() {
|
|||||||
glObjectLabel(GL_TEXTURE, _colorTexture, -1, "RenderableModel Color");
|
glObjectLabel(GL_TEXTURE, _colorTexture, -1, "RenderableModel Color");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Position
|
// Position
|
||||||
glBindTexture(GL_TEXTURE_2D, _positionTexture);
|
glBindTexture(GL_TEXTURE_2D, _positionTexture);
|
||||||
glTexImage2D(
|
glTexImage2D(
|
||||||
@@ -891,16 +885,14 @@ void RenderableModel::render(const RenderData& data, RendererTasks&) {
|
|||||||
// Prepare framebuffer
|
// Prepare framebuffer
|
||||||
GLint defaultFBO = ghoul::opengl::FramebufferObject::getActiveObject();
|
GLint defaultFBO = ghoul::opengl::FramebufferObject::getActiveObject();
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, _framebuffer);
|
glBindFramebuffer(GL_FRAMEBUFFER, _framebuffer);
|
||||||
glDrawBuffers(4, ColorAttachmentArray);
|
glDrawBuffers(3, ColorAttachmentArray);
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
glClearBufferfv(GL_COLOR, 1, glm::value_ptr(PosBufferClearVal));
|
glClearBufferfv(GL_COLOR, 1, glm::value_ptr(glm::vec4(0.f, 0.f, 0.f, 0.f)));
|
||||||
|
|
||||||
// Render Pass 1
|
// Render Pass 1
|
||||||
// Render all parts of the model into the new framebuffer without opacity
|
// Render all parts of the model into the new framebuffer without opacity
|
||||||
bool isTransparent = false;
|
|
||||||
const float o = opacity();
|
const float o = opacity();
|
||||||
if (o >= 0.f && o < 1.f) {
|
if (o >= 0.f && o < 1.f) {
|
||||||
isTransparent = true;
|
|
||||||
setRenderBin(Renderable::RenderBin::Overlay);
|
setRenderBin(Renderable::RenderBin::Overlay);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -921,7 +913,6 @@ void RenderableModel::render(const RenderData& data, RendererTasks&) {
|
|||||||
// Render the whole model into the G-buffer with the correct opacity
|
// Render the whole model into the G-buffer with the correct opacity
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, defaultFBO);
|
glBindFramebuffer(GL_FRAMEBUFFER, defaultFBO);
|
||||||
|
|
||||||
|
|
||||||
// Screen-space quad should not be discarded due to depth test,
|
// Screen-space quad should not be discarded due to depth test,
|
||||||
// but we still want to be able to write to the depth buffer -> GL_ALWAYS
|
// but we still want to be able to write to the depth buffer -> GL_ALWAYS
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
|||||||
@@ -40,7 +40,6 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace ghoul::opengl {
|
namespace ghoul::opengl {
|
||||||
class FramebufferObject;
|
|
||||||
class ProgramObject;
|
class ProgramObject;
|
||||||
class Texture;
|
class Texture;
|
||||||
} // namespace ghoul::opengl
|
} // namespace ghoul::opengl
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ Fragment getFragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (opacityBlending) {
|
if (opacityBlending) {
|
||||||
// frag.color.a = opacity * (frag.color.r + frag.color.g + frag.color.b)/3.0;
|
|
||||||
frag.color.a = opacity * max(max(frag.color.r, frag.color.g), frag.color.b);
|
frag.color.a = opacity * max(max(frag.color.r, frag.color.g), frag.color.b);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -30,6 +30,6 @@ layout(location = 1) in vec2 in_st;
|
|||||||
out vec2 vs_st;
|
out vec2 vs_st;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
vs_st = in_st;
|
vs_st = in_st;
|
||||||
gl_Position = vec4(in_position.x, in_position.y, 0.0, 1.0);
|
gl_Position = vec4(in_position.x, in_position.y, 0.0, 1.0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user