Merge commit 'a9661f681e115ebed096f5d25343dc99aad0f33f' into feature/data-management

# Conflicts:
#	data/scene/default.scene
#	data/scene/digitaluniverse/abell/abell.mod
#	data/scene/digitaluniverse/backgroundradiation/backgroundradiation.mod
#	data/scene/digitaluniverse/constellations/constellations.mod
#	data/scene/digitaluniverse/grids/grids.mod
#	data/scene/digitaluniverse/quasars/quasars.mod
#	data/scene/digitaluniverse/sloandss/sloandss.mod
#	data/scene/digitaluniverse/tully/tully.data
#	data/scene/digitaluniverse/tully/tully.mod
#	data/scene/earth/earth.mod
#	data/scene/grids/grids.mod
#	data/scene/mars/mars.mod
#	data/scene/milkyway/digitaluniverse/digitaluniverse.mod
#	data/scene/moon/moon.mod
#	data/scene/satellites/tle/geo.txt
#	data/scene/satellites/tle/gps-ops.txt
#	data/scene/satellites/tle/stations.txt
#	modules/imgui/src/renderproperties.cpp
#	modules/sync/ext/libtorrent
#	openspace.cfg
#	src/rendering/renderengine.cpp
This commit is contained in:
Alexander Bock
2017-12-27 19:39:40 +01:00
162 changed files with 14060 additions and 569 deletions
+16 -1
View File
@@ -70,6 +70,13 @@ public:
void setScene(Scene* scene) override;
void setResolution(glm::ivec2 res) override;
void setNAaSamples(int nAaSamples) override;
void setHDRExposure(float hdrExposure) override;
void setHDRBackground(float hdrBackground) override;
void setGamma(float gamma) override;
float hdrBackground() const override;
int nAaSamples() const override;
std::vector<double> mSSAPattern() const override;
using Renderer::preRaycast;
void preRaycast(const RaycasterTask& raycasterTask);
@@ -91,7 +98,10 @@ private:
void updateResolution();
void updateRaycastData();
void updateResolveDictionary();
void updateMSAASamplingPattern();
void saveTextureToMemory(const GLenum color_buffer_attachment,
const int width, const int height, std::vector<double> & memory) const;
Camera* _camera;
Scene* _scene;
glm::ivec2 _resolution;
@@ -133,8 +143,13 @@ private:
GLuint _vertexPositionBuffer;
int _nAaSamples;
float _hdrExposure;
float _hdrBackground;
float _gamma;
float _blackoutFactor;
std::vector<double> _mSAAPattern;
ghoul::Dictionary _rendererData;
};
@@ -0,0 +1,76 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2017 *
* *
* 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___DEFERREDCASTER___H
#define __OPENSPACE_CORE___DEFERREDCASTER___H
#include <string>
#include <vector>
#include <openspace/util/updatestructures.h>
namespace ghoul::opengl {
class Texture;
class ProgramObject;
} // ghoul::opengl
namespace openspace {
struct RenderData;
struct DeferredcastData;
class Deferredcaster {
public:
/**
* Destructor
*/
virtual ~Deferredcaster() {};
virtual void preRaycast(const RenderData& /*renderData*/,
const DeferredcastData& /*deferredData*/, ghoul::opengl::ProgramObject& /*program*/) {};
virtual void postRaycast(const RenderData & /*renderData*/,
const DeferredcastData& /*deferredData*/, ghoul::opengl::ProgramObject& /*program*/) {};
virtual std::string deferredcastPath() const = 0;
virtual std::string deferredcastVSPath() const = 0;
virtual std::string deferredcastFSPath() const = 0;
/**
* Return a path to a glsl file with helper functions required for the
* transformation and raycast steps.
* This file will be included once per shader program generated,
* regardless of how many volumes say they require the file.
* Ideal to avoid redefinitions of helper functions.
*
* The shader preprocessor will have access to the #{namespace} variable (unique per helper file)
* which should be a prefix to all symbols defined by the helper
*/
virtual std::string helperPath() const = 0;
};
} // namespace openspace
#endif // __OPENSPACE_CORE___DEFERREDCASTER___H
@@ -0,0 +1,45 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2017 *
* *
* 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___DEFERREDCASTERLISTENER___H__
#define __OPENSPACE_CORE___DEFERREDCASTERLISTENER___H__
#include <ghoul/misc/boolean.h>
namespace openspace {
class Deferredcaster;
class DeferredcasterListener {
public:
using isAttached = ghoul::Boolean;
virtual void deferredcastersChanged(Deferredcaster& deferredcaster,
isAttached isAttached) = 0;
};
} // openspace
#endif // __OPENSPACE_CORE___DEFERREDCASTERLISTENER___H__
@@ -0,0 +1,55 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2017 *
* *
* 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___DEFERREDCASTERMANAGER___H__
#define __OPENSPACE_CORE___DEFERREDCASTERMANAGER___H__
#include <vector>
namespace openspace {
class Deferredcaster;
class DeferredcasterListener;
class DeferredcasterManager {
public:
DeferredcasterManager();
~DeferredcasterManager();
void attachDeferredcaster(Deferredcaster& deferredcaster);
void detachDeferredcaster(Deferredcaster& deferredcaster);
bool isAttached(Deferredcaster& deferredcaster);
const std::vector<Deferredcaster*>& deferredcasters();
void addListener(DeferredcasterListener& listener);
void removeListener(DeferredcasterListener& listener);
private:
std::vector<Deferredcaster*> _deferredcasters;
std::vector<DeferredcasterListener*> _listeners;
};
} // namespace openspace
#endif // __OPENSPACE_CORE___DEFERREDCASTERMANAGER___H__
@@ -32,6 +32,7 @@
#include <vector>
#include <map>
#include <openspace/rendering/deferredcasterlistener.h>
#include <openspace/rendering/raycasterlistener.h>
#include <openspace/rendering/renderer.h>
#include <openspace/util/updatestructures.h>
@@ -48,8 +49,10 @@ namespace openspace {
class Camera;
class Scene;
class FramebufferRenderer : public Renderer, public RaycasterListener {
class FramebufferRenderer : public Renderer, public RaycasterListener,
public DeferredcasterListener
{
public:
FramebufferRenderer();
virtual ~FramebufferRenderer();
@@ -59,11 +62,22 @@ public:
void updateResolution();
void updateRaycastData();
void updateDeferredcastData();
void updateHDRData();
void updateMSAASamplingPattern();
void setCamera(Camera* camera) override;
void setScene(Scene* scene) override;
void setResolution(glm::ivec2 res) override;
void setNAaSamples(int nAaSamples) override;
void setHDRExposure(float hdrExposure) override;
void setHDRBackground(float hdrBackground) override;
void setGamma(float gamma) override;
float hdrBackground() const override;
int nAaSamples() const override;
/*const double * mSSAPattern() const override;*/
std::vector<double> mSSAPattern() const override;
void update() override;
void render(float blackoutFactor, bool doPerformanceMeasurements) override;
@@ -75,6 +89,7 @@ public:
virtual void updateRendererData() override;
virtual void raycastersChanged(VolumeRaycaster& raycaster, bool attached) override;
virtual void deferredcastersChanged(Deferredcaster& deferredcaster, ghoul::Boolean isAttached) override;
private:
std::map<VolumeRaycaster*, RaycastData> _raycastData;
@@ -88,17 +103,27 @@ private:
VolumeRaycaster*, std::unique_ptr<ghoul::opengl::ProgramObject>
> _insideRaycastPrograms;
std::map<Deferredcaster*, DeferredcastData> _deferredcastData;
std::map<Deferredcaster*, std::unique_ptr<ghoul::opengl::ProgramObject>> _deferredcastPrograms;
std::unique_ptr<ghoul::opengl::ProgramObject> _hdrBackGroundProgram;
std::unique_ptr<ghoul::opengl::ProgramObject> _resolveProgram;
GLuint _screenQuad;
GLuint _vertexPositionBuffer;
GLuint _mainColorTexture;
GLuint _mainOtherDataTexture;
GLuint _mainPositionTexture;
GLuint _mainNormalTexture;
GLuint _mainDepthTexture;
GLuint _exitColorTexture;
GLuint _mainFramebuffer;
GLuint _exitDepthTexture;
GLuint _exitFramebuffer;
GLuint _deferredFramebuffer;
GLuint _deferredColorTexture;
bool _dirtyDeferredcastData;
bool _dirtyRaycastData;
bool _dirtyResolution;
@@ -106,6 +131,12 @@ private:
Scene* _scene;
glm::vec2 _resolution;
int _nAaSamples;
float _hdrExposure;
float _hdrBackground;
float _gamma;
//double * _mSAAPattern;
std::vector<double> _mSAAPattern;
ghoul::Dictionary _rendererData;
};
@@ -30,6 +30,7 @@
#include <openspace/properties/optionproperty.h>
#include <openspace/properties/scalar/boolproperty.h>
#include <openspace/properties/scalar/intproperty.h>
#include <openspace/properties/scalar/floatproperty.h>
#include <openspace/properties/triggerproperty.h>
namespace ghoul {
@@ -46,6 +47,7 @@ namespace scripting { struct LuaLibrary; }
class Camera;
class RaycasterManager;
class DeferredcasterManager;
class Renderer;
class Scene;
class SceneManager;
@@ -78,6 +80,7 @@ public:
Renderer* renderer() const;
RendererImplementation rendererImplementation() const;
RaycasterManager& raycasterManager();
DeferredcasterManager& deferredcasterManager();
void updateShaderPrograms();
@@ -173,6 +176,7 @@ private:
Camera* _camera;
Scene* _scene;
std::unique_ptr<RaycasterManager> _raycasterManager;
std::unique_ptr<DeferredcasterManager> _deferredcasterManager;
properties::BoolProperty _doPerformanceMeasurements;
std::unique_ptr<performance::PerformanceManager> _performanceManager;
@@ -199,6 +203,10 @@ private:
float _currentFadeTime;
int _fadeDirection;
properties::IntProperty _nAaSamples;
properties::FloatProperty _hdrExposure;
properties::FloatProperty _hdrBackground;
properties::FloatProperty _gamma;
uint64_t _frameNumber;
std::vector<ghoul::opengl::ProgramObject*> _programs;
+7
View File
@@ -56,6 +56,13 @@ public:
virtual void setScene(Scene* scene) = 0;
virtual void setResolution(glm::ivec2 res) = 0;
virtual void setNAaSamples(int nAaSamples) = 0;
virtual void setHDRExposure(float hdrExposure) = 0;
virtual void setHDRBackground(float hdrBackground) = 0;
virtual void setGamma(float gamma) = 0;
virtual float hdrBackground() const = 0;
virtual int nAaSamples() const = 0;
virtual std::vector<double> mSSAPattern() const = 0;
/**
* Set raycasting uniforms on the program object, and setup raycasting.
+3
View File
@@ -133,9 +133,11 @@ public:
class SgctInternal {
friend class Camera;
public:
void setSceneMatrix(glm::mat4 sceneMatrix);
void setViewMatrix(glm::mat4 viewMatrix);
void setProjectionMatrix(glm::mat4 projectionMatrix);
const glm::mat4& sceneMatrix() const;
const glm::mat4& viewMatrix() const;
const glm::mat4& projectionMatrix() const;
const glm::mat4& viewProjectionMatrix() const;
@@ -148,6 +150,7 @@ public:
{}
// State
glm::mat4 _sceneMatrix;
glm::mat4 _viewMatrix;
glm::mat4 _projectionMatrix;
+12
View File
@@ -31,6 +31,7 @@
namespace openspace {
class Deferredcaster;
class VolumeRaycaster;
struct InitializeData {};
@@ -63,8 +64,14 @@ struct RaycasterTask {
RenderData renderData;
};
struct DeferredcasterTask {
Deferredcaster* deferredcaster;
RenderData renderData;
};
struct RendererTasks {
std::vector<RaycasterTask> raycasterTasks;
std::vector<DeferredcasterTask> deferredcasterTasks;
};
struct RaycastData {
@@ -72,6 +79,11 @@ struct RaycastData {
std::string namespaceName;
};
struct DeferredcastData {
int id;
std::string namespaceName;
};
/**
* Defines the position of an object relative to a surface. The surface is defined as
* a reference surface together with a height offset from that reference surface.