mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-03 09:20:26 -05:00
Separated filters and cache from HDR.
This commit is contained in:
@@ -93,7 +93,6 @@ private:
|
||||
|
||||
typedef struct {
|
||||
GLuint _colorTexture;
|
||||
GLuint _filterTexture;
|
||||
GLuint _positionTexture;
|
||||
GLuint _normalTexture;
|
||||
GLuint _depthTexture;
|
||||
@@ -105,35 +104,11 @@ private:
|
||||
GLuint colorTexture[2];
|
||||
} PingPongBuffers;
|
||||
|
||||
typedef struct {
|
||||
GLuint _histoVao;
|
||||
GLuint _histoVbo;
|
||||
GLuint _histoTexture;
|
||||
GLuint _histoFramebuffer;
|
||||
} HistoBuffers;
|
||||
|
||||
typedef struct {
|
||||
GLuint _bloomVAO = 0u;
|
||||
GLuint _bloomFilterFBO[3];
|
||||
GLuint _bloomTexture[3];
|
||||
} BloomBuffers;
|
||||
|
||||
typedef struct {
|
||||
GLuint _hdrFilteringFramebuffer;
|
||||
GLuint _hdrFilteringTexture;
|
||||
} HDRBuffers;
|
||||
|
||||
typedef struct {
|
||||
GLuint _computeAveLumFBO;
|
||||
GLuint _computeAveLumTexture;
|
||||
} AverageLumBuffers;
|
||||
|
||||
typedef struct {
|
||||
GLuint _tmoTexture;
|
||||
GLuint _tmoFramebuffer;
|
||||
GLuint _tmoHdrSampler;
|
||||
} MipMappingTMOBuffers;
|
||||
|
||||
public:
|
||||
typedef std::map<
|
||||
VolumeRaycaster*,
|
||||
@@ -153,23 +128,14 @@ public:
|
||||
void updateRaycastData();
|
||||
void updateDeferredcastData();
|
||||
void updateHDRAndFiltering();
|
||||
void updateAveLum();
|
||||
void updateBloomConfig();
|
||||
void updateHistogramConfig();
|
||||
void updateTMOViaMipMappingConfig();
|
||||
void updateMSAASamplingPattern();
|
||||
|
||||
void setResolution(glm::ivec2 res) override;
|
||||
void setNAaSamples(int nAaSamples) override;
|
||||
void setBlurrinessLevel(int level) override;
|
||||
void setHDRExposure(float hdrExposure) override;
|
||||
void setGamma(float gamma) override;
|
||||
void setMaxWhite(float maxWhite) override;
|
||||
void setToneMapOperator(int tmOp) override;
|
||||
void setBloomThreMin(float minV) override;
|
||||
void setBloomThreMax(float maxV) override;
|
||||
void setBloomOrigFactor(float origFactor) override;
|
||||
void setBloomNewFactor(float newFactor) override;
|
||||
void setKey(float key) override;
|
||||
void setYwhite(float white) override;
|
||||
void setTmoSaturation(float sat) override;
|
||||
@@ -179,10 +145,6 @@ public:
|
||||
void setLightness(float lightness) override;
|
||||
void setColorSpace(unsigned int colorspace) override;
|
||||
|
||||
void enableBloom(bool enable) override;
|
||||
void enableAutomaticBloom(bool enable) override;
|
||||
void enableHistogram(bool enable) override;
|
||||
|
||||
int nAaSamples() const override;
|
||||
const std::vector<double>& mSSAPattern() const override;
|
||||
|
||||
@@ -203,16 +165,9 @@ public:
|
||||
DeferredcasterListener::IsAttached isAttached) override;
|
||||
|
||||
private:
|
||||
void captureAndSetOpenGLDefaultState();
|
||||
void resolveMSAA(float blackoutFactor);
|
||||
void applyTMO(float blackoutFactor);
|
||||
|
||||
float computeBufferAveLuminance();
|
||||
float computeBufferAveLuminanceGPU();
|
||||
void applyBloomFilter(bool noDeferredTaskExecuted);
|
||||
void computeImageHistogram();
|
||||
void computeMipMappingFromHDRBuffer(GLuint oglImageBuffer);
|
||||
|
||||
private:
|
||||
std::map<VolumeRaycaster*, RaycastData> _raycastData;
|
||||
RaycasterProgObjMap _exitPrograms;
|
||||
@@ -223,11 +178,6 @@ private:
|
||||
DeferredcasterProgObjMap _deferredcastPrograms;
|
||||
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _hdrFilteringProgram;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _aveLumProgram;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _bloomProgram;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _bloomResolveProgram;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _histoProgram;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _histoApplyProgram;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _tmoProgram;
|
||||
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _resolveProgram;
|
||||
@@ -237,16 +187,7 @@ private:
|
||||
toneMapOperator, aveLum, maxWhite, Hue, Saturation, Value,
|
||||
Lightness, colorSpace, nAaSamples) _hdrUniformCache;
|
||||
|
||||
UniformCache(renderedImage, bloomImage, bloomOrigFactor, bloomNewFactor,
|
||||
numberOfSamples) _bloomUniformCache;
|
||||
|
||||
UniformCache(numberOfSamples, msaaTexture, blurriness)
|
||||
_bloomFilterUniformCache;
|
||||
|
||||
UniformCache(renderedImage, maxWhite, imageWidth, imageHeight) _histoUniformCache;
|
||||
|
||||
UniformCache(hdrSampler, key, Ywhite, sat) _tmoUniformCache;
|
||||
|
||||
GLint _defaultFBO;
|
||||
GLuint _screenQuad;
|
||||
GLuint _vertexPositionBuffer;
|
||||
GLuint _exitColorTexture;
|
||||
@@ -255,12 +196,8 @@ private:
|
||||
|
||||
GBuffers _gBuffers;
|
||||
PingPongBuffers _pingPongBuffers;
|
||||
HistoBuffers _histoBuffers;
|
||||
BloomBuffers _bloomBuffers;
|
||||
HDRBuffers _hdrBuffers;
|
||||
AverageLumBuffers _aLumBuffers;
|
||||
MipMappingTMOBuffers _mMappingTMOBuffers;
|
||||
|
||||
|
||||
unsigned int _pingPongIndex = 0u;
|
||||
|
||||
bool _dirtyDeferredcastData;
|
||||
@@ -270,19 +207,11 @@ private:
|
||||
|
||||
glm::ivec2 _resolution = glm::ivec2(0);
|
||||
int _nAaSamples;
|
||||
int _blurrinessLevel = 1;
|
||||
float _hdrExposure = 3.7f;
|
||||
float _gamma = 0.95f;
|
||||
float _maxWhite = 1.0f;
|
||||
bool _bloomEnabled = false;
|
||||
bool _automaticBloomEnabled = false;
|
||||
float _bloomThresholdMin = 0.5f;
|
||||
float _bloomThresholdMax = 8.1f;
|
||||
float _bloomOrigFactor = 1.0f;
|
||||
float _bloomNewFactor = 1.0f;
|
||||
float _maxWhite = 5.0f;
|
||||
int _toneMapOperator = 8;
|
||||
bool _histogramEnabled = false;
|
||||
int _numberOfBins = 1024; // JCC TODO: Add a parameter control for this.
|
||||
float _tmoKey = 0.18f;
|
||||
float _tmoYwhite = 1e6f;
|
||||
float _tmoSaturation = 1.0f;
|
||||
@@ -296,9 +225,6 @@ private:
|
||||
std::vector<float> _histoPoints;
|
||||
|
||||
ghoul::Dictionary _rendererData;
|
||||
|
||||
// Capture Default OpenSpace GL State
|
||||
RenderEngine::GLDefaultState _osDefaultGLState;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -88,23 +88,6 @@ public:
|
||||
HSL
|
||||
};
|
||||
|
||||
struct GLDefaultState {
|
||||
GLboolean blendEnabled;
|
||||
GLboolean blend0Enabled;
|
||||
GLboolean blend1Enabled;
|
||||
GLboolean blend2Enabled;
|
||||
GLboolean blend3Enabled;
|
||||
GLboolean cullFaceEnabled;
|
||||
GLboolean depthTestEnabled;
|
||||
GLint defaultFBO;
|
||||
GLenum blendEquationRGB;
|
||||
GLenum blendEquationAlpha;
|
||||
GLenum blendDestAlpha;
|
||||
GLenum blendDestRGB;
|
||||
GLenum blendSrcAlpha;
|
||||
GLenum blendSrcRGB;
|
||||
};
|
||||
|
||||
RenderEngine();
|
||||
~RenderEngine();
|
||||
|
||||
@@ -191,9 +174,6 @@ public:
|
||||
*/
|
||||
static scripting::LuaLibrary luaLibrary();
|
||||
|
||||
const RenderEngine::GLDefaultState& glDefaultState() const;
|
||||
void setGLDefaultState(RenderEngine::GLDefaultState glDS);
|
||||
|
||||
glm::ivec2 renderingResolution() const;
|
||||
glm::ivec2 fontResolution() const;
|
||||
|
||||
@@ -216,8 +196,6 @@ private:
|
||||
Camera* _camera = nullptr;
|
||||
Scene* _scene = nullptr;
|
||||
|
||||
GLDefaultState _glDefaultState;
|
||||
|
||||
properties::BoolProperty _doPerformanceMeasurements;
|
||||
|
||||
std::unique_ptr<Renderer> _renderer;
|
||||
@@ -240,15 +218,6 @@ private:
|
||||
properties::FloatProperty _globalBlackOutFactor;
|
||||
properties::IntProperty _nAaSamples;
|
||||
|
||||
properties::PropertyOwner _bloomOwner;
|
||||
properties::BoolProperty _enableBloom;
|
||||
properties::BoolProperty _automaticBloom;
|
||||
properties::IntProperty _bloomBlurrinessLevel;
|
||||
properties::FloatProperty _bloomThreshouldMin;
|
||||
properties::FloatProperty _bloomThreshouldMax;
|
||||
properties::FloatProperty _bloomOrigColorFactor;
|
||||
properties::FloatProperty _bloomNewColorFactor;
|
||||
|
||||
properties::PropertyOwner _tmoOwner;
|
||||
properties::FloatProperty _hdrExposure;
|
||||
properties::FloatProperty _maxWhite;
|
||||
|
||||
@@ -50,15 +50,10 @@ public:
|
||||
|
||||
virtual void setResolution(glm::ivec2 res) = 0;
|
||||
virtual void setNAaSamples(int nAaSamples) = 0;
|
||||
virtual void setBlurrinessLevel(int level) = 0;
|
||||
virtual void setHDRExposure(float hdrExposure) = 0;
|
||||
virtual void setGamma(float gamma) = 0;
|
||||
virtual void setMaxWhite(float maxWhite) = 0;
|
||||
virtual void setToneMapOperator(int tmOp) = 0;
|
||||
virtual void setBloomThreMin(float minV) = 0;
|
||||
virtual void setBloomThreMax(float maxV) = 0;
|
||||
virtual void setBloomOrigFactor(float origFactor) = 0;
|
||||
virtual void setBloomNewFactor(float newFactor) = 0;
|
||||
virtual void setKey(float key) = 0;
|
||||
virtual void setYwhite(float white) = 0;
|
||||
virtual void setTmoSaturation(float sat) = 0;
|
||||
@@ -68,10 +63,6 @@ public:
|
||||
virtual void setLightness(float lightness) = 0;
|
||||
virtual void setColorSpace(unsigned int colorspace) = 0;
|
||||
|
||||
virtual void enableBloom(bool enable) = 0;
|
||||
virtual void enableAutomaticBloom(bool enable) = 0;
|
||||
virtual void enableHistogram(bool enable) = 0;
|
||||
|
||||
virtual int nAaSamples() const = 0;
|
||||
virtual const std::vector<double>& mSSAPattern() const = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user