mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
Merge with antialiased abuffer
This commit is contained in:
@@ -1,60 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2015 *
|
||||
* *
|
||||
* 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 __ABUFFERDYNAMIC_H__
|
||||
#define __ABUFFERDYNAMIC_H__
|
||||
|
||||
#include <openspace/abuffer/abuffer.h>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class ABufferDynamic: public ABuffer {
|
||||
public:
|
||||
|
||||
ABufferDynamic();
|
||||
virtual ~ABufferDynamic();
|
||||
virtual bool initialize();
|
||||
|
||||
virtual void clear();
|
||||
virtual void preRender();
|
||||
virtual void postRender();
|
||||
|
||||
std::vector<fragmentData> pixelData();
|
||||
|
||||
protected:
|
||||
virtual bool reinitializeInternal();
|
||||
|
||||
private:
|
||||
|
||||
GLuint *_data;
|
||||
GLuint _anchorPointerTexture;
|
||||
GLuint _anchorPointerTextureInitializer;
|
||||
GLuint _atomicCounterBuffer;
|
||||
GLuint _fragmentBuffer;
|
||||
GLuint _fragmentTexture;
|
||||
|
||||
}; // ABufferDynamic
|
||||
} // openspace
|
||||
|
||||
#endif // __ABUFFERDYNAMIC_H__
|
||||
@@ -2,7 +2,7 @@
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2015 *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* 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 *
|
||||
@@ -22,17 +22,23 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __ABUFFER_H__
|
||||
#define __ABUFFER_H__
|
||||
#ifndef __ABUFFERRENDERER_H__
|
||||
#define __ABUFFERRENDERER_H__
|
||||
|
||||
#include <ghoul/opengl/ghoul_gl.h>
|
||||
#include <ghoul/glm.h>
|
||||
#include <ghoul/misc/dictionary.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include <openspace/rendering/volume.h>
|
||||
#include <openspace/rendering/renderer.h>
|
||||
|
||||
namespace ghoul {
|
||||
|
||||
namespace filesystem {
|
||||
class File;
|
||||
}
|
||||
@@ -44,66 +50,63 @@ namespace ghoul {
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class ABuffer {
|
||||
class RenderableVolume;
|
||||
class Camera;
|
||||
class Scene;
|
||||
|
||||
class ABufferRenderer : public Renderer {
|
||||
public:
|
||||
struct fragmentData {
|
||||
GLfloat _position[3];
|
||||
GLfloat _color[4];
|
||||
GLfloat _padding;
|
||||
};
|
||||
ABufferRenderer();
|
||||
virtual ~ABufferRenderer();
|
||||
|
||||
static const int MAX_LAYERS = 32;
|
||||
void initialize() override;
|
||||
void deinitialize() override;
|
||||
|
||||
ABuffer();
|
||||
virtual ~ABuffer();
|
||||
virtual void resolve(float blackoutFactor);
|
||||
virtual bool initialize() = 0;
|
||||
virtual bool reinitialize();
|
||||
void setCamera(Camera* camera) override;
|
||||
void setScene(Scene* scene) override;
|
||||
void setResolution(glm::ivec2 res) override;
|
||||
|
||||
void addVolume(const std::string& tag,ghoul::opengl::Texture* volume);
|
||||
void addTransferFunction(const std::string& tag,ghoul::opengl::Texture* transferFunction);
|
||||
int addSamplerfile(const std::string& filename);
|
||||
void update();
|
||||
void render(float blackoutFactor, bool doPerformanceMeasurements) override;
|
||||
|
||||
void invalidateABuffer();
|
||||
/**
|
||||
* Update render data
|
||||
* Responsible for calling renderEngine::setRenderData
|
||||
*/
|
||||
virtual void updateRendererData() override;
|
||||
|
||||
private:
|
||||
|
||||
void clear();
|
||||
void updateResolution();
|
||||
ghoul::Dictionary createResolveDictionary();
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> createResolveProgram(const ghoul::Dictionary& dict);
|
||||
|
||||
virtual void clear() = 0;
|
||||
virtual void preRender() = 0;
|
||||
virtual void postRender() = 0;
|
||||
Camera* _camera;
|
||||
Scene* _scene;
|
||||
glm::ivec2 _resolution;
|
||||
bool _dirtyResolution;
|
||||
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _resolveProgram;
|
||||
|
||||
/**
|
||||
* When a volume is attached or detached from the scene graph,
|
||||
* the resolve program needs to be recompiled.
|
||||
* The #volumes vector keeps track of which volumes that can
|
||||
* be rendered using the current resolve program.
|
||||
*/
|
||||
std::vector<Volume*> _volumes;
|
||||
|
||||
virtual std::vector<fragmentData> pixelData() = 0;
|
||||
GLuint _screenQuad;
|
||||
GLuint _anchorPointerTexture;
|
||||
GLuint _anchorPointerTextureInitializer;
|
||||
GLuint _atomicCounterBuffer;
|
||||
GLuint _fragmentBuffer;
|
||||
GLuint _fragmentTexture;
|
||||
GLuint _vertexPositionBuffer;
|
||||
|
||||
protected:
|
||||
virtual bool reinitializeInternal() = 0;
|
||||
|
||||
virtual bool initializeABuffer();
|
||||
|
||||
void generateShaderSource();
|
||||
bool updateShader();
|
||||
|
||||
void openspaceHeaders();
|
||||
void openspaceSamplerCalls();
|
||||
void openspaceSamplers();
|
||||
void openspaceTransferFunction();
|
||||
|
||||
int _width;
|
||||
int _height;
|
||||
int _totalPixels;
|
||||
|
||||
void updateDimensions();
|
||||
|
||||
GLuint _screenQuad;
|
||||
|
||||
bool _validShader;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _resolveShader;
|
||||
|
||||
std::vector<std::pair<std::string,ghoul::opengl::Texture*> > _volumes;
|
||||
std::vector<std::pair<std::string,ghoul::opengl::Texture*> > _transferFunctions;
|
||||
std::vector<ghoul::filesystem::File*> _samplerFiles;
|
||||
std::vector<std::string> _samplers;
|
||||
|
||||
float _volumeStepFactor;
|
||||
|
||||
}; // ABuffer
|
||||
ghoul::Dictionary _rendererData;
|
||||
}; // ABufferRenderer
|
||||
} // openspace
|
||||
|
||||
#endif // __ABUFFER_H__
|
||||
#endif // __RENDERER_H__
|
||||
@@ -2,7 +2,7 @@
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2015 *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* 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 *
|
||||
@@ -22,39 +22,63 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __ABUFFERFIXED_H__
|
||||
#define __ABUFFERFIXED_H__
|
||||
#ifndef __FRAMEBUFFERRENDERER_H__
|
||||
#define __FRAMEBUFFERRENDERER_H__
|
||||
|
||||
#include <openspace/abuffer/abuffer.h>
|
||||
#include <ghoul/opengl/ghoul_gl.h>
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include <openspace/rendering/volume.h>
|
||||
#include <openspace/rendering/renderer.h>
|
||||
|
||||
namespace ghoul {
|
||||
class Dictionary;
|
||||
|
||||
namespace filesystem {
|
||||
class File;
|
||||
}
|
||||
namespace opengl {
|
||||
class ProgramObject;
|
||||
class Texture;
|
||||
}
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class ABufferFixed: public ABuffer {
|
||||
class RenderableVolume;
|
||||
class Camera;
|
||||
class Scene;
|
||||
|
||||
class FramebufferRenderer : public Renderer {
|
||||
public:
|
||||
FramebufferRenderer();
|
||||
virtual ~FramebufferRenderer();
|
||||
|
||||
ABufferFixed();
|
||||
~ABufferFixed();
|
||||
bool initialize() override;
|
||||
|
||||
void clear() override;
|
||||
void preRender() override;
|
||||
void postRender() override;
|
||||
|
||||
std::vector<fragmentData> pixelData() override;
|
||||
|
||||
protected:
|
||||
virtual bool reinitializeInternal() override;
|
||||
void initialize() override;
|
||||
void deinitialize() override;
|
||||
|
||||
void setCamera(Camera* camera) override;
|
||||
void setScene(Scene* scene) override;
|
||||
void setResolution(glm::ivec2 res) override;
|
||||
|
||||
void update() override;
|
||||
void render(float blackoutFactor, bool doPerformanceMeasurements) override;
|
||||
|
||||
/**
|
||||
* Update render data
|
||||
* Responsible for calling renderEngine::setRenderData
|
||||
*/
|
||||
virtual void updateRendererData() override;
|
||||
private:
|
||||
GLuint *_data;
|
||||
GLuint _anchorPointerTexture;
|
||||
GLuint _anchorPointerTextureInitializer;
|
||||
GLuint _atomicCounterBuffer;
|
||||
GLuint _atomicCounterTexture;
|
||||
GLuint _fragmentBuffer;
|
||||
GLuint _fragmentTexture;
|
||||
}; // ABufferFixed
|
||||
|
||||
} // openspace
|
||||
Camera* _camera;
|
||||
Scene* _scene;
|
||||
glm::vec2 _resolution;
|
||||
}; // FramebufferRenderer
|
||||
} // openspace
|
||||
|
||||
#endif // __ABUFFERFIXED_H__
|
||||
#endif // __FRAMEBUFFERRENDERER_H__
|
||||
@@ -29,9 +29,11 @@
|
||||
#include <openspace/properties/scalarproperty.h>
|
||||
#include <openspace/util/powerscaledscalar.h>
|
||||
#include <openspace/util/updatestructures.h>
|
||||
#include <openspace/rendering/volume.h>
|
||||
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
|
||||
|
||||
// Forward declare to minimize dependencies
|
||||
namespace ghoul {
|
||||
namespace opengl {
|
||||
@@ -67,6 +69,7 @@ public:
|
||||
|
||||
virtual void render(const RenderData& data) = 0;
|
||||
virtual void update(const UpdateData& data);
|
||||
virtual std::vector<Volume*> volumesToRender(const RenderData& data) const;
|
||||
|
||||
bool isVisible() const;
|
||||
|
||||
|
||||
@@ -34,7 +34,10 @@ namespace ghoul {
|
||||
namespace fontrendering {
|
||||
class Font;
|
||||
}
|
||||
|
||||
namespace opengl {
|
||||
class ProgramObject;
|
||||
}
|
||||
class Dictionary;
|
||||
class SharedMemory;
|
||||
}
|
||||
|
||||
@@ -44,17 +47,14 @@ namespace openspace {
|
||||
class Camera;
|
||||
class SyncBuffer;
|
||||
class Scene;
|
||||
class ABuffer;
|
||||
class ABufferVisualizer;
|
||||
class Renderer;
|
||||
class ScreenLog;
|
||||
|
||||
class RenderEngine {
|
||||
public:
|
||||
enum class ABufferImplementation {
|
||||
FrameBuffer = 0,
|
||||
SingleLinked,
|
||||
Fixed,
|
||||
Dynamic,
|
||||
enum class RendererImplementation {
|
||||
Framebuffer = 0,
|
||||
ABuffer,
|
||||
Invalid
|
||||
};
|
||||
|
||||
@@ -67,13 +67,14 @@ public:
|
||||
~RenderEngine();
|
||||
|
||||
bool initialize();
|
||||
bool deinitialize();
|
||||
|
||||
void setSceneGraph(Scene* sceneGraph);
|
||||
Scene* scene();
|
||||
|
||||
Camera* camera() const;
|
||||
ABuffer* aBuffer() const;
|
||||
ABufferImplementation aBufferImplementation() const;
|
||||
Renderer* renderer() const;
|
||||
RendererImplementation rendererImplementation() const;
|
||||
|
||||
// sgct wrapped functions
|
||||
bool initializeGL();
|
||||
@@ -83,8 +84,6 @@ public:
|
||||
void postDraw();
|
||||
|
||||
void takeScreenshot();
|
||||
void toggleVisualizeABuffer(bool b);
|
||||
|
||||
void toggleInfoText(bool b);
|
||||
|
||||
void setPerformanceMeasurements(bool performanceMeasurements);
|
||||
@@ -97,21 +96,40 @@ public:
|
||||
void setGlobalBlackOutFactor(float factor);
|
||||
|
||||
void setDisableRenderingOnMaster(bool enabled);
|
||||
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> buildRenderProgram(
|
||||
std::string name,
|
||||
std::string vsPath,
|
||||
std::string fsPath,
|
||||
const ghoul::Dictionary& dictionary = ghoul::Dictionary());
|
||||
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> buildRenderProgram(
|
||||
std::string name,
|
||||
std::string vsPath,
|
||||
std::string fsPath,
|
||||
std::string csPath,
|
||||
const ghoul::Dictionary& dictionary = ghoul::Dictionary());
|
||||
|
||||
void removeRenderProgram(const std::unique_ptr<ghoul::opengl::ProgramObject>& program);
|
||||
|
||||
void setRendererFromString(const std::string& method);
|
||||
|
||||
/**
|
||||
* Let's the renderer update the data to be brought into the rendererer programs
|
||||
* as a 'rendererData' variable in the dictionary.
|
||||
*/
|
||||
void setRendererData(const ghoul::Dictionary& renderer);
|
||||
|
||||
/**
|
||||
* Returns the Lua library that contains all Lua functions available to affect the
|
||||
* rendering. The functions contained are
|
||||
* - openspace::luascriptfunctions::printImage
|
||||
* - openspace::luascriptfunctions::visualizeABuffer
|
||||
* \return The Lua library that contains all Lua functions available to affect the
|
||||
* rendering
|
||||
* rendering.
|
||||
*/
|
||||
static scripting::ScriptEngine::LuaLibrary luaLibrary();
|
||||
|
||||
// This is a temporary method to change the origin of the coordinate system ---abock
|
||||
void changeViewPoint(std::string origin);
|
||||
|
||||
//temporaray fade functionality
|
||||
// Temporary fade functionality
|
||||
void startFading(int direction, float fadeDuration);
|
||||
|
||||
// This is temporary until a proper screenspace solution is found ---abock
|
||||
@@ -122,38 +140,37 @@ public:
|
||||
} _onScreenInformation;
|
||||
|
||||
private:
|
||||
ABufferImplementation aBufferFromString(const std::string& impl);
|
||||
|
||||
void setRenderer(std::unique_ptr<Renderer> renderer);
|
||||
RendererImplementation rendererFromString(const std::string& method);
|
||||
void storePerformanceMeasurements();
|
||||
void renderInformation();
|
||||
void renderScreenLog();
|
||||
|
||||
Camera* _mainCamera;
|
||||
Scene* _sceneGraph;
|
||||
ABuffer* _abuffer;
|
||||
ABufferImplementation _abufferImplementation;
|
||||
std::unique_ptr<Renderer> _renderer;
|
||||
RendererImplementation _rendererImplementation;
|
||||
ghoul::Dictionary _rendererData;
|
||||
ScreenLog* _log;
|
||||
|
||||
bool _showInfo;
|
||||
bool _showScreenLog;
|
||||
bool _showLog;
|
||||
bool _takeScreenshot;
|
||||
|
||||
bool _doPerformanceMeasurements;
|
||||
ghoul::SharedMemory* _performanceMemory;
|
||||
|
||||
void generateGlslConfig();
|
||||
|
||||
float _globalBlackOutFactor;
|
||||
float _fadeDuration;
|
||||
float _currentFadeTime;
|
||||
int _fadeDirection;
|
||||
// bool _sgctRenderStatisticsVisible;
|
||||
|
||||
std::vector<ghoul::opengl::ProgramObject*> _programs;
|
||||
|
||||
std::shared_ptr<ghoul::fontrendering::Font> _fontInfo = nullptr;
|
||||
std::shared_ptr<ghoul::fontrendering::Font> _fontDate = nullptr;
|
||||
std::shared_ptr<ghoul::fontrendering::Font> _fontLog = nullptr;
|
||||
|
||||
bool _visualizeABuffer;
|
||||
ABufferVisualizer* _visualizer;
|
||||
|
||||
bool _disableMasterRendering = false;
|
||||
};
|
||||
|
||||
|
||||
@@ -22,47 +22,52 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __ABUFFERVISUALIZER_H__
|
||||
#define __ABUFFERVISUALIZER_H__
|
||||
#ifndef __RENDERER_H__
|
||||
#define __RENDERER_H__
|
||||
|
||||
#include <openspace/abuffer/abuffer.h>
|
||||
#include <ghoul/opengl/ghoul_gl.h>
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
namespace ghoul {
|
||||
class Dictionary;
|
||||
|
||||
namespace filesystem {
|
||||
class File;
|
||||
}
|
||||
namespace opengl {
|
||||
class ProgramObject;
|
||||
class Texture;
|
||||
}
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class ABufferVisualizer {
|
||||
class RenderableVolume;
|
||||
class Camera;
|
||||
class Scene;
|
||||
|
||||
class Renderer {
|
||||
public:
|
||||
virtual void initialize() = 0;
|
||||
virtual void deinitialize() = 0;
|
||||
|
||||
virtual void setCamera(Camera* camera) = 0;
|
||||
virtual void setScene(Scene* scene) = 0;
|
||||
virtual void setResolution(glm::ivec2 res) = 0;
|
||||
|
||||
ABufferVisualizer();
|
||||
~ABufferVisualizer();
|
||||
virtual void update() = 0;
|
||||
virtual void render(float blackoutFactor, bool doPerformanceMeasurements) = 0;
|
||||
/**
|
||||
* Update render data
|
||||
* Responsible for calling renderEngine::setRenderData
|
||||
*/
|
||||
virtual void updateRendererData() = 0;
|
||||
|
||||
}; // Renderer
|
||||
} // openspace
|
||||
|
||||
void updateData(const std::vector<ABuffer::fragmentData>& data);
|
||||
|
||||
void render();
|
||||
|
||||
private:
|
||||
|
||||
void initializeMarkers();
|
||||
|
||||
GLuint _pointcloud;
|
||||
GLsizei _pointcloudSize;
|
||||
GLuint _markers;
|
||||
GLsizei _markersSize;
|
||||
GLuint _imarkers;
|
||||
GLsizei _imarkersSize;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _pointcloudProgram;
|
||||
|
||||
}; // ABufferVisualizer
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __ABUFFER_H__
|
||||
#endif // __RENDERER_H__
|
||||
132
include/openspace/rendering/volume.h
Normal file
132
include/openspace/rendering/volume.h
Normal file
@@ -0,0 +1,132 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* 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 __VOLUME_H__
|
||||
#define __VOLUME_H__
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace ghoul {
|
||||
namespace opengl {
|
||||
class Texture;
|
||||
class ProgramObject;
|
||||
}
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class Volume {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Volume() {};
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~Volume() {};
|
||||
|
||||
/**
|
||||
* Render the volume's entry points (front face of the bounding geometry)
|
||||
*/
|
||||
//virtual void renderEntryPoints(const RenderData& data, ghoul::opengl::ProgramObject* program) = 0;
|
||||
|
||||
/**
|
||||
* Render the volume's exit points (back face of the bounding geometry)
|
||||
*/
|
||||
//virtual void renderExitPoints(const RenderData& data, ghoul::opengl::ProgramObject* program) = 0;
|
||||
|
||||
/**
|
||||
* Prepare the volume for the ABuffer's resolve step.
|
||||
* Make sure textures are up to date, bind them to texture units, set program uniforms etc.
|
||||
*/
|
||||
//virtual void preRayCast(ghoul::opengl::ProgramObject* program) {};
|
||||
|
||||
/**
|
||||
* Clean up for the volume after the ABuffer's resolve step.
|
||||
* Make sure texture units are deinitialized, etc.
|
||||
*/
|
||||
//virtual void postRayCast(ghoul::opengl::ProgramObject* program) {};
|
||||
|
||||
/**
|
||||
* Return a path to a file with the uniforms, per-vertex variables, functions etc
|
||||
* required to transform the vertices of the bounding geometry to view space.
|
||||
* It could also set other vertex out variables for the fragment shader to access.
|
||||
*
|
||||
* The shader preprocessor will have acceess to
|
||||
* A #{namespace} variable (unique per helper file)
|
||||
*
|
||||
* Should define the function:
|
||||
* vec4 getVertex()
|
||||
*/
|
||||
//virtual std::string getBoundsVsPath() = 0;
|
||||
|
||||
/*
|
||||
* Return a path to a file with the functions, uniforms and fragment shader in variables
|
||||
* required to generate the fragment color and depth.
|
||||
*
|
||||
* Should define the function:
|
||||
* Fragment getFragment()
|
||||
*
|
||||
* The shader preprocessor will have acceess to
|
||||
* A #{namespace} variable (unique per helper file)
|
||||
*/
|
||||
//virtual std::string getBoundsFsPath() = 0;
|
||||
|
||||
/**
|
||||
* Return a path to a file with all the uniforms, functions etc
|
||||
* required to perform ray casting through this volume.
|
||||
*
|
||||
* The header should define the following two functions:
|
||||
* vec4 sampler#{id}(vec3 samplePos, vec3 dir, float occludingAlpha, inout float maxStepSize)
|
||||
* (return color of sample)
|
||||
* float stepSize#{id}(vec3 samplePos, vec3 dir)
|
||||
* (return the preferred step size at this sample position)
|
||||
*
|
||||
* The shader preprocessor will have acceess to
|
||||
* An #{id} variable (unique per volume)
|
||||
* A #{namespace} variable (unique per helper file)
|
||||
*/
|
||||
//virtual std::string getRayCastPath() = 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 getHelperPath() = 0;
|
||||
|
||||
}; // Volume
|
||||
|
||||
} // openspace
|
||||
|
||||
#endif // __VOLUME_H__
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
namespace openspace {
|
||||
|
||||
|
||||
class Volume;
|
||||
class SceneGraphNode;
|
||||
|
||||
// Notifications:
|
||||
@@ -85,6 +85,10 @@ public:
|
||||
*/
|
||||
void render(const RenderData& data);
|
||||
|
||||
/*
|
||||
* Return a vector of volumes to render and their acciciated render data
|
||||
*/
|
||||
std::vector<std::pair<Volume*, RenderData>> volumesToRender(const RenderData& data) const;
|
||||
/*
|
||||
* Returns the root SceneGraphNode
|
||||
*/
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
bool addSceneGraphNode(SceneGraphNode* node);
|
||||
bool removeSceneGraphNode(SceneGraphNode* node);
|
||||
|
||||
const std::vector<SceneGraphNode*>& nodes();
|
||||
const std::vector<SceneGraphNode*>& nodes() const;
|
||||
|
||||
SceneGraphNode* rootNode() const;
|
||||
SceneGraphNode* sceneGraphNode(const std::string& name) const;
|
||||
|
||||
@@ -90,6 +90,7 @@ public:
|
||||
void setRenderable(Renderable* renderable);
|
||||
const Renderable* renderable() const;
|
||||
Renderable* renderable();
|
||||
std::vector<std::pair<Volume*, RenderData>> volumesToRender(const RenderData& data) const;
|
||||
|
||||
// @TODO Remove once the scalegraph is in effect ---abock
|
||||
void setEphemeris(Ephemeris* eph) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2015 *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* 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 *
|
||||
@@ -22,37 +22,39 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __ABUFFERSINGLELINKED_H__
|
||||
#define __ABUFFERSINGLELINKED_H__
|
||||
#ifndef __BLOCKPLANEINTERSECTIONGEOMETRY_H__
|
||||
#define __BLOCKPLANEINTERSECTIONGEOMETRY_H__
|
||||
|
||||
#include <ghoul/opengl/ghoul_gl.h>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#include <openspace/abuffer/abuffer.h>
|
||||
#include <vector>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class ABufferSingleLinked: public ABuffer {
|
||||
class BlockPlaneIntersectionGeometry {
|
||||
public:
|
||||
// initializers
|
||||
BlockPlaneIntersectionGeometry(glm::vec3 blockSize, glm::vec3 planeNormal, float planeDistance);
|
||||
~BlockPlaneIntersectionGeometry();
|
||||
|
||||
ABufferSingleLinked();
|
||||
virtual ~ABufferSingleLinked();
|
||||
virtual bool initialize();
|
||||
bool initialize();
|
||||
void render();
|
||||
|
||||
virtual void clear();
|
||||
virtual void preRender();
|
||||
virtual void postRender();
|
||||
|
||||
std::vector<fragmentData> pixelData();
|
||||
|
||||
protected:
|
||||
virtual bool reinitializeInternal();
|
||||
void setBlockSize(glm::vec3 size);
|
||||
void setPlane(glm::vec3 normal, float distance);
|
||||
|
||||
private:
|
||||
GLuint _anchorPointerTexture;
|
||||
GLuint _anchorPointerTextureInitializer;
|
||||
GLuint _atomicCounterBuffer;
|
||||
GLuint _fragmentBuffer;
|
||||
GLuint _fragmentTexture;
|
||||
}; // ABufferSingleLinked
|
||||
} // openspace
|
||||
void updateVertices();
|
||||
std::vector<float> _vertices;
|
||||
bool _initialized;
|
||||
GLuint _vaoId;
|
||||
GLuint _vBufferId;
|
||||
glm::vec3 _size;
|
||||
glm::vec3 _normal;
|
||||
float _planeDistance;
|
||||
};
|
||||
|
||||
#endif // __ABUFFERSINGLELINKED_H__
|
||||
}
|
||||
|
||||
#endif // __BLOCKPLANEINTERSECTIONGEOMETRY_H__
|
||||
@@ -2,7 +2,7 @@
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2015 *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* 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 *
|
||||
@@ -22,35 +22,28 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __ABUFFERFRAMEBUFFER_H__
|
||||
#define __ABUFFERFRAMEBUFFER_H__
|
||||
#ifndef __BOXGEOMETRY_H__
|
||||
#define __BOXGEOMETRY_H__
|
||||
|
||||
#include <openspace/abuffer/abuffer.h>
|
||||
#include <ghoul/opengl/ghoul_gl.h>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class ABufferFramebuffer: public ABuffer {
|
||||
|
||||
class BoxGeometry {
|
||||
public:
|
||||
|
||||
ABufferFramebuffer();
|
||||
virtual ~ABufferFramebuffer();
|
||||
// initializers
|
||||
BoxGeometry(glm::vec3 size);
|
||||
~BoxGeometry();
|
||||
|
||||
bool initialize();
|
||||
|
||||
void clear();
|
||||
void preRender();
|
||||
void postRender();
|
||||
void resolve(float blackoutFactor);
|
||||
|
||||
std::vector<fragmentData> pixelData();
|
||||
protected:
|
||||
bool reinitializeInternal();
|
||||
void render();
|
||||
|
||||
GLuint _vaoId;
|
||||
GLuint _vBufferId;
|
||||
glm::vec3 _size;
|
||||
};
|
||||
|
||||
bool initializeABuffer();
|
||||
} // namespace openspace
|
||||
|
||||
|
||||
private:
|
||||
|
||||
}; // ABufferSingleLinked
|
||||
} // openspace
|
||||
|
||||
#endif // __ABUFFERSINGLELINKED_H__
|
||||
#endif // __BOXGEOMETRY_H__
|
||||
@@ -111,7 +111,6 @@ public:
|
||||
void setProjectionMatrix(glm::mat4 projectionMatrix);
|
||||
const glm::mat4& projectionMatrix() const;
|
||||
|
||||
void setViewProjectionMatrix(glm::mat4 viewProjectionMatrix);
|
||||
const glm::mat4& viewProjectionMatrix() const;
|
||||
|
||||
void setCameraDirection(glm::vec3 cameraDirection);
|
||||
@@ -148,10 +147,11 @@ public:
|
||||
private:
|
||||
float _maxFov;
|
||||
float _sinMaxFov;
|
||||
glm::mat4 _viewProjectionMatrix;
|
||||
mutable glm::mat4 _viewProjectionMatrix;
|
||||
glm::mat4 _modelMatrix;
|
||||
glm::mat4 _viewMatrix;
|
||||
glm::mat4 _projectionMatrix;
|
||||
mutable bool _dirtyViewProjectionMatrix;
|
||||
glm::vec3 _viewDirection;
|
||||
glm::vec3 _cameraDirection;
|
||||
psc _focusPosition;
|
||||
@@ -159,7 +159,7 @@ private:
|
||||
|
||||
glm::vec3 _lookUp;
|
||||
|
||||
std::mutex _mutex;
|
||||
mutable std::mutex _mutex;
|
||||
|
||||
//local variables
|
||||
glm::mat4 _localViewRotationMatrix;
|
||||
|
||||
Reference in New Issue
Block a user