mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
Remove nonfunctioning ABufferRenderer from RenderEngine
This commit is contained in:
@@ -1,183 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2021 *
|
||||
* *
|
||||
* 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 *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___ABUFFERRENDERER___H__
|
||||
#define __OPENSPACE_CORE___ABUFFERRENDERER___H__
|
||||
|
||||
#ifdef OPENSPACE_WITH_ABUFFER_RENDERER
|
||||
|
||||
#include <openspace/rendering/renderer.h>
|
||||
#include <openspace/rendering/raycasterlistener.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
#include <ghoul/misc/dictionary.h>
|
||||
#include <ghoul/opengl/ghoul_gl.h>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace ghoul::filesystem { class File; }
|
||||
|
||||
namespace ghoul::opengl {
|
||||
class ProgramObject;
|
||||
class Texture;
|
||||
} // namespace ghoul::opengl
|
||||
|
||||
namespace openspace {
|
||||
|
||||
struct RaycasterTask;
|
||||
class RenderableVolume;
|
||||
class Camera;
|
||||
class Scene;
|
||||
struct RaycastData;
|
||||
|
||||
class ABufferRenderer : public Renderer, public RaycasterListener {
|
||||
public:
|
||||
virtual ~ABufferRenderer() = default;
|
||||
|
||||
void initialize() override;
|
||||
void deinitialize() override;
|
||||
|
||||
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;
|
||||
void setHue(float hue) override;
|
||||
void setValue(float value) override;
|
||||
void setSaturation(float sat) override;
|
||||
void setLightness(float lightness) override;
|
||||
void setColorSpace(unsigned int colorspace) override;
|
||||
|
||||
void enableBloom(bool enable) override;
|
||||
void enableHistogram(bool enable) override;
|
||||
|
||||
int nAaSamples() const override;
|
||||
const std::vector<double>& mSSAPattern() const override;
|
||||
|
||||
using Renderer::preRaycast;
|
||||
void preRaycast(const RaycasterTask& raycasterTask);
|
||||
using Renderer::postRaycast;
|
||||
void postRaycast(const RaycasterTask& raycasterTask);
|
||||
|
||||
void update() override;
|
||||
void render(Scene* scene, Camera* camera, float blackoutFactor) override;
|
||||
|
||||
/**
|
||||
* Update render data
|
||||
* Responsible for calling renderEngine::setRenderData
|
||||
*/
|
||||
virtual void updateRendererData() override;
|
||||
virtual void raycastersChanged(VolumeRaycaster& raycaster,
|
||||
IsAttached attached) override;
|
||||
|
||||
private:
|
||||
void clear();
|
||||
void updateResolution();
|
||||
void updateRaycastData();
|
||||
void updateResolveDictionary();
|
||||
void updateMSAASamplingPattern();
|
||||
void saveTextureToMemory(GLenum color_buffer_attachment, int width, int height,
|
||||
std::vector<double> & memory) const;
|
||||
|
||||
glm::ivec2 _resolution = glm::ivec2(0);
|
||||
|
||||
bool _dirtyResolution = true;
|
||||
bool _dirtyRendererData = true;
|
||||
bool _dirtyRaycastData = true;
|
||||
bool _dirtyResolveDictionary = true;
|
||||
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _resolveProgram = nullptr;
|
||||
|
||||
/**
|
||||
* When a volume is attached or detached from the scene graph,
|
||||
* the resolve program needs to be recompiled.
|
||||
* The _volumes map keeps track of which volumes that can
|
||||
* be rendered using the current resolve program, along with their raycast data
|
||||
* (id, namespace, etc)
|
||||
*/
|
||||
std::map<VolumeRaycaster*, RaycastData> _raycastData;
|
||||
std::map<
|
||||
VolumeRaycaster*, std::unique_ptr<ghoul::opengl::ProgramObject>
|
||||
> _boundsPrograms;
|
||||
std::vector<std::string> _helperPaths;
|
||||
|
||||
ghoul::Dictionary _resolveDictionary;
|
||||
|
||||
GLuint _mainColorTexture;
|
||||
GLuint _mainDepthTexture;
|
||||
|
||||
GLuint _mainFramebuffer;
|
||||
GLuint _screenQuad;
|
||||
GLuint _anchorPointerTexture;
|
||||
GLuint _anchorPointerTextureInitializer;
|
||||
GLuint _atomicCounterBuffer;
|
||||
GLuint _fragmentBuffer;
|
||||
GLuint _fragmentTexture;
|
||||
GLuint _vertexPositionBuffer;
|
||||
int _nAaSamples;
|
||||
int _blurrinessLevel = 1;
|
||||
|
||||
float _hdrExposure = 0.4f;
|
||||
float _hdrBackground = 2.8f;
|
||||
float _gamma = 2.2f;
|
||||
float _maxWhite = 1.f;
|
||||
float _blackoutFactor;
|
||||
bool _bloomEnabled = false;
|
||||
float _bloomThresholdMin = 0.0;
|
||||
float _bloomThresholdMax = 1.0;
|
||||
float _bloomOrigFactor = 1.0;
|
||||
float _bloomNewFactor = 1.0;
|
||||
int _toneMapOperator = 0;
|
||||
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;
|
||||
float _hue = 1.f;
|
||||
float _saturation = 1.f;
|
||||
float _value = 1.f;
|
||||
float _lightness = 1.f;
|
||||
unsigned int _colorSpace = 1;
|
||||
|
||||
std::vector<double> _mSAAPattern;
|
||||
|
||||
ghoul::Dictionary _rendererData;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // OPENSPACE_WITH_ABUFFER_RENDERER
|
||||
|
||||
#endif // __OPENSPACE_CORE___ABUFFERRENDERER___H__
|
||||
@@ -25,8 +25,6 @@
|
||||
#ifndef __OPENSPACE_CORE___FRAMEBUFFERRENDERER___H__
|
||||
#define __OPENSPACE_CORE___FRAMEBUFFERRENDERER___H__
|
||||
|
||||
#include <openspace/rendering/renderer.h>
|
||||
#include <openspace/rendering/renderengine.h>
|
||||
#include <openspace/rendering/raycasterlistener.h>
|
||||
#include <openspace/rendering/deferredcasterlistener.h>
|
||||
|
||||
@@ -56,14 +54,14 @@ struct RaycasterTask;
|
||||
class Scene;
|
||||
struct UpdateStructures;
|
||||
|
||||
class FramebufferRenderer : public Renderer, public RaycasterListener,
|
||||
class FramebufferRenderer : public RaycasterListener,
|
||||
public DeferredcasterListener
|
||||
{
|
||||
public:
|
||||
virtual ~FramebufferRenderer() = default;
|
||||
|
||||
void initialize() override;
|
||||
void deinitialize() override;
|
||||
void initialize();
|
||||
void deinitialize();
|
||||
|
||||
void updateResolution();
|
||||
void updateRaycastData();
|
||||
@@ -72,33 +70,33 @@ public:
|
||||
void updateFXAA();
|
||||
void updateDownscaledVolume();
|
||||
|
||||
void setResolution(glm::ivec2 res) override;
|
||||
void setHDRExposure(float hdrExposure) override;
|
||||
void setGamma(float gamma) override;
|
||||
void setHue(float hue) override;
|
||||
void setValue(float value) override;
|
||||
void setSaturation(float sat) override;
|
||||
void setResolution(glm::ivec2 res);
|
||||
void setHDRExposure(float hdrExposure);
|
||||
void setGamma(float gamma);
|
||||
void setHue(float hue);
|
||||
void setValue(float value);
|
||||
void setSaturation(float sat);
|
||||
|
||||
void enableFXAA(bool enable) override;
|
||||
void setDisableHDR(bool disable) override;
|
||||
void enableFXAA(bool enable);
|
||||
void setDisableHDR(bool disable);
|
||||
|
||||
void update() override;
|
||||
void update();
|
||||
void performRaycasterTasks(const std::vector<RaycasterTask>& tasks,
|
||||
const glm::ivec4& viewport);
|
||||
void performDeferredTasks(const std::vector<DeferredcasterTask>& tasks,
|
||||
const glm::ivec4& viewport);
|
||||
void render(Scene* scene, Camera* camera, float blackoutFactor) override;
|
||||
void render(Scene* scene, Camera* camera, float blackoutFactor);
|
||||
|
||||
/**
|
||||
* Update render data
|
||||
* Responsible for calling renderEngine::setRenderData
|
||||
*/
|
||||
virtual void updateRendererData() override;
|
||||
virtual void updateRendererData();
|
||||
|
||||
virtual void raycastersChanged(VolumeRaycaster& raycaster,
|
||||
RaycasterListener::IsAttached attached) override;
|
||||
RaycasterListener::IsAttached attached);
|
||||
virtual void deferredcastersChanged(Deferredcaster& deferredcaster,
|
||||
DeferredcasterListener::IsAttached isAttached) override;
|
||||
DeferredcasterListener::IsAttached isAttached);
|
||||
|
||||
private:
|
||||
using RaycasterProgObjMap = std::map<
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <openspace/properties/scalar/floatproperty.h>
|
||||
#include <openspace/properties/vector/vec3property.h>
|
||||
#include <openspace/properties/triggerproperty.h>
|
||||
#include <openspace/rendering/framebufferrenderer.h>
|
||||
#include <chrono>
|
||||
#include <filesystem>
|
||||
|
||||
@@ -54,7 +55,6 @@ namespace scripting { struct LuaLibrary; }
|
||||
class Camera;
|
||||
class RaycasterManager;
|
||||
class DeferredcasterManager;
|
||||
class Renderer;
|
||||
class Scene;
|
||||
class SceneManager;
|
||||
class ScreenLog;
|
||||
@@ -63,12 +63,6 @@ struct ShutdownInformation;
|
||||
|
||||
class RenderEngine : public properties::PropertyOwner {
|
||||
public:
|
||||
enum class RendererImplementation {
|
||||
Framebuffer = 0,
|
||||
ABuffer,
|
||||
Invalid
|
||||
};
|
||||
|
||||
RenderEngine();
|
||||
~RenderEngine();
|
||||
|
||||
@@ -80,9 +74,6 @@ public:
|
||||
Scene* scene();
|
||||
void updateScene();
|
||||
|
||||
const Renderer& renderer() const;
|
||||
RendererImplementation rendererImplementation() const;
|
||||
|
||||
ghoul::opengl::OpenGLStateCache& openglStateCache();
|
||||
|
||||
void updateShaderPrograms();
|
||||
@@ -120,24 +111,11 @@ public:
|
||||
|
||||
void removeRenderProgram(ghoul::opengl::ProgramObject* program);
|
||||
|
||||
/**
|
||||
* Set raycasting uniforms on the program object, and setup raycasting.
|
||||
*/
|
||||
void preRaycast(ghoul::opengl::ProgramObject& programObject);
|
||||
|
||||
/**
|
||||
* Tear down raycasting for the specified program object.
|
||||
*/
|
||||
void postRaycast(ghoul::opengl::ProgramObject& programObject);
|
||||
|
||||
/**
|
||||
* Set the camera to use for rendering
|
||||
*/
|
||||
void setCamera(Camera* camera);
|
||||
|
||||
|
||||
void setRendererFromString(const std::string& renderingMethod);
|
||||
|
||||
/**
|
||||
* Lets the renderer update the data to be brought into the rendererer programs
|
||||
* as a 'rendererData' variable in the dictionary.
|
||||
@@ -176,9 +154,6 @@ public:
|
||||
uint64_t frameNumber() const;
|
||||
|
||||
private:
|
||||
void setRenderer(std::unique_ptr<Renderer> renderer);
|
||||
RendererImplementation rendererFromString(const std::string& renderingMethod) const;
|
||||
|
||||
void renderScreenLog();
|
||||
void renderVersionInformation();
|
||||
void renderCameraInformation();
|
||||
@@ -188,8 +163,7 @@ private:
|
||||
Camera* _camera = nullptr;
|
||||
Scene* _scene = nullptr;
|
||||
|
||||
std::unique_ptr<Renderer> _renderer;
|
||||
RendererImplementation _rendererImplementation = RendererImplementation::Invalid;
|
||||
FramebufferRenderer _renderer;
|
||||
ghoul::Dictionary _rendererData;
|
||||
ghoul::Dictionary _resolveData;
|
||||
ScreenLog* _log = nullptr;
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2021 *
|
||||
* *
|
||||
* 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 *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___RENDERER___H__
|
||||
#define __OPENSPACE_CORE___RENDERER___H__
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
#include <vector>
|
||||
|
||||
namespace ghoul { class Dictionary; }
|
||||
namespace ghoul::filesystem { class File; }
|
||||
namespace ghoul::opengl {
|
||||
class ProgramObject;
|
||||
class Texture;
|
||||
} // namespace ghoul::opengl
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class RenderableVolume;
|
||||
class Camera;
|
||||
class Scene;
|
||||
|
||||
class Renderer {
|
||||
public:
|
||||
virtual ~Renderer() = default;
|
||||
|
||||
virtual void initialize() = 0;
|
||||
virtual void deinitialize() = 0;
|
||||
|
||||
virtual void setResolution(glm::ivec2 res) = 0;
|
||||
virtual void setHDRExposure(float hdrExposure) = 0;
|
||||
virtual void setGamma(float gamma) = 0;
|
||||
virtual void setHue(float hue) = 0;
|
||||
virtual void setValue(float value) = 0;
|
||||
virtual void setSaturation(float sat) = 0;
|
||||
virtual void enableFXAA(bool enable) = 0;
|
||||
virtual void setDisableHDR(bool disable) = 0;
|
||||
|
||||
/**
|
||||
* Set raycasting uniforms on the program object, and setup raycasting.
|
||||
*/
|
||||
virtual void preRaycast(ghoul::opengl::ProgramObject& /*programObject*/) {};
|
||||
|
||||
/**
|
||||
* Tear down raycasting for the specified program object.
|
||||
*/
|
||||
virtual void postRaycast(ghoul::opengl::ProgramObject& /*programObject*/) {};
|
||||
|
||||
|
||||
virtual void update() = 0;
|
||||
|
||||
virtual void render(Scene* scene, Camera* camera, float blackoutFactor) = 0;
|
||||
/**
|
||||
* Update render data
|
||||
* Responsible for calling renderEngine::setRenderData
|
||||
*/
|
||||
virtual void updateRendererData() = 0;
|
||||
};
|
||||
|
||||
} // openspace
|
||||
|
||||
#endif // __OPENSPACE_CORE___RENDERER___H__
|
||||
Reference in New Issue
Block a user