improved galaxy rendering

This commit is contained in:
Emil Axelsson
2016-06-03 11:16:57 +02:00
parent 432a29314c
commit 1901166640
47 changed files with 1156 additions and 353 deletions
@@ -35,6 +35,7 @@
#include <map>
#include <ghoul/opengl/textureunit.h>
#include <openspace/rendering/volume.h>
#include <openspace/rendering/renderer.h>
#include <openspace/rendering/raycasterlistener.h>
@@ -69,6 +70,9 @@ public:
void setScene(Scene* scene) override;
void setResolution(glm::ivec2 res) override;
void preRaycast(ghoul::opengl::ProgramObject& programObject);
void postRaycast(ghoul::opengl::ProgramObject& programObject);
void update();
void render(float blackoutFactor, bool doPerformanceMeasurements) override;
@@ -112,6 +116,9 @@ private:
GLuint _mainColorTexture;
GLuint _mainDepthTexture;
std::unique_ptr<ghoul::opengl::TextureUnit> _mainColorTextureUnit;
std::unique_ptr<ghoul::opengl::TextureUnit> _mainDepthTextureUnit;
GLuint _mainFramebuffer;
GLuint _screenQuad;
GLuint _anchorPointerTexture;
@@ -122,6 +129,11 @@ private:
GLuint _vertexPositionBuffer;
int _nAaSamples;
std::unique_ptr<RendererTasks> _rendererTasks;
std::unique_ptr<RenderData> _renderData;
float _blackoutFactor;
ghoul::Dictionary _rendererData;
}; // ABufferRenderer
} // openspace
+1
View File
@@ -68,6 +68,7 @@ public:
virtual void render(const RenderData& data);
virtual void render(const RenderData& data, RendererTasks& rendererTask);
virtual void postRender(const RenderData& data);
virtual void update(const UpdateData& data);
bool isVisible() const;
+30 -4
View File
@@ -60,6 +60,12 @@ public:
Invalid
};
enum class RenderProgramType {
Default = 0,
Post
};
static const std::string PerformanceMeasurementSharedData;
static const std::string KeyFontMono;
@@ -104,24 +110,43 @@ public:
std::string name,
std::string vsPath,
std::string fsPath,
const ghoul::Dictionary& dictionary = ghoul::Dictionary());
const ghoul::Dictionary& dictionary = ghoul::Dictionary(),
RenderEngine::RenderProgramType type = RenderEngine::RenderProgramType::Default);
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());
const ghoul::Dictionary& dictionary = ghoul::Dictionary(),
RenderEngine::RenderProgramType type = RenderEngine::RenderProgramType::Default);
void removeRenderProgram(const std::unique_ptr<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);
void setRendererFromString(const std::string& method);
/**
* Let's the renderer update the data to be brought into the rendererer programs
* Lets 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);
void setRendererData(const ghoul::Dictionary& rendererData);
/**
* Lets the renderer update the data to be brought into the post rendererer programs
* as a 'resolveData' variable in the dictionary.
*/
void setResolveData(const ghoul::Dictionary& resolveData);
/**
* Returns the Lua library that contains all Lua functions available to affect the
@@ -156,6 +181,7 @@ private:
std::unique_ptr<Renderer> _renderer;
RendererImplementation _rendererImplementation;
ghoul::Dictionary _rendererData;
ghoul::Dictionary _resolveData;
ScreenLog* _log;
bool _showInfo;
+12
View File
@@ -59,6 +59,18 @@ public:
virtual void setScene(Scene* scene) = 0;
virtual void setResolution(glm::ivec2 res) = 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(float blackoutFactor, bool doPerformanceMeasurements) = 0;
/**
@@ -70,6 +70,11 @@ public:
*/
virtual void postRaycast(const RaycastData& data, ghoul::opengl::ProgramObject& program) {};
/**
* Return true if the camera is inside the volume.
* Also set localPosition to the camera position in the volume's local coordainte system.
*/
virtual bool cameraIsInside(const RenderData& data, glm::vec3& localPosition) { return false; };
/**
* Return a path the file to use as vertex shader
*