Some smaller fixes

This commit is contained in:
Alexander Bock
2019-08-20 10:04:20 +02:00
parent 701afc7daf
commit ed6082aace
12 changed files with 139 additions and 164 deletions

View File

@@ -200,6 +200,7 @@ void Handler::onVREvent(const VRDataIndex& eventData) {
if (button == MouseButton::Right && action == MouseAction::Press) {
windowingGlobals.mouseButtons |= 1 << 2;
}
using KM = KeyModifier;
KM mod = KM::NoModifier;
mod |= keyboardState.modifierShift ? KM::Shift : KM::NoModifier;

View File

@@ -10,11 +10,6 @@ asset.onInitialize(function ()
openspace.globebrowsing.goToGeo("Earth", 58.5877, 16.1924, 20000000)
openspace.markInterestingNodes({ "Earth", "Mars", "Moon", "Sun" })
-- HDR / Image options:
openspace.setPropertyValueSingle('RenderEngine.Gamma', 0.95);
openspace.setPropertyValueSingle('RenderEngine.HDRExposure', 3.7);
openspace.setPropertyValueSingle('RenderEngine.Saturation', 1.0);
end)
asset.onDeinitialize(function ()

View File

@@ -59,65 +59,6 @@ struct UpdateStructures;
class FramebufferRenderer : public Renderer, public RaycasterListener,
public DeferredcasterListener
{
private:
inline static const GLenum ColorAttachment0Array[1] = {
GL_COLOR_ATTACHMENT0
};
inline static const GLenum ColorAttachment1Array[1] = {
GL_COLOR_ATTACHMENT1
};
inline static const GLenum ColorAttachment01Array[2] = {
GL_COLOR_ATTACHMENT0,
GL_COLOR_ATTACHMENT1
};
inline static const GLenum ColorAttachment03Array[2] = {
GL_COLOR_ATTACHMENT0,
GL_COLOR_ATTACHMENT3
};
inline static const GLenum ColorAttachment012Array[3] = {
GL_COLOR_ATTACHMENT0,
GL_COLOR_ATTACHMENT1,
GL_COLOR_ATTACHMENT2
};
inline static const GLenum ColorAttachment0123Array[4] = {
GL_COLOR_ATTACHMENT0,
GL_COLOR_ATTACHMENT1,
GL_COLOR_ATTACHMENT2,
GL_COLOR_ATTACHMENT3
};
typedef struct {
GLuint _colorTexture;
GLuint _positionTexture;
GLuint _normalTexture;
GLuint _depthTexture;
GLuint _framebuffer;
} GBuffers;
typedef struct {
GLuint framebuffer;
GLuint colorTexture[2];
} PingPongBuffers;
typedef struct {
GLuint _hdrFilteringFramebuffer;
GLuint _hdrFilteringTexture;
} HDRBuffers;
public:
typedef std::map<
VolumeRaycaster*,
std::unique_ptr<ghoul::opengl::ProgramObject>
> RaycasterProgObjMap;
typedef std::map<
Deferredcaster*,
std::unique_ptr<ghoul::opengl::ProgramObject>
> DeferredcasterProgObjMap;
public:
virtual ~FramebufferRenderer() = default;
@@ -138,7 +79,7 @@ public:
void setSaturation(float sat) override;
int nAaSamples() const override;
void disableHDR(bool disable) override;
void setDisableHDR(bool disable) override;
void update() override;
void performRaycasterTasks(const std::vector<RaycasterTask>& tasks);
@@ -157,10 +98,18 @@ public:
DeferredcasterListener::IsAttached isAttached) override;
private:
using RaycasterProgObjMap = std::map<
VolumeRaycaster*,
std::unique_ptr<ghoul::opengl::ProgramObject>
>;
using DeferredcasterProgObjMap = std::map<
Deferredcaster*,
std::unique_ptr<ghoul::opengl::ProgramObject>
>;
void resolveMSAA(float blackoutFactor);
void applyTMO(float blackoutFactor);
private:
std::map<VolumeRaycaster*, RaycastData> _raycastData;
RaycasterProgObjMap _exitPrograms;
RaycasterProgObjMap _raycastPrograms;
@@ -176,7 +125,7 @@ private:
UniformCache(mainColorTexture, blackoutFactor, nAaSamples) _uniformCache;
UniformCache(hdrFeedingTexture, blackoutFactor, hdrExposure, gamma,
Hue, Saturation, Value, nAaSamples) _hdrUniformCache;
Hue, Saturation, Value, nAaSamples) _hdrUniformCache;
GLint _defaultFBO;
GLuint _screenQuad;
@@ -185,9 +134,23 @@ private:
GLuint _exitDepthTexture;
GLuint _exitFramebuffer;
GBuffers _gBuffers;
PingPongBuffers _pingPongBuffers;
HDRBuffers _hdrBuffers;
struct {
GLuint colorTexture;
GLuint positionTexture;
GLuint normalTexture;
GLuint depthTexture;
GLuint framebuffer;
} _gBuffers;
struct {
GLuint framebuffer;
GLuint colorTexture[2];
} _pingPongBuffers;
struct {
GLuint _hdrFilteringFramebuffer;
GLuint _hdrFilteringTexture;
} _hdrBuffers;
unsigned int _pingPongIndex = 0u;

View File

@@ -34,8 +34,6 @@
#include <openspace/properties/vector/vec3property.h>
#include <openspace/properties/triggerproperty.h>
#include <ghoul/opengl/ghoul_gl.h>
namespace ghoul {
class Dictionary;
class SharedMemory;

View File

@@ -56,7 +56,7 @@ public:
virtual void setValue(float value) = 0;
virtual void setSaturation(float sat) = 0;
virtual int nAaSamples() const = 0;
virtual void disableHDR(bool disable) = 0;
virtual void setDisableHDR(bool disable) = 0;
/**
* Set raycasting uniforms on the program object, and setup raycasting.

View File

@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *

View File

@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -66,4 +66,4 @@ void main() {
// Gamma Correction
finalColor = vec4(gammaCorrection(hsv2rgb(hsvColor), gamma), color.a);
}
}

View File

@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *

View File

@@ -28,16 +28,16 @@ const float HCY_EPSILON = 1e-7;
// White given by D65
const mat3 RGB2XYZ = mat3(
vec3(0.4124, 0.2126, 0.0193),
vec3(0.3576, 0.7152, 0.1192),
vec3(0.1805, 0.0722, 0.9505)
);
vec3(0.4124, 0.2126, 0.0193),
vec3(0.3576, 0.7152, 0.1192),
vec3(0.1805, 0.0722, 0.9505)
);
const mat3 XYZ2RGB = mat3(
vec3(3.2406, -0.9689, 0.0557),
vec3(-1.5372, 1.8758, -0.2040),
vec3(-0.4986, 0.0415, 1.0570)
);
vec3(3.2406, -0.9689, 0.0557),
vec3(-1.5372, 1.8758, -0.2040),
vec3(-0.4986, 0.0415, 1.0570)
);
// Gamma correction for linear RGB to sRGB
// See wiki: https://en.wikipedia.org/wiki/SRGB#The_sRGB_transfer_function_.28.22gamma.22.29
@@ -45,7 +45,7 @@ const float gammaF(const float u) {
if (u < 0.0031308) {
return 12.92 * u;
} else {
return 1.055 * pow(u, 1.0/2.4) - 0.055;
return 1.055 * pow(u, 1.0 / 2.4) - 0.055;
}
}
@@ -53,7 +53,7 @@ float invgammaF(const float u) {
if (u < 0.04045) {
return u / 12.92;
} else {
return pow((u+0.055)/1.055, 2.4);
return pow((u + 0.055) / 1.055, 2.4);
}
}
@@ -77,9 +77,8 @@ vec3 XYZToSRGB(const vec3 XYZ) {
}
// HSV code taken from http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl.
vec3 rgb2hsv(const vec3 c)
{
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec3 rgb2hsv(const vec3 c) {
const vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
@@ -89,9 +88,8 @@ vec3 rgb2hsv(const vec3 c)
}
// All components are in the range [0…1], including hue.
vec3 hsv2rgb(const vec3 c)
{
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 hsv2rgb(const vec3 c) {
const vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}
@@ -108,16 +106,14 @@ See top of the file for full license terms.
*/
// Converts from pure Hue to linear RGB
vec3 hue2rgb(float hue)
{
vec3 hue2rgb(float hue) {
float R = abs(hue * 6 - 3) - 1;
float G = 2 - abs(hue * 6 - 2);
float B = 2 - abs(hue * 6 - 4);
return clamp(vec3(R,G,B), 0, 1);
}
// Converts a value from linear RGB to HCV (Hue, Chroma, Value)
vec3 rgb2hcv(vec3 rgb)
{
vec3 rgb2hcv(vec3 rgb) {
// Based on work by Sam Hocevar and Emil Persson
vec4 P = (rgb.g < rgb.b) ? vec4(rgb.bg, -1.0, 2.0/3.0) : vec4(rgb.gb, 0.0, -1.0/3.0);
vec4 Q = (rgb.r < P.x) ? vec4(P.xyw, rgb.r) : vec4(rgb.r, P.yzx);
@@ -127,36 +123,34 @@ vec3 rgb2hcv(vec3 rgb)
}
// Converts from HSL to linear RGB
vec3 hsl2rgb(vec3 hsl)
{
vec3 hsl2rgb(vec3 hsl) {
vec3 rgb = hue2rgb(hsl.x);
float C = (1 - abs(2 * hsl.z - 1)) * hsl.y;
return (rgb - 0.5) * C + hsl.z;
}
// Converts from linear rgb to HSL
vec3 rgb2hsl(vec3 rgb)
{
vec3 rgb2hsl(vec3 rgb) {
vec3 HCV = rgb2hcv(rgb);
float L = HCV.z - HCV.y * 0.5;
float S = HCV.y / (1 - abs(L * 2 - 1) + HSL_EPSILON);
return vec3(HCV.x, S, L);
}
vec3 exponentialToneMapping(vec3 color, const float exposure, const float gamma) {
vec3 exponentialToneMapping(vec3 color, float exposure, float gamma) {
color *= exposure;
color.r = color.r < 1.413 ? pow(color.r * 0.38317, 1.0 / gamma) : 1.0 - exp2(-exposure * color.r);
color.g = color.g < 1.413 ? pow(color.g * 0.38317, 1.0 / gamma) : 1.0 - exp2(-exposure * color.g);
color.b = color.b < 1.413 ? pow(color.b * 0.38317, 1.0 / gamma) : 1.0 - exp2(-exposure * color.b);
return color;
}
vec3 toneMappingOperator(vec3 color, const float exposure) {
vec3 toneMappingOperator(vec3 color, float exposure) {
return 1.0 - exp2(-exposure * color);
}
vec3 gammaCorrection(vec3 color, const float gamma) {
vec3 gammaCorrection(vec3 color, float gamma) {
return pow(color, vec3(1.0f / gamma));
}

View File

@@ -65,10 +65,7 @@ namespace {
namespace openspace::interaction {
ghoul::Dictionary
openspace::interaction::NavigationHandler::NavigationState::dictionary() const
{
ghoul::Dictionary NavigationHandler::NavigationState::dictionary() const {
ghoul::Dictionary cameraDict;
cameraDict.setValue(KeyPosition, position);
cameraDict.setValue(KeyAnchor, anchor);
@@ -93,9 +90,7 @@ ghoul::Dictionary
return cameraDict;
}
openspace::interaction::NavigationHandler::NavigationState::NavigationState(
const ghoul::Dictionary& dictionary)
{
NavigationHandler::NavigationState::NavigationState(const ghoul::Dictionary& dictionary) {
const bool hasAnchor = dictionary.hasValue<std::string>(KeyAnchor);
const bool hasPosition = dictionary.hasValue<glm::dvec3>(KeyPosition);
if (!hasAnchor || !hasPosition) {
@@ -129,14 +124,12 @@ openspace::interaction::NavigationHandler::NavigationState::NavigationState(
}
}
openspace::interaction::NavigationHandler::NavigationState::NavigationState(
std::string anchor,
std::string aim,
std::string referenceFrame,
glm::dvec3 position,
std::optional<glm::dvec3> up,
double yaw,
double pitch)
NavigationHandler::NavigationState::NavigationState(std::string anchor, std::string aim,
std::string referenceFrame,
glm::dvec3 position,
std::optional<glm::dvec3> up,
double yaw,
double pitch)
: anchor(std::move(anchor))
, aim(std::move(aim))
, referenceFrame(std::move(referenceFrame))
@@ -332,7 +325,7 @@ void NavigationHandler::keyboardCallback(Key key, KeyModifier modifier, KeyActio
}
NavigationHandler::NavigationState NavigationHandler::navigationState(
const SceneGraphNode& referenceFrame) const
const SceneGraphNode& referenceFrame) const
{
const SceneGraphNode* anchor = _orbitalNavigator.anchorNode();
const SceneGraphNode* aim = _orbitalNavigator.aimNode();
@@ -375,7 +368,7 @@ NavigationHandler::NavigationState NavigationHandler::navigationState(
}
void NavigationHandler::saveNavigationState(const std::string& filepath,
const std::string& referenceFrameIdentifier)
const std::string& referenceFrameIdentifier)
{
const SceneGraphNode* referenceFrame = _orbitalNavigator.followingNodeRotation() ?
_orbitalNavigator.anchorNode() :
@@ -429,9 +422,9 @@ void NavigationHandler::loadNavigationState(const std::string& filepath) {
}
void NavigationHandler::setJoystickAxisMapping(int axis,
JoystickCameraStates::AxisType mapping,
JoystickCameraStates::AxisInvert shouldInvert,
JoystickCameraStates::AxisNormalize shouldNormalize)
JoystickCameraStates::AxisType mapping,
JoystickCameraStates::AxisInvert shouldInvert,
JoystickCameraStates::AxisNormalize shouldNormalize)
{
_orbitalNavigator.joystickStates().setAxisMapping(
axis,
@@ -442,9 +435,9 @@ void NavigationHandler::setJoystickAxisMapping(int axis,
}
void NavigationHandler::setWebsocketAxisMapping(int axis,
WebsocketCameraStates::AxisType mapping,
WebsocketCameraStates::AxisInvert shouldInvert,
WebsocketCameraStates::AxisNormalize shouldNormalize)
WebsocketCameraStates::AxisType mapping,
WebsocketCameraStates::AxisInvert shouldInvert,
WebsocketCameraStates::AxisNormalize shouldNormalize)
{
_orbitalNavigator.websocketStates().setAxisMapping(
axis,
@@ -456,7 +449,7 @@ void NavigationHandler::setWebsocketAxisMapping(int axis,
JoystickCameraStates::AxisInformation
NavigationHandler::joystickAxisMapping(int axis) const
NavigationHandler::joystickAxisMapping(int axis) const
{
return _orbitalNavigator.joystickStates().axisMapping(axis);
}
@@ -470,9 +463,9 @@ float NavigationHandler::joystickAxisDeadzone(int axis) const {
}
void NavigationHandler::bindJoystickButtonCommand(int button, std::string command,
JoystickAction action,
JoystickCameraStates::ButtonCommandRemote remote,
std::string documentation)
JoystickAction action,
JoystickCameraStates::ButtonCommandRemote remote,
std::string documentation)
{
_orbitalNavigator.joystickStates().bindButtonCommand(
button,

View File

@@ -68,6 +68,37 @@ namespace {
constexpr const char* RenderFragmentShaderPath =
"${SHADERS}/framebuffer/renderframebuffer.frag";
const GLenum ColorAttachment0Array[1] = {
GL_COLOR_ATTACHMENT0
};
const GLenum ColorAttachment1Array[1] = {
GL_COLOR_ATTACHMENT1
};
const GLenum ColorAttachment01Array[2] = {
GL_COLOR_ATTACHMENT0,
GL_COLOR_ATTACHMENT1
};
const GLenum ColorAttachment03Array[2] = {
GL_COLOR_ATTACHMENT0,
GL_COLOR_ATTACHMENT3
};
const GLenum ColorAttachment012Array[3] = {
GL_COLOR_ATTACHMENT0,
GL_COLOR_ATTACHMENT1,
GL_COLOR_ATTACHMENT2
};
const GLenum ColorAttachment0123Array[4] = {
GL_COLOR_ATTACHMENT0,
GL_COLOR_ATTACHMENT1,
GL_COLOR_ATTACHMENT2,
GL_COLOR_ATTACHMENT3
};
void saveTextureToMemory(GLenum attachment, int width, int height,
std::vector<double>& memory)
{
@@ -128,15 +159,15 @@ void FramebufferRenderer::initialize() {
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &_defaultFBO);
// GBuffers
glGenTextures(1, &_gBuffers._colorTexture);
glGenTextures(1, &_gBuffers._depthTexture);
glGenTextures(1, &_gBuffers._positionTexture);
glGenTextures(1, &_gBuffers._normalTexture);
glGenFramebuffers(1, &_gBuffers._framebuffer);
glGenTextures(1, &_gBuffers.colorTexture);
glGenTextures(1, &_gBuffers.depthTexture);
glGenTextures(1, &_gBuffers.positionTexture);
glGenTextures(1, &_gBuffers.normalTexture);
glGenFramebuffers(1, &_gBuffers.framebuffer);
// PingPong Buffers
// The first pingpong buffer shares the color texture with the renderbuffer:
_pingPongBuffers.colorTexture[0] = _gBuffers._colorTexture;
_pingPongBuffers.colorTexture[0] = _gBuffers.colorTexture;
glGenTextures(1, &_pingPongBuffers.colorTexture[1]);
glGenFramebuffers(1, &_pingPongBuffers.framebuffer);
@@ -158,33 +189,33 @@ void FramebufferRenderer::initialize() {
//==============================//
//===== GBuffers Buffers =====//
//==============================//
glBindFramebuffer(GL_FRAMEBUFFER, _gBuffers._framebuffer);
glBindFramebuffer(GL_FRAMEBUFFER, _gBuffers.framebuffer);
glFramebufferTexture2D(
GL_FRAMEBUFFER,
GL_COLOR_ATTACHMENT0,
GL_TEXTURE_2D_MULTISAMPLE,
_gBuffers._colorTexture,
_gBuffers.colorTexture,
0
);
glFramebufferTexture2D(
GL_FRAMEBUFFER,
GL_COLOR_ATTACHMENT1,
GL_TEXTURE_2D_MULTISAMPLE,
_gBuffers._positionTexture,
_gBuffers.positionTexture,
0
);
glFramebufferTexture2D(
GL_FRAMEBUFFER,
GL_COLOR_ATTACHMENT2,
GL_TEXTURE_2D_MULTISAMPLE,
_gBuffers._normalTexture,
_gBuffers.normalTexture,
0
);
glFramebufferTexture2D(
GL_FRAMEBUFFER,
GL_DEPTH_ATTACHMENT,
GL_TEXTURE_2D_MULTISAMPLE,
_gBuffers._depthTexture,
_gBuffers.depthTexture,
0
);
@@ -215,7 +246,7 @@ void FramebufferRenderer::initialize() {
GL_FRAMEBUFFER,
GL_DEPTH_ATTACHMENT,
GL_TEXTURE_2D_MULTISAMPLE,
_gBuffers._depthTexture,
_gBuffers.depthTexture,
0
);
@@ -304,17 +335,17 @@ void FramebufferRenderer::initialize() {
void FramebufferRenderer::deinitialize() {
LINFO("Deinitializing FramebufferRenderer");
glDeleteFramebuffers(1, &_gBuffers._framebuffer);
glDeleteFramebuffers(1, &_gBuffers.framebuffer);
glDeleteFramebuffers(1, &_exitFramebuffer);
glDeleteFramebuffers(1, &_hdrBuffers._hdrFilteringFramebuffer);
glDeleteFramebuffers(1, &_pingPongBuffers.framebuffer);
glDeleteTextures(1, &_gBuffers._colorTexture);
glDeleteTextures(1, &_gBuffers._depthTexture);
glDeleteTextures(1, &_gBuffers.colorTexture);
glDeleteTextures(1, &_gBuffers.depthTexture);
glDeleteTextures(1, &_hdrBuffers._hdrFilteringTexture);
glDeleteTextures(1, &_gBuffers._positionTexture);
glDeleteTextures(1, &_gBuffers._normalTexture);
glDeleteTextures(1, &_gBuffers.positionTexture);
glDeleteTextures(1, &_gBuffers.normalTexture);
glDeleteTextures(1, &_pingPongBuffers.colorTexture[1]);
@@ -346,7 +377,7 @@ void FramebufferRenderer::resolveMSAA(float blackoutFactor) {
ghoul::opengl::TextureUnit mainColorTextureUnit;
mainColorTextureUnit.activate();
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, _gBuffers._colorTexture);
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, _gBuffers.colorTexture);
_resolveProgram->setUniform(_uniformCache.mainColorTexture, mainColorTextureUnit);
_resolveProgram->setUniform(_uniformCache.blackoutFactor, blackoutFactor);
_resolveProgram->setUniform(_uniformCache.nAaSamples, _nAaSamples);
@@ -481,7 +512,7 @@ void FramebufferRenderer::update() {
}
void FramebufferRenderer::updateResolution() {
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, _gBuffers._colorTexture);
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, _gBuffers.colorTexture);
glTexImage2DMultisample(
GL_TEXTURE_2D_MULTISAMPLE,
_nAaSamples,
@@ -491,7 +522,7 @@ void FramebufferRenderer::updateResolution() {
GL_TRUE
);
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, _gBuffers._positionTexture);
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, _gBuffers.positionTexture);
glTexImage2DMultisample(
GL_TEXTURE_2D_MULTISAMPLE,
_nAaSamples,
@@ -501,7 +532,7 @@ void FramebufferRenderer::updateResolution() {
GL_TRUE
);
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, _gBuffers._normalTexture);
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, _gBuffers.normalTexture);
glTexImage2DMultisample(
GL_TEXTURE_2D_MULTISAMPLE,
@@ -512,7 +543,7 @@ void FramebufferRenderer::updateResolution() {
GL_TRUE
);
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, _gBuffers._depthTexture);
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, _gBuffers.depthTexture);
glTexImage2DMultisample(
GL_TEXTURE_2D_MULTISAMPLE,
_nAaSamples,
@@ -751,7 +782,7 @@ void FramebufferRenderer::render(Scene* scene, Camera* camera, float blackoutFac
}
// deferred g-buffer
glBindFramebuffer(GL_FRAMEBUFFER, _gBuffers._framebuffer);
glBindFramebuffer(GL_FRAMEBUFFER, _gBuffers.framebuffer);
glDrawBuffers(3, ColorAttachment012Array);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -839,7 +870,7 @@ void FramebufferRenderer::performRaycasterTasks(const std::vector<RaycasterTask>
exitProgram->deactivate();
}
glBindFramebuffer(GL_FRAMEBUFFER, _gBuffers._framebuffer);
glBindFramebuffer(GL_FRAMEBUFFER, _gBuffers.framebuffer);
glm::vec3 cameraPosition;
bool isCameraInside = raycaster->isCameraInside(
raycasterTask.renderData,
@@ -885,7 +916,7 @@ void FramebufferRenderer::performRaycasterTasks(const std::vector<RaycasterTask>
ghoul::opengl::TextureUnit mainDepthTextureUnit;
mainDepthTextureUnit.activate();
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, _gBuffers._depthTexture);
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, _gBuffers.depthTexture);
raycastProgram->setUniform("mainDepthTexture", mainDepthTextureUnit);
raycastProgram->setUniform("nAaSamples", _nAaSamples);
@@ -952,7 +983,7 @@ void FramebufferRenderer::performDeferredTasks(
ghoul::opengl::TextureUnit mainPositionTextureUnit;
mainPositionTextureUnit.activate();
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, _gBuffers._positionTexture);
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, _gBuffers.positionTexture);
deferredcastProgram->setUniform(
"mainPositionTexture",
mainPositionTextureUnit
@@ -960,7 +991,7 @@ void FramebufferRenderer::performDeferredTasks(
ghoul::opengl::TextureUnit mainNormalTextureUnit;
mainNormalTextureUnit.activate();
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, _gBuffers._normalTexture);
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, _gBuffers.normalTexture);
deferredcastProgram->setUniform(
"mainNormalTexture",
mainNormalTextureUnit
@@ -1021,7 +1052,7 @@ void FramebufferRenderer::setNAaSamples(int nAaSamples) {
_dirtyMsaaSamplingPattern = true;
}
void FramebufferRenderer::disableHDR(bool disable) {
void FramebufferRenderer::setDisableHDR(bool disable) {
_disableHDR = std::move(disable);
}

View File

@@ -276,7 +276,7 @@ RenderEngine::RenderEngine()
, _nAaSamples(AaSamplesInfo, 4, 1, 8)
, _disableHDRPipeline(DisableHDRPipelineInfo, false)
, _hdrExposure(HDRExposureInfo, 3.7f, 0.01f, 10.0f)
, _gamma(GammaInfo, 0.86f, 0.01f, 5.0f)
, _gamma(GammaInfo, 0.95f, 0.01f, 5.0f)
, _hue(HueInfo, 180.f, 0.0f, 360.0f)
, _saturation(SaturationInfo, 1.f, 0.0f, 2.0f)
, _value(ValueInfo, 1.f, 0.0f, 2.0f)
@@ -298,7 +298,7 @@ RenderEngine::RenderEngine()
glm::vec3(0.f),
glm::vec3(-glm::pi<float>()),
glm::vec3(glm::pi<float>())
)
)
{
_doPerformanceMeasurements.onChange([this](){
global::performanceManager.setEnabled(_doPerformanceMeasurements);
@@ -319,7 +319,7 @@ RenderEngine::RenderEngine()
_disableHDRPipeline.onChange([this]() {
if (_renderer) {
_renderer->disableHDR(_disableHDRPipeline);
_renderer->setDisableHDR(_disableHDRPipeline);
}
});
addProperty(_disableHDRPipeline);