mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-05 11:09:37 -06:00
Pull request changes.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
##########################################################################################
|
||||
##########################################################################################
|
||||
# #
|
||||
# OpenSpace #
|
||||
# #
|
||||
# Copyright (c) 2014-2016 #
|
||||
# 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 #
|
||||
|
||||
@@ -52,11 +52,11 @@ function postInitialization()
|
||||
graphical settings for the renderables.
|
||||
]]--
|
||||
openspace.printInfo("Setting default values")
|
||||
openspace.setPropertyValue("Sun.renderable.enabled", true)
|
||||
openspace.setPropertyValue("SunGlare.renderable.enabled", false)
|
||||
openspace.setPropertyValue("SunMarker.renderable.enabled", false)
|
||||
openspace.setPropertyValue("EarthMarker.renderable.enabled", false)
|
||||
openspace.setPropertyValue("Constellation Bounds.renderable.enabled", false)
|
||||
openspace.setPropertyValue("Sun.renderable.Enabled", true)
|
||||
openspace.setPropertyValue("SunGlare.renderable.Enabled", false)
|
||||
openspace.setPropertyValue("SunMarker.renderable.Enabled", false)
|
||||
openspace.setPropertyValue("EarthMarker.renderable.Enabled", false)
|
||||
openspace.setPropertyValue("Constellation Bounds.renderable.Enabled", false)
|
||||
|
||||
openspace.setPropertyValue("MilkyWay.renderable.Transparency", 0.33)
|
||||
openspace.setPropertyValue("MilkyWay.renderable.Segments", 50)
|
||||
|
||||
@@ -68,9 +68,7 @@ return {
|
||||
Type = "RenderablePlanet",
|
||||
-- Atmosphere radius in Km
|
||||
AtmosphereRadius = 6447.0,
|
||||
--PlanetRadius = 6378.137,
|
||||
PlanetRadius = 6356.752,
|
||||
--PlanetRadius = 6360.0,
|
||||
PlanetAverageGroundReflectance = 0.1,
|
||||
Rayleigh = {
|
||||
Coefficients = {
|
||||
@@ -97,7 +95,6 @@ return {
|
||||
Coefficients = {
|
||||
-- Reflection coefficients are given in km^-1
|
||||
Scattering = {4.0e-3, 4.0e-3, 4.0e-3},
|
||||
--Scattering = {2.0e-5, 2.0e-5, 2.0e-5},
|
||||
-- Extinction coefficients are a fraction of the Mie coefficients
|
||||
Extinction = {4.0e-3/0.9, 4.0e-3/0.9, 4.0e-3/0.9}
|
||||
},
|
||||
|
||||
@@ -198,12 +198,8 @@ return {
|
||||
Atmosphere = {
|
||||
Type = "RenderableGlobe",
|
||||
-- Atmosphere radius in Km
|
||||
--AtmosphereRadius = 6450,
|
||||
--AtmosphereRadius = 6420.0,
|
||||
AtmosphereRadius = 6447.0,
|
||||
--PlanetRadius = 6378.137,
|
||||
PlanetRadius = 6377.0,
|
||||
--PlanetRadius = 6360.0,
|
||||
PlanetAverageGroundReflectance = 0.1,
|
||||
Rayleigh = {
|
||||
Coefficients = {
|
||||
@@ -230,7 +226,6 @@ return {
|
||||
Coefficients = {
|
||||
-- Reflection coefficients are given in km^-1
|
||||
Scattering = {4.0e-3, 4.0e-3, 4.0e-3},
|
||||
--Scattering = {2.0e-5, 2.0e-5, 2.0e-5},
|
||||
-- Extinction coefficients are a fraction of the Mie coefficients
|
||||
Extinction = {4.0e-3/0.9, 4.0e-3/0.9, 4.0e-3/0.9}
|
||||
},
|
||||
|
||||
@@ -1,80 +1,6 @@
|
||||
--local marsEllipsoid = {3396190.0, 3396190.0, 3376200.0}
|
||||
local marsEllipsoid = {3396190.0, 3396190.0, 3396190.0}
|
||||
|
||||
--[[
|
||||
local patches = {
|
||||
{
|
||||
Name = "West Candor Chasma",
|
||||
Texture = openspace.absPath("${MARS_DATA}/map_datasets/CTX/West_Candor_Chasma_longlat_global.vrt"),
|
||||
Height = openspace.absPath("${MARS_DATA}/map_datasets/CTX/West_Candor_Chasma_DEM_longlat_global.vrt")
|
||||
},
|
||||
{
|
||||
Name = "Southwest Candor Chasma",
|
||||
Texture = openspace.absPath("${MARS_DATA}/map_datasets/HiRISE/Layered_Rock_Outcrops_in_Southwest_Candor_Chasma_Texture.vrt"),
|
||||
Height = openspace.absPath("${MARS_DATA}/map_datasets/HiRISE/Layered_Rock_Outcrops_in_Southwest_Candor_Chasma_Heightmap.vrt")
|
||||
},
|
||||
{
|
||||
Name = "Kaiser Crater",
|
||||
Texture = openspace.absPath("${MARS_DATA}/map_datasets/HiRISE/Active_Dune_Gullies_in_Kaiser_Crater_Texture.vrt"),
|
||||
Height = openspace.absPath("${MARS_DATA}/map_datasets/HiRISE/Active_Dune_Gullies_in_Kaiser_Crater_Heightmap.vrt")
|
||||
},
|
||||
{
|
||||
Name = "Eberswalde Crater",
|
||||
Texture = openspace.absPath("${MARS_DATA}/map_datasets/HiRISE/Delta_Structure_in_Eberswalde_Crater_Texture.vrt"),
|
||||
Height = openspace.absPath("${MARS_DATA}/map_datasets/HiRISE/Delta_Structure_in_Eberswalde_Crater_Heightmap.vrt")
|
||||
},
|
||||
{
|
||||
Name = "Mojave Crater",
|
||||
Texture = openspace.absPath("${MARS_DATA}/map_datasets/HiRISE/Dissected_Wall_of_Mojave_Crater_Texture.vrt"),
|
||||
Height = openspace.absPath("${MARS_DATA}/map_datasets/HiRISE/Dissected_Wall_of_Mojave_Crater_Heightmap.vrt")
|
||||
},
|
||||
{
|
||||
Name = "Tartarus Montes",
|
||||
Texture = openspace.absPath("${MARS_DATA}/map_datasets/HiRISE/Field_of_Cones_in_the_Tartarus_Montes_Texture.vrt"),
|
||||
Height = openspace.absPath("${MARS_DATA}/map_datasets/HiRISE/Field_of_Cones_in_the_Tartarus_Montes_Heightmap.vrt")
|
||||
},
|
||||
{
|
||||
Name = "Juventae Chasma 2",
|
||||
Texture = openspace.absPath("${MARS_DATA}/map_datasets/HiRISE/Light-toned_Layering_in_Plains_West_of_Juventae_Chasma_2_Texture.vrt"),
|
||||
Height = openspace.absPath("${MARS_DATA}/map_datasets/HiRISE/Light-toned_Layering_in_Plains_West_of_Juventae_Chasma_2_Heightmap.vrt")
|
||||
},
|
||||
{
|
||||
Name = "Ganges Chasma",
|
||||
Texture = openspace.absPath("${MARS_DATA}/map_datasets/HiRISE/Light-Toned_Mounds_in_Ganges_Chasma_Texture.vrt"),
|
||||
Height = openspace.absPath("${MARS_DATA}/map_datasets/HiRISE/Light-Toned_Mounds_in_Ganges_Chasma_Heightmap.vrt")
|
||||
},
|
||||
{
|
||||
Name = "MSL EDL Landing Site",
|
||||
Texture = openspace.absPath("${MARS_DATA}/map_datasets/HiRISE/MSL_EDL_Landing_Site_6_Days_texture.vrt"),
|
||||
Height = openspace.absPath("${MARS_DATA}/map_datasets/HiRISE/MSL_EDL_Landing_Site_6_Days_hole_filled_heightmap.vrt")
|
||||
},
|
||||
{
|
||||
Name = "Northeast Melas Chasma",
|
||||
Texture = openspace.absPath("${MARS_DATA}/map_datasets/HiRISE/northeast_melas_chasma_dune_fields_and_wall_rock_texture.vrt"),
|
||||
Height = openspace.absPath("${MARS_DATA}/map_datasets/HiRISE/northeast_melas_chasma_dune_fields_and_wall_rock_heightmap.vrt")
|
||||
},
|
||||
{
|
||||
Name = "Olympus Mons",
|
||||
Texture = openspace.absPath("${MARS_DATA}/map_datasets/HiRISE/Olympus_Mons-Fissure_and_Channel-17N127W_Texture.vrt"),
|
||||
Height = openspace.absPath("${MARS_DATA}/map_datasets/HiRISE/Olympus_Mons-Fissure_and_Channel-17N127W_Heightmap.vrt")
|
||||
},
|
||||
{
|
||||
Name = "Melas Chasma",
|
||||
Texture = openspace.absPath("${MARS_DATA}/map_datasets/HiRISE/Sulfates_and_Valley_System_in_Melas_Chasma_Basin_Texture.vrt"),
|
||||
Height = openspace.absPath("${MARS_DATA}/map_datasets/HiRISE/Sulfates_and_Valley_System_in_Melas_Chasma_Basin_Heightmap.vrt")
|
||||
},
|
||||
{
|
||||
Name = "Elysium Mons",
|
||||
Texture = openspace.absPath("${MARS_DATA}/map_datasets/HiRISE/Unusual_Depression_Near_Elysium_Mons_Texture.vrt"),
|
||||
Height = openspace.absPath("${MARS_DATA}/map_datasets/HiRISE/Unusual_Depression_Near_Elysium_Mons_Heightmap.vrt")
|
||||
},
|
||||
{
|
||||
Name = "Mars Exploration Rover",
|
||||
Texture = openspace.absPath("${MARS_DATA}/map_datasets/HiRISE/Part_of_Area_Traversed_by_the_Mars_Exploration_Rover_Texture.vrt"),
|
||||
Height = openspace.absPath("${MARS_DATA}/map_datasets/HiRISE/Part_of_Area_Traversed_by_the_Mars_Exploration_Rover_Heightmap.vrt")
|
||||
},
|
||||
}
|
||||
]]
|
||||
local function createTextureLayers(patches)
|
||||
result = {}
|
||||
for k,v in pairs(patches) do
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
DOWNLOAD = true
|
||||
DOWNLOAD = false
|
||||
|
||||
function dirListing(dirname)
|
||||
f = io.popen('ls ' .. dirname)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*****************************************************************************************
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
@@ -54,11 +54,11 @@ public:
|
||||
virtual void postRaycast(const RenderData & renderData, const DeferredcastData& deferredData,
|
||||
ghoul::opengl::ProgramObject& program) {};
|
||||
|
||||
virtual std::string getDeferredcastPath() const = 0;
|
||||
virtual std::string deferredcastPath() const = 0;
|
||||
|
||||
virtual std::string getDeferredcastVSPath() const = 0;
|
||||
virtual std::string deferredcastVSPath() const = 0;
|
||||
|
||||
virtual std::string getDeferredcastFSPath() const = 0;
|
||||
virtual std::string deferredcastFSPath() const = 0;
|
||||
|
||||
/**
|
||||
* Return a path to a glsl file with helper functions required for the
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
* 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() const = 0;
|
||||
virtual std::string helperPath() const = 0;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -25,13 +25,15 @@
|
||||
#ifndef __OPENSPACE_CORE___DEFERREDCASTERLISTENER___H__
|
||||
#define __OPENSPACE_CORE___DEFERREDCASTERLISTENER___H__
|
||||
|
||||
#include <ghoul/misc/boolean.h>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class Deferredcaster;
|
||||
|
||||
class DeferredcasterListener {
|
||||
public:
|
||||
virtual void deferredcastersChanged(Deferredcaster& deferredcaster, bool attached) = 0;
|
||||
virtual void deferredcastersChanged(Deferredcaster& deferredcaster, ghoul::Boolean isAttached) = 0;
|
||||
};
|
||||
|
||||
} // openspace
|
||||
|
||||
@@ -43,6 +43,7 @@ public:
|
||||
|
||||
void addListener(DeferredcasterListener& listener);
|
||||
void removeListener(DeferredcasterListener& listener);
|
||||
|
||||
private:
|
||||
std::vector<Deferredcaster*> _deferredcasters;
|
||||
std::vector<DeferredcasterListener*> _listeners;
|
||||
|
||||
@@ -84,7 +84,7 @@ public:
|
||||
virtual void updateRendererData() override;
|
||||
|
||||
virtual void raycastersChanged(VolumeRaycaster& raycaster, bool attached) override;
|
||||
virtual void deferredcastersChanged(Deferredcaster& deferredcaster, bool attached) override;
|
||||
virtual void deferredcastersChanged(Deferredcaster& deferredcaster, ghoul::Boolean isAttached) override;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*****************************************************************************************
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
@@ -37,51 +37,51 @@ class VolumeRaycaster;
|
||||
struct InitializeData {};
|
||||
|
||||
struct TransformData {
|
||||
glm::dvec3 translation;
|
||||
glm::dmat3 rotation;
|
||||
double scale;
|
||||
glm::dvec3 translation;
|
||||
glm::dmat3 rotation;
|
||||
double scale;
|
||||
};
|
||||
|
||||
struct UpdateData {
|
||||
TransformData modelTransform;
|
||||
const Time time;
|
||||
const bool doPerformanceMeasurement;
|
||||
TransformData modelTransform;
|
||||
const Time time;
|
||||
const bool doPerformanceMeasurement;
|
||||
};
|
||||
|
||||
struct RenderData {
|
||||
const Camera& camera;
|
||||
// psc position to be removed in favor of the double precision position defined in
|
||||
// the translation in transform.
|
||||
psc position;
|
||||
const Time time;
|
||||
bool doPerformanceMeasurement;
|
||||
int renderBinMask;
|
||||
TransformData modelTransform;
|
||||
const Camera& camera;
|
||||
// psc position to be removed in favor of the double precision position defined in
|
||||
// the translation in transform.
|
||||
psc position;
|
||||
const Time time;
|
||||
bool doPerformanceMeasurement;
|
||||
int renderBinMask;
|
||||
TransformData modelTransform;
|
||||
};
|
||||
|
||||
struct RaycasterTask {
|
||||
VolumeRaycaster* raycaster;
|
||||
RenderData renderData;
|
||||
VolumeRaycaster* raycaster;
|
||||
RenderData renderData;
|
||||
};
|
||||
|
||||
struct DeferredcasterTask {
|
||||
Deferredcaster* deferredcaster;
|
||||
RenderData renderData;
|
||||
Deferredcaster* deferredcaster;
|
||||
RenderData renderData;
|
||||
};
|
||||
|
||||
struct RendererTasks {
|
||||
std::vector<RaycasterTask> raycasterTasks;
|
||||
std::vector<DeferredcasterTask> deferredcasterTasks;
|
||||
std::vector<RaycasterTask> raycasterTasks;
|
||||
std::vector<DeferredcasterTask> deferredcasterTasks;
|
||||
};
|
||||
|
||||
struct RaycastData {
|
||||
int id;
|
||||
std::string namespaceName;
|
||||
int id;
|
||||
std::string namespaceName;
|
||||
};
|
||||
|
||||
struct DeferredcastData {
|
||||
int id;
|
||||
std::string namespaceName;
|
||||
int id;
|
||||
std::string namespaceName;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -89,14 +89,14 @@ struct DeferredcastData {
|
||||
* a reference surface together with a height offset from that reference surface.
|
||||
*/
|
||||
struct SurfacePositionHandle {
|
||||
/// Vector from the center of the object to the reference surface of the object
|
||||
glm::dvec3 centerToReferenceSurface;
|
||||
/// Direction out from the reference. Can conincide with the surface normal but does
|
||||
/// not have to.
|
||||
glm::dvec3 referenceSurfaceOutDirection;
|
||||
/// Height from the reference surface out to the actual surface in the direction of
|
||||
/// the surface normal. Can be positive or negative.
|
||||
double heightToSurface;
|
||||
/// Vector from the center of the object to the reference surface of the object
|
||||
glm::dvec3 centerToReferenceSurface;
|
||||
/// Direction out from the reference. Can conincide with the surface normal but does
|
||||
/// not have to.
|
||||
glm::dvec3 referenceSurfaceOutDirection;
|
||||
/// Height from the reference surface out to the actual surface in the direction of
|
||||
/// the surface normal. Can be positive or negative.
|
||||
double heightToSurface;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*****************************************************************************************
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
@@ -22,8 +22,8 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSAPCE_MODULE_ATMOSPHERE___ATMOSPHERE_MODULE___H__
|
||||
#define __OPENSAPCE_MODULE_ATMOSPHERE___ATMOSPHERE_MODULE___H__
|
||||
#ifndef __OPENSPACE_MODULE_ATMOSPHERE___ATMOSPHERE_MODULE___H__
|
||||
#define __OPENSPACE_MODULE_ATMOSPHERE___ATMOSPHERE_MODULE___H__
|
||||
|
||||
#include <openspace/util/openspacemodule.h>
|
||||
#include <openspace/properties/scalar/floatproperty.h>
|
||||
@@ -38,4 +38,4 @@ public:
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OPENSAPCE_MODULE_ATMOSPHERE___ATMOSPHERE_MODULE___H__
|
||||
#endif // __OPENSPACE_MODULE_ATMOSPHERE___ATMOSPHERE_MODULE___H__
|
||||
|
||||
@@ -85,11 +85,14 @@
|
||||
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "AtmosphereDeferredcaster";
|
||||
const char* _loggerCat = "AtmosphereDeferredcaster";
|
||||
const char* GlslDeferredcastPath = "${MODULES}/atmosphere/shaders/atmosphere_deferred_fs.glsl";
|
||||
const char* GlslDeferredcastFSPath = "${MODULES}/atmosphere/shaders/atmosphere_deferred_fs.glsl";
|
||||
const char* GlslDeferredcastVsPath = "${MODULES}/atmosphere/shaders/atmosphere_deferred_vs.glsl";
|
||||
}
|
||||
|
||||
const float ATM_EPS = 2.0;
|
||||
const float KM_TO_M = 1000.0;
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
@@ -154,8 +157,6 @@ AtmosphereDeferredcaster::AtmosphereDeferredcaster()
|
||||
|
||||
{}
|
||||
|
||||
AtmosphereDeferredcaster::~AtmosphereDeferredcaster() {}
|
||||
|
||||
void AtmosphereDeferredcaster::initialize()
|
||||
{
|
||||
if (!_atmosphereCalculated) {
|
||||
@@ -167,42 +168,16 @@ void AtmosphereDeferredcaster::deinitialize()
|
||||
{
|
||||
RenderEngine& renderEngine = OsEng.renderEngine();
|
||||
|
||||
if (_transmittanceProgramObject) {
|
||||
_transmittanceProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_irradianceProgramObject) {
|
||||
_irradianceProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_irradianceSupTermsProgramObject) {
|
||||
_irradianceSupTermsProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_inScatteringProgramObject) {
|
||||
_inScatteringProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_inScatteringSupTermsProgramObject) {
|
||||
_inScatteringSupTermsProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_deltaEProgramObject) {
|
||||
_deltaEProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_deltaSProgramObject) {
|
||||
_deltaSProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_deltaSSupTermsProgramObject) {
|
||||
_deltaSSupTermsProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_deltaJProgramObject) {
|
||||
_deltaJProgramObject = nullptr;
|
||||
}
|
||||
|
||||
_transmittanceProgramObject = nullptr;
|
||||
_irradianceProgramObject = nullptr;
|
||||
_irradianceSupTermsProgramObject = nullptr;
|
||||
_inScatteringProgramObject = nullptr;
|
||||
_inScatteringSupTermsProgramObject = nullptr;
|
||||
_deltaEProgramObject = nullptr;
|
||||
_deltaSProgramObject = nullptr;
|
||||
_deltaSSupTermsProgramObject = nullptr;
|
||||
_deltaJProgramObject = nullptr;
|
||||
|
||||
glDeleteTextures(1, &_transmittanceTableTexture);
|
||||
glDeleteTextures(1, &_irradianceTableTexture);
|
||||
glDeleteTextures(1, &_inScatteringTableTexture);
|
||||
@@ -214,7 +189,7 @@ void AtmosphereDeferredcaster::deinitialize()
|
||||
|
||||
}
|
||||
|
||||
void AtmosphereDeferredcaster::preRaycast(const RenderData & renderData, const DeferredcastData& deferredData,
|
||||
void AtmosphereDeferredcaster::preRaycast(const RenderData& renderData, const DeferredcastData& deferredData,
|
||||
ghoul::opengl::ProgramObject& program)
|
||||
{
|
||||
// Atmosphere Frustum Culling
|
||||
@@ -225,7 +200,7 @@ void AtmosphereDeferredcaster::preRaycast(const RenderData & renderData, const D
|
||||
}
|
||||
else {
|
||||
glm::dmat4 MV = glm::dmat4(renderData.camera.sgctInternal.projectionMatrix()) * renderData.camera.combinedViewMatrix();
|
||||
if (!isAtmosphereInFrustum(glm::value_ptr(MV), tPlanetPosWorld, (_atmosphereRadius + 2.0)*1000.0)) {
|
||||
if (!isAtmosphereInFrustum(glm::value_ptr(MV), tPlanetPosWorld, (_atmosphereRadius + ATM_EPS)*KM_TO_M)) {
|
||||
program.setUniform("cullAtmosphere", 1);
|
||||
}
|
||||
else {
|
||||
@@ -240,7 +215,7 @@ void AtmosphereDeferredcaster::preRaycast(const RenderData & renderData, const D
|
||||
program.setUniform("betaMieExtinction", _mieExtinctionCoeff);
|
||||
program.setUniform("mieG", _miePhaseConstant);
|
||||
program.setUniform("sunRadiance", _sunRadianceIntensity);
|
||||
program.setUniform("ozoneLayerEnabled", (bool)_ozoneEnabled);
|
||||
program.setUniform("ozoneLayerEnabled", _ozoneEnabled);
|
||||
program.setUniform("HO", _ozoneHeightScale);
|
||||
program.setUniform("betaOzoneExtinction", _ozoneExtinctionCoeff);
|
||||
|
||||
@@ -249,16 +224,16 @@ void AtmosphereDeferredcaster::preRaycast(const RenderData & renderData, const D
|
||||
program.setUniform("gamma", _gammaConstant);
|
||||
program.setUniform("RenderableClass", static_cast<int>(_renderableClass));
|
||||
|
||||
program.setUniform("TRANSMITTANCE_W", (int)_transmittance_table_width);
|
||||
program.setUniform("TRANSMITTANCE_H", (int)_transmittance_table_height);
|
||||
program.setUniform("SKY_W", (int)_irradiance_table_width);
|
||||
program.setUniform("SKY_H", (int)_irradiance_table_height);
|
||||
program.setUniform("OTHER_TEXTURES_W", (int)_delta_e_table_width);
|
||||
program.setUniform("OTHER_TEXTURES_H", (int)_delta_e_table_height);
|
||||
program.setUniform("SAMPLES_R", (int)_r_samples);
|
||||
program.setUniform("SAMPLES_MU", (int)_mu_samples);
|
||||
program.setUniform("SAMPLES_MU_S", (int)_mu_s_samples);
|
||||
program.setUniform("SAMPLES_NU", (int)_nu_samples);
|
||||
program.setUniform("TRANSMITTANCE_W", _transmittance_table_width);
|
||||
program.setUniform("TRANSMITTANCE_H", _transmittance_table_height);
|
||||
program.setUniform("SKY_W", _irradiance_table_width);
|
||||
program.setUniform("SKY_H", _irradiance_table_height);
|
||||
program.setUniform("OTHER_TEXTURES_W", _delta_e_table_width);
|
||||
program.setUniform("OTHER_TEXTURES_H", _delta_e_table_height);
|
||||
program.setUniform("SAMPLES_R", _r_samples);
|
||||
program.setUniform("SAMPLES_MU", _mu_samples);
|
||||
program.setUniform("SAMPLES_MU_S", _mu_s_samples);
|
||||
program.setUniform("SAMPLES_NU", _nu_samples);
|
||||
|
||||
program.setUniform("ModelTransformMatrix", _modelTransform);
|
||||
|
||||
@@ -329,7 +304,7 @@ void AtmosphereDeferredcaster::preRaycast(const RenderData & renderData, const D
|
||||
program.setUniform("inscatterTexture", _inScatteringTableTextureUnit);
|
||||
}
|
||||
|
||||
void AtmosphereDeferredcaster::postRaycast(const RenderData & renderData, const DeferredcastData& deferredData,
|
||||
void AtmosphereDeferredcaster::postRaycast(const RenderData& renderData, const DeferredcastData& deferredData,
|
||||
ghoul::opengl::ProgramObject& program)
|
||||
{
|
||||
// Deactivate the texture units
|
||||
@@ -338,23 +313,23 @@ void AtmosphereDeferredcaster::postRaycast(const RenderData & renderData, const
|
||||
_inScatteringTableTextureUnit.deactivate();
|
||||
}
|
||||
|
||||
std::string AtmosphereDeferredcaster::getDeferredcastPath() const {
|
||||
std::string AtmosphereDeferredcaster::deferredcastPath() const {
|
||||
return GlslDeferredcastPath;
|
||||
}
|
||||
|
||||
std::string AtmosphereDeferredcaster::getDeferredcastFSPath() const {
|
||||
std::string AtmosphereDeferredcaster::deferredcastFSPath() const {
|
||||
return GlslDeferredcastFSPath;
|
||||
}
|
||||
|
||||
std::string AtmosphereDeferredcaster::getDeferredcastVSPath() const {
|
||||
std::string AtmosphereDeferredcaster::deferredcastVSPath() const {
|
||||
return GlslDeferredcastVsPath;
|
||||
}
|
||||
|
||||
std::string AtmosphereDeferredcaster::getHelperPath() const {
|
||||
std::string AtmosphereDeferredcaster::helperPath() const {
|
||||
return ""; // no helper file
|
||||
}
|
||||
|
||||
void AtmosphereDeferredcaster::setModelTransform(const glm::dmat4 &transform) {
|
||||
void AtmosphereDeferredcaster::setModelTransform(const glm::dmat4& transform) {
|
||||
_modelTransform = transform;
|
||||
}
|
||||
|
||||
@@ -459,428 +434,157 @@ void AtmosphereDeferredcaster::enablePrecalculationTexturesSaving() {
|
||||
}
|
||||
|
||||
void AtmosphereDeferredcaster::loadComputationPrograms() {
|
||||
|
||||
RenderEngine& renderEngine = OsEng.renderEngine();
|
||||
|
||||
//============== Transmittance T =================
|
||||
if (_transmittanceProgramObject == nullptr) {
|
||||
if (!_transmittanceProgramObject) {
|
||||
_transmittanceProgramObject = ghoul::opengl::ProgramObject::Build(
|
||||
"transmittanceCalcProgram",
|
||||
"${MODULE_ATMOSPHERE}/shaders/transmittance_calc_vs.glsl",
|
||||
"${MODULE_ATMOSPHERE}/shaders/transmittance_calc_fs.glsl");
|
||||
if (!_transmittanceProgramObject) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
using IgnoreError = ghoul::opengl::ProgramObject::IgnoreError;
|
||||
_transmittanceProgramObject->setIgnoreSubroutineUniformLocationError(IgnoreError::Yes);
|
||||
_transmittanceProgramObject->setIgnoreUniformLocationError(IgnoreError::Yes);
|
||||
|
||||
//============== Irradiance E =================
|
||||
if (_irradianceProgramObject == nullptr) {
|
||||
if (!_irradianceProgramObject) {
|
||||
_irradianceProgramObject = ghoul::opengl::ProgramObject::Build(
|
||||
"irradianceCalcProgram",
|
||||
"${MODULE_ATMOSPHERE}/shaders/irradiance_calc_vs.glsl",
|
||||
"${MODULE_ATMOSPHERE}/shaders/irradiance_calc_fs.glsl");
|
||||
if (!_irradianceProgramObject) {
|
||||
if (_transmittanceProgramObject) {
|
||||
_transmittanceProgramObject.reset();
|
||||
_transmittanceProgramObject = nullptr;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
"${MODULE_ATMOSPHERE}/shaders/irradiance_calc_fs.glsl");
|
||||
}
|
||||
_irradianceProgramObject->setIgnoreSubroutineUniformLocationError(IgnoreError::Yes);
|
||||
_irradianceProgramObject->setIgnoreUniformLocationError(IgnoreError::Yes);
|
||||
|
||||
if (_irradianceSupTermsProgramObject == nullptr) {
|
||||
if (!_irradianceSupTermsProgramObject) {
|
||||
_irradianceSupTermsProgramObject = ghoul::opengl::ProgramObject::Build(
|
||||
"irradianceSupTermsCalcProgram",
|
||||
"${MODULE_ATMOSPHERE}/shaders/irradiance_sup_calc_vs.glsl",
|
||||
"${MODULE_ATMOSPHERE}/shaders/irradiance_sup_calc_fs.glsl");
|
||||
if (!_irradianceSupTermsProgramObject) {
|
||||
if (_transmittanceProgramObject) {
|
||||
_transmittanceProgramObject.reset();
|
||||
_transmittanceProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_irradianceProgramObject) {
|
||||
_irradianceProgramObject.reset();
|
||||
_irradianceProgramObject = nullptr;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
_irradianceSupTermsProgramObject->setIgnoreSubroutineUniformLocationError(IgnoreError::Yes);
|
||||
_irradianceSupTermsProgramObject->setIgnoreUniformLocationError(IgnoreError::Yes);
|
||||
|
||||
//============== InScattering S =================
|
||||
if (_inScatteringProgramObject == nullptr) {
|
||||
if (!_inScatteringProgramObject) {
|
||||
_inScatteringProgramObject = ghoul::opengl::ProgramObject::Build(
|
||||
"inScatteringCalcProgram",
|
||||
"${MODULE_ATMOSPHERE}/shaders/inScattering_calc_vs.glsl",
|
||||
"${MODULE_ATMOSPHERE}/shaders/inScattering_calc_fs.glsl",
|
||||
"${MODULE_ATMOSPHERE}/shaders/inScattering_calc_gs.glsl");
|
||||
if (!_inScatteringProgramObject) {
|
||||
if (_transmittanceProgramObject) {
|
||||
_transmittanceProgramObject.reset();
|
||||
_transmittanceProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_irradianceProgramObject) {
|
||||
_irradianceProgramObject.reset();
|
||||
_irradianceProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_irradianceSupTermsProgramObject) {
|
||||
_irradianceSupTermsProgramObject.reset();
|
||||
_irradianceSupTermsProgramObject = nullptr;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
_inScatteringProgramObject->setIgnoreSubroutineUniformLocationError(IgnoreError::Yes);
|
||||
_inScatteringProgramObject->setIgnoreUniformLocationError(IgnoreError::Yes);
|
||||
|
||||
if (_inScatteringSupTermsProgramObject == nullptr) {
|
||||
if (!_inScatteringSupTermsProgramObject) {
|
||||
_inScatteringSupTermsProgramObject = ghoul::opengl::ProgramObject::Build(
|
||||
"inScatteringSupTermsCalcProgram",
|
||||
"${MODULE_ATMOSPHERE}/shaders/inScattering_sup_calc_vs.glsl",
|
||||
"${MODULE_ATMOSPHERE}/shaders/inScattering_sup_calc_fs.glsl",
|
||||
"${MODULE_ATMOSPHERE}/shaders/inScattering_sup_calc_gs.glsl");
|
||||
if (!_inScatteringSupTermsProgramObject) {
|
||||
if (_transmittanceProgramObject) {
|
||||
_transmittanceProgramObject.reset();
|
||||
_transmittanceProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_irradianceProgramObject) {
|
||||
_irradianceProgramObject.reset();
|
||||
_irradianceProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_irradianceSupTermsProgramObject) {
|
||||
_irradianceSupTermsProgramObject.reset();
|
||||
_irradianceSupTermsProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_inScatteringProgramObject) {
|
||||
_inScatteringProgramObject.reset();
|
||||
_inScatteringProgramObject = nullptr;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
_inScatteringSupTermsProgramObject->setIgnoreSubroutineUniformLocationError(IgnoreError::Yes);
|
||||
_inScatteringSupTermsProgramObject->setIgnoreUniformLocationError(IgnoreError::Yes);
|
||||
|
||||
//============== Delta E =================
|
||||
if (_deltaEProgramObject == nullptr) {
|
||||
if (!_deltaEProgramObject) {
|
||||
_deltaEProgramObject = ghoul::opengl::ProgramObject::Build(
|
||||
"deltaECalcProgram",
|
||||
"${MODULE_ATMOSPHERE}/shaders/deltaE_calc_vs.glsl",
|
||||
"${MODULE_ATMOSPHERE}/shaders/deltaE_calc_fs.glsl");
|
||||
if (!_deltaEProgramObject) {
|
||||
if (_transmittanceProgramObject) {
|
||||
_transmittanceProgramObject.reset();
|
||||
_transmittanceProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_irradianceProgramObject) {
|
||||
_irradianceProgramObject.reset();
|
||||
_irradianceProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_irradianceSupTermsProgramObject) {
|
||||
_irradianceSupTermsProgramObject.reset();
|
||||
_irradianceSupTermsProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_inScatteringProgramObject) {
|
||||
_inScatteringProgramObject.reset();
|
||||
_inScatteringProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_inScatteringSupTermsProgramObject) {
|
||||
_inScatteringSupTermsProgramObject.reset();
|
||||
_inScatteringSupTermsProgramObject = nullptr;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
_deltaEProgramObject->setIgnoreSubroutineUniformLocationError(IgnoreError::Yes);
|
||||
_deltaEProgramObject->setIgnoreUniformLocationError(IgnoreError::Yes);
|
||||
|
||||
//============== Irradiance finel E =================
|
||||
if (_irradianceFinalProgramObject == nullptr) {
|
||||
if (!_irradianceFinalProgramObject) {
|
||||
_irradianceFinalProgramObject = ghoul::opengl::ProgramObject::Build(
|
||||
"irradianceEFinalProgram",
|
||||
"${MODULE_ATMOSPHERE}/shaders/irradiance_final_vs.glsl",
|
||||
"${MODULE_ATMOSPHERE}/shaders/irradiance_final_fs.glsl");
|
||||
if (!_irradianceFinalProgramObject) {
|
||||
if (_transmittanceProgramObject) {
|
||||
_transmittanceProgramObject.reset();
|
||||
_transmittanceProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_irradianceProgramObject) {
|
||||
_irradianceProgramObject.reset();
|
||||
_irradianceProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_irradianceSupTermsProgramObject) {
|
||||
_irradianceSupTermsProgramObject.reset();
|
||||
_irradianceSupTermsProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_inScatteringProgramObject) {
|
||||
_inScatteringProgramObject.reset();
|
||||
_inScatteringProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_inScatteringSupTermsProgramObject) {
|
||||
_inScatteringSupTermsProgramObject.reset();
|
||||
_inScatteringSupTermsProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_deltaEProgramObject) {
|
||||
_deltaEProgramObject.reset();
|
||||
_deltaEProgramObject = nullptr;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
_irradianceFinalProgramObject->setIgnoreSubroutineUniformLocationError(IgnoreError::Yes);
|
||||
_irradianceFinalProgramObject->setIgnoreUniformLocationError(IgnoreError::Yes);
|
||||
|
||||
//============== Delta S =================
|
||||
if (_deltaSProgramObject == nullptr) {
|
||||
if (!_deltaSProgramObject) {
|
||||
_deltaSProgramObject = ghoul::opengl::ProgramObject::Build(
|
||||
"deltaSCalcProgram",
|
||||
"${MODULE_ATMOSPHERE}/shaders/deltaS_calc_vs.glsl",
|
||||
"${MODULE_ATMOSPHERE}/shaders/deltaS_calc_fs.glsl",
|
||||
"${MODULE_ATMOSPHERE}/shaders/deltaS_calc_gs.glsl");
|
||||
if (!_deltaSProgramObject) {
|
||||
if (_transmittanceProgramObject) {
|
||||
_transmittanceProgramObject.reset();
|
||||
_transmittanceProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_irradianceProgramObject) {
|
||||
_irradianceProgramObject.reset();
|
||||
_irradianceProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_irradianceSupTermsProgramObject) {
|
||||
_irradianceSupTermsProgramObject.reset();
|
||||
_irradianceSupTermsProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_inScatteringProgramObject) {
|
||||
_inScatteringProgramObject.reset();
|
||||
_inScatteringProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_inScatteringSupTermsProgramObject) {
|
||||
_inScatteringSupTermsProgramObject.reset();
|
||||
_inScatteringSupTermsProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_deltaEProgramObject) {
|
||||
_deltaEProgramObject.reset();
|
||||
_deltaEProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_irradianceFinalProgramObject) {
|
||||
_irradianceFinalProgramObject.reset();
|
||||
_irradianceFinalProgramObject = nullptr;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
_deltaSProgramObject->setIgnoreSubroutineUniformLocationError(IgnoreError::Yes);
|
||||
_deltaSProgramObject->setIgnoreUniformLocationError(IgnoreError::Yes);
|
||||
|
||||
if (_deltaSSupTermsProgramObject == nullptr) {
|
||||
if (!_deltaSSupTermsProgramObject) {
|
||||
_deltaSSupTermsProgramObject = ghoul::opengl::ProgramObject::Build(
|
||||
"deltaSSUPTermsCalcProgram",
|
||||
"${MODULE_ATMOSPHERE}/shaders/deltaS_sup_calc_vs.glsl",
|
||||
"${MODULE_ATMOSPHERE}/shaders/deltaS_sup_calc_fs.glsl",
|
||||
"${MODULE_ATMOSPHERE}/shaders/deltaS_sup_calc_gs.glsl");
|
||||
if (!_deltaSSupTermsProgramObject) {
|
||||
if (_transmittanceProgramObject) {
|
||||
_transmittanceProgramObject.reset();
|
||||
_transmittanceProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_irradianceProgramObject) {
|
||||
_irradianceProgramObject.reset();
|
||||
_irradianceProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_irradianceSupTermsProgramObject) {
|
||||
_irradianceSupTermsProgramObject.reset();
|
||||
_irradianceSupTermsProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_inScatteringProgramObject) {
|
||||
_inScatteringProgramObject.reset();
|
||||
_inScatteringProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_inScatteringSupTermsProgramObject) {
|
||||
_inScatteringSupTermsProgramObject.reset();
|
||||
_inScatteringSupTermsProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_deltaEProgramObject) {
|
||||
_deltaEProgramObject.reset();
|
||||
_deltaEProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_irradianceFinalProgramObject) {
|
||||
_irradianceFinalProgramObject.reset();
|
||||
_irradianceFinalProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_deltaSProgramObject) {
|
||||
_deltaSProgramObject.reset();
|
||||
_deltaSProgramObject = nullptr;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
_deltaSSupTermsProgramObject->setIgnoreSubroutineUniformLocationError(IgnoreError::Yes);
|
||||
_deltaSSupTermsProgramObject->setIgnoreUniformLocationError(IgnoreError::Yes);
|
||||
|
||||
//============== Delta J (Radiance Scattered) =================
|
||||
if (_deltaJProgramObject == nullptr) {
|
||||
if (!_deltaJProgramObject) {
|
||||
_deltaJProgramObject = ghoul::opengl::ProgramObject::Build(
|
||||
"deltaJCalcProgram",
|
||||
"${MODULE_ATMOSPHERE}/shaders/deltaJ_calc_vs.glsl",
|
||||
"${MODULE_ATMOSPHERE}/shaders/deltaJ_calc_fs.glsl",
|
||||
"${MODULE_ATMOSPHERE}/shaders/deltaJ_calc_gs.glsl");
|
||||
if (!_deltaJProgramObject) {
|
||||
if (_transmittanceProgramObject) {
|
||||
_transmittanceProgramObject.reset();
|
||||
_transmittanceProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_irradianceProgramObject) {
|
||||
_irradianceProgramObject.reset();
|
||||
_irradianceProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_irradianceSupTermsProgramObject) {
|
||||
_irradianceSupTermsProgramObject.reset();
|
||||
_irradianceSupTermsProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_inScatteringProgramObject) {
|
||||
_inScatteringProgramObject.reset();
|
||||
_inScatteringProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_inScatteringSupTermsProgramObject) {
|
||||
_inScatteringSupTermsProgramObject.reset();
|
||||
_inScatteringSupTermsProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_deltaEProgramObject) {
|
||||
_deltaEProgramObject.reset();
|
||||
_deltaEProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_irradianceFinalProgramObject) {
|
||||
_irradianceFinalProgramObject.reset();
|
||||
_irradianceFinalProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_deltaSProgramObject) {
|
||||
_deltaSProgramObject.reset();
|
||||
_deltaSProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_deltaSSupTermsProgramObject) {
|
||||
_deltaSSupTermsProgramObject.reset();
|
||||
_deltaSSupTermsProgramObject = nullptr;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
_deltaJProgramObject->setIgnoreSubroutineUniformLocationError(IgnoreError::Yes);
|
||||
_deltaJProgramObject->setIgnoreUniformLocationError(IgnoreError::Yes);
|
||||
}
|
||||
|
||||
void AtmosphereDeferredcaster::unloadComputationPrograms() {
|
||||
|
||||
RenderEngine& renderEngine = OsEng.renderEngine();
|
||||
|
||||
if (_transmittanceProgramObject) {
|
||||
_transmittanceProgramObject.reset();
|
||||
_transmittanceProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_irradianceProgramObject) {
|
||||
_irradianceProgramObject.reset();
|
||||
_irradianceProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_irradianceSupTermsProgramObject) {
|
||||
_irradianceSupTermsProgramObject.reset();
|
||||
_irradianceSupTermsProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_inScatteringProgramObject) {
|
||||
_inScatteringProgramObject.reset();
|
||||
_inScatteringProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_inScatteringSupTermsProgramObject) {
|
||||
_inScatteringSupTermsProgramObject.reset();
|
||||
_inScatteringSupTermsProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_deltaEProgramObject) {
|
||||
_deltaEProgramObject.reset();
|
||||
_deltaEProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_irradianceFinalProgramObject) {
|
||||
_irradianceFinalProgramObject.reset();
|
||||
_irradianceFinalProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_deltaSProgramObject) {
|
||||
_deltaSProgramObject.reset();
|
||||
_deltaSProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_deltaSSupTermsProgramObject) {
|
||||
_deltaSSupTermsProgramObject.reset();
|
||||
_deltaSSupTermsProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_deltaJProgramObject) {
|
||||
_deltaJProgramObject.reset();
|
||||
_deltaJProgramObject = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void AtmosphereDeferredcaster::createComputationTextures() {
|
||||
|
||||
//========== Create Atmosphere Tables (textures) ==============
|
||||
|
||||
if (!_atmosphereCalculated) {
|
||||
//============== Transmittance =================
|
||||
ghoul::opengl::TextureUnit transmittanceTableTextureUnit;
|
||||
@@ -1143,10 +847,12 @@ void AtmosphereDeferredcaster::executeCalculations(const GLuint quadCalcVAO,
|
||||
checkFrameBufferState("_deltaJTableTexture");
|
||||
glViewport(0, 0, _mu_s_samples * _nu_samples, _mu_samples);
|
||||
_deltaJProgramObject->activate();
|
||||
if (scatteringOrder == 2)
|
||||
if (scatteringOrder == 2) {
|
||||
_deltaJProgramObject->setUniform("firstIteraction", 1);
|
||||
else
|
||||
}
|
||||
else {
|
||||
_deltaJProgramObject->setUniform("firstIteraction", 0);
|
||||
}
|
||||
transmittanceTableTextureUnit.activate();
|
||||
glBindTexture(GL_TEXTURE_2D, _transmittanceTableTexture);
|
||||
_deltaJProgramObject->setUniform("transmittanceTexture", transmittanceTableTextureUnit);
|
||||
@@ -1177,10 +883,12 @@ void AtmosphereDeferredcaster::executeCalculations(const GLuint quadCalcVAO,
|
||||
checkFrameBufferState("_deltaETableTexture");
|
||||
glViewport(0, 0, _delta_e_table_width, _delta_e_table_height);
|
||||
_irradianceSupTermsProgramObject->activate();
|
||||
if (scatteringOrder == 2)
|
||||
if (scatteringOrder == 2) {
|
||||
_irradianceSupTermsProgramObject->setUniform("firstIteraction", (int)1);
|
||||
else
|
||||
}
|
||||
else {
|
||||
_irradianceSupTermsProgramObject->setUniform("firstIteraction", (int)0);
|
||||
}
|
||||
transmittanceTableTextureUnit.activate();
|
||||
glBindTexture(GL_TEXTURE_2D, _transmittanceTableTexture);
|
||||
_irradianceSupTermsProgramObject->setUniform("transmittanceTexture", transmittanceTableTextureUnit);
|
||||
@@ -1279,21 +987,7 @@ void AtmosphereDeferredcaster::executeCalculations(const GLuint quadCalcVAO,
|
||||
|
||||
}
|
||||
|
||||
void AtmosphereDeferredcaster::preCalculateAtmosphereParam()
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "\n\n==== Atmosphere Values Used in Pre-Computation ====\n"
|
||||
<< "Atmosphere Radius: " << _atmosphereRadius << std::endl
|
||||
<< "Planet Radius: " << _atmospherePlanetRadius << std::endl
|
||||
<< "Average Reflection: " << _planetAverageGroundReflectance << std::endl
|
||||
<< "Rayleigh HR: " << _rayleighHeightScale << std::endl
|
||||
<< "Mie HR: " << _mieHeightScale << std::endl
|
||||
<< "Mie G phase constant: " << _miePhaseConstant << std::endl
|
||||
<< "Mie Extinction coeff: " << glm::to_string(_mieExtinctionCoeff) << std::endl
|
||||
<< "Rayleigh Scattering coeff: " << glm::to_string(_rayleighScatteringCoeff) << std::endl
|
||||
<< "Mie Scattering coeff: " << glm::to_string(_mieScatteringCoeff) << std::endl;
|
||||
std::cout << ss.str() << std::endl;
|
||||
|
||||
void AtmosphereDeferredcaster::preCalculateAtmosphereParam() {
|
||||
//==========================================================
|
||||
//========= Load Shader Programs for Calculations ==========
|
||||
//==========================================================
|
||||
@@ -1351,7 +1045,7 @@ void AtmosphereDeferredcaster::resetAtmosphereTextures()
|
||||
|
||||
}
|
||||
|
||||
void AtmosphereDeferredcaster::createRenderQuad(GLuint * vao, GLuint * vbo,
|
||||
void AtmosphereDeferredcaster::createRenderQuad(GLuint* vao, GLuint* vbo,
|
||||
const GLfloat size) {
|
||||
|
||||
glGenVertexArrays(1, vao);
|
||||
@@ -1376,7 +1070,7 @@ void AtmosphereDeferredcaster::createRenderQuad(GLuint * vao, GLuint * vbo,
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
void AtmosphereDeferredcaster::loadAtmosphereDataIntoShaderProgram(std::unique_ptr<ghoul::opengl::ProgramObject> & shaderProg) {
|
||||
void AtmosphereDeferredcaster::loadAtmosphereDataIntoShaderProgram(std::unique_ptr<ghoul::opengl::ProgramObject>& shaderProg) {
|
||||
shaderProg->setUniform("Rg", _atmospherePlanetRadius);
|
||||
shaderProg->setUniform("Rt", _atmosphereRadius);
|
||||
shaderProg->setUniform("AverageGroundReflectance", _planetAverageGroundReflectance);
|
||||
@@ -1453,16 +1147,14 @@ void AtmosphereDeferredcaster::checkFrameBufferState(const std::string & codePos
|
||||
}
|
||||
}
|
||||
|
||||
void AtmosphereDeferredcaster::renderQuadForCalc(const GLuint vao, const GLsizei numberOfVertices)
|
||||
{
|
||||
void AtmosphereDeferredcaster::renderQuadForCalc(const GLuint vao, const GLsizei numberOfVertices) {
|
||||
glBindVertexArray(vao);
|
||||
glDrawArrays(GL_TRIANGLES, 0, numberOfVertices);
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
void AtmosphereDeferredcaster::step3DTexture(std::unique_ptr<ghoul::opengl::ProgramObject> & shaderProg,
|
||||
const int layer, const bool doCalc)
|
||||
{
|
||||
void AtmosphereDeferredcaster::step3DTexture(std::unique_ptr<ghoul::opengl::ProgramObject>& shaderProg,
|
||||
const int layer, const bool doCalc) {
|
||||
// See OpenGL redbook 8th Edition page 556 for Layered Rendering
|
||||
if (doCalc)
|
||||
{
|
||||
@@ -1592,4 +1284,4 @@ bool AtmosphereDeferredcaster::isAtmosphereInFrustum(const double * MVMatrix, co
|
||||
return true;
|
||||
}
|
||||
|
||||
} // openspace
|
||||
} // namespace openspace
|
||||
|
||||
@@ -33,11 +33,10 @@
|
||||
|
||||
//#include <ghoul/opengl/textureunit.h>
|
||||
|
||||
namespace ghoul {
|
||||
namespace opengl {
|
||||
class Texture;
|
||||
class ProgramObject;
|
||||
}
|
||||
namespace ghoul::opengl {
|
||||
class Texture;
|
||||
class ProgramObject;
|
||||
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
@@ -45,8 +44,7 @@ namespace openspace {
|
||||
struct RenderData;
|
||||
struct DeferredcastData;
|
||||
|
||||
class AtmosphereDeferredcaster : public Deferredcaster
|
||||
{
|
||||
class AtmosphereDeferredcaster : public Deferredcaster {
|
||||
public:
|
||||
enum AtmospherRenderableClass {
|
||||
NoRenderableClass = 0,
|
||||
@@ -54,21 +52,20 @@ public:
|
||||
RenderableGlobe = 2
|
||||
};
|
||||
|
||||
public:
|
||||
AtmosphereDeferredcaster();
|
||||
virtual ~AtmosphereDeferredcaster();
|
||||
virtual ~AtmosphereDeferredcaster() = default;
|
||||
|
||||
void initialize();
|
||||
void deinitialize();
|
||||
void preRaycast(const RenderData & renderData, const DeferredcastData& deferredData,
|
||||
void preRaycast(const RenderData& renderData, const DeferredcastData& deferredData,
|
||||
ghoul::opengl::ProgramObject& program) override;
|
||||
void postRaycast(const RenderData & renderData, const DeferredcastData& deferredData,
|
||||
void postRaycast(const RenderData& renderData, const DeferredcastData& deferredData,
|
||||
ghoul::opengl::ProgramObject& program) override;
|
||||
|
||||
std::string getDeferredcastPath() const override;
|
||||
std::string getDeferredcastVSPath() const override;
|
||||
std::string getDeferredcastFSPath() const override;
|
||||
std::string getHelperPath() const override;
|
||||
std::string deferredcastPath() const override;
|
||||
std::string deferredcastVSPath() const override;
|
||||
std::string deferredcastFSPath() const override;
|
||||
std::string helperPath() const override;
|
||||
|
||||
void preCalculateAtmosphereParam();
|
||||
|
||||
@@ -119,7 +116,6 @@ private:
|
||||
const int width, const int height) const;
|
||||
bool isAtmosphereInFrustum(const double * MVMatrix, const glm::dvec3 position, const double radius) const;
|
||||
|
||||
private:
|
||||
|
||||
const double DISTANCE_CULLING = 1e10;
|
||||
|
||||
@@ -180,16 +176,16 @@ private:
|
||||
GLuint _atmosphereRenderVBO;
|
||||
|
||||
// Atmosphere Textures Dimmensions
|
||||
unsigned int _transmittance_table_width;
|
||||
unsigned int _transmittance_table_height;
|
||||
unsigned int _irradiance_table_width;
|
||||
unsigned int _irradiance_table_height;
|
||||
unsigned int _delta_e_table_width;
|
||||
unsigned int _delta_e_table_height;
|
||||
unsigned int _r_samples;
|
||||
unsigned int _mu_samples;
|
||||
unsigned int _mu_s_samples;
|
||||
unsigned int _nu_samples;
|
||||
int _transmittance_table_width;
|
||||
int _transmittance_table_height;
|
||||
int _irradiance_table_width;
|
||||
int _irradiance_table_height;
|
||||
int _delta_e_table_width;
|
||||
int _delta_e_table_height;
|
||||
int _r_samples;
|
||||
int _mu_samples;
|
||||
int _mu_s_samples;
|
||||
int _nu_samples;
|
||||
|
||||
|
||||
glm::dmat4 _modelTransform;
|
||||
|
||||
@@ -311,21 +311,18 @@ namespace openspace {
|
||||
bool success = dictionary.getValue(keyShadowGroup, shadowDictionary);
|
||||
bool disableShadows = false;
|
||||
if (success) {
|
||||
std::vector< std::pair<std::string, float > > sourceArray;
|
||||
std::vector<std::pair<std::string, float>> sourceArray;
|
||||
unsigned int sourceCounter = 1;
|
||||
while (success) {
|
||||
std::string sourceName;
|
||||
std::stringstream ss;
|
||||
ss << keyShadowSource << sourceCounter << ".Name";
|
||||
success = shadowDictionary.getValue(ss.str(), sourceName);
|
||||
success = shadowDictionary.getValue(keyShadowSource +
|
||||
std::to_string(sourceCounter) + ".Name", sourceName);
|
||||
if (success) {
|
||||
float sourceRadius;
|
||||
ss.str(std::string());
|
||||
ss << keyShadowSource << sourceCounter << ".Radius";
|
||||
success = shadowDictionary.getValue(ss.str(), sourceRadius);
|
||||
success = shadowDictionary.getValue(keyShadowSource +
|
||||
std::to_string(sourceCounter) + ".Radius", sourceRadius);
|
||||
if (success) {
|
||||
sourceArray.push_back(std::pair< std::string, float>(
|
||||
sourceName, sourceRadius));
|
||||
sourceArray.emplace_back(sourceName, sourceRadius);
|
||||
}
|
||||
else {
|
||||
LWARNING("No Radius value expecified for Shadow Source Name "
|
||||
@@ -340,21 +337,18 @@ namespace openspace {
|
||||
|
||||
if (!disableShadows && !sourceArray.empty()) {
|
||||
success = true;
|
||||
std::vector< std::pair<std::string, float > > casterArray;
|
||||
std::vector<std::pair<std::string, float>> casterArray;
|
||||
unsigned int casterCounter = 1;
|
||||
while (success) {
|
||||
std::string casterName;
|
||||
std::stringstream ss;
|
||||
ss << keyShadowCaster << casterCounter << ".Name";
|
||||
success = shadowDictionary.getValue(ss.str(), casterName);
|
||||
success = shadowDictionary.getValue(keyShadowCaster +
|
||||
std::to_string(casterCounter) + ".Name", casterName);
|
||||
if (success) {
|
||||
float casterRadius;
|
||||
ss.str(std::string());
|
||||
ss << keyShadowCaster << casterCounter << ".Radius";
|
||||
success = shadowDictionary.getValue(ss.str(), casterRadius);
|
||||
success = shadowDictionary.getValue(keyShadowCaster +
|
||||
std::to_string(casterCounter) + ".Radius", casterRadius);
|
||||
if (success) {
|
||||
casterArray.push_back(std::pair< std::string, float>(
|
||||
casterName, casterRadius));
|
||||
casterArray.emplace_back(casterName, casterRadius);
|
||||
}
|
||||
else {
|
||||
LWARNING("No Radius value expecified for Shadow Caster Name "
|
||||
@@ -369,13 +363,14 @@ namespace openspace {
|
||||
}
|
||||
|
||||
if (!disableShadows && (!sourceArray.empty() && !casterArray.empty())) {
|
||||
for (const auto & source : sourceArray)
|
||||
for (const auto & source : sourceArray) {
|
||||
for (const auto & caster : casterArray) {
|
||||
ShadowConf sc;
|
||||
ShadowConfiguration sc;
|
||||
sc.source = source;
|
||||
sc.caster = caster;
|
||||
_shadowConfArray.push_back(sc);
|
||||
}
|
||||
}
|
||||
_shadowEnabled = true;
|
||||
}
|
||||
}
|
||||
@@ -539,88 +534,89 @@ namespace openspace {
|
||||
//============== Atmosphere Properties ===================
|
||||
//========================================================
|
||||
|
||||
_atmosphereHeightP.set(_atmosphereRadius - _atmospherePlanetRadius);
|
||||
_atmosphereHeightP.onChange(std::bind(&RenderableAtmosphere::updateAtmosphereParameters, this));
|
||||
_atmosphereHeightP =_atmosphereRadius - _atmospherePlanetRadius;
|
||||
_atmosphereHeightP.onChange([this](){ updateAtmosphereParameters(); });
|
||||
addProperty(_atmosphereHeightP);
|
||||
|
||||
_groundAverageReflectanceP.set(_planetAverageGroundReflectance);
|
||||
_groundAverageReflectanceP.onChange(std::bind(&RenderableAtmosphere::updateAtmosphereParameters, this));
|
||||
_groundAverageReflectanceP = _planetAverageGroundReflectance;
|
||||
_groundAverageReflectanceP.onChange([this](){ updateAtmosphereParameters(); });
|
||||
addProperty(_groundAverageReflectanceP);
|
||||
|
||||
_rayleighHeightScaleP.set(_rayleighHeightScale);
|
||||
_rayleighHeightScaleP.onChange(std::bind(&RenderableAtmosphere::updateAtmosphereParameters, this));
|
||||
_rayleighHeightScaleP = _rayleighHeightScale;
|
||||
_rayleighHeightScaleP.onChange([this](){ updateAtmosphereParameters(); });
|
||||
addProperty(_rayleighHeightScaleP);
|
||||
|
||||
_rayleighScatteringCoeffXP.set(_rayleighScatteringCoeff.x * 1000.0f);
|
||||
_rayleighScatteringCoeffXP.onChange(std::bind(&RenderableAtmosphere::updateAtmosphereParameters, this));
|
||||
_rayleighScatteringCoeffXP = _rayleighScatteringCoeff.x * 1000.0f;
|
||||
_rayleighScatteringCoeffXP.onChange([this](){ updateAtmosphereParameters(); });
|
||||
addProperty(_rayleighScatteringCoeffXP);
|
||||
|
||||
_rayleighScatteringCoeffYP.set(_rayleighScatteringCoeff.y * 1000.0f);
|
||||
_rayleighScatteringCoeffYP.onChange(std::bind(&RenderableAtmosphere::updateAtmosphereParameters, this));
|
||||
_rayleighScatteringCoeffYP = _rayleighScatteringCoeff.y * 1000.0f;
|
||||
_rayleighScatteringCoeffYP.onChange([this](){ updateAtmosphereParameters(); });
|
||||
addProperty(_rayleighScatteringCoeffYP);
|
||||
|
||||
_rayleighScatteringCoeffZP.set(_rayleighScatteringCoeff.z * 1000.0f);
|
||||
_rayleighScatteringCoeffZP.onChange(std::bind(&RenderableAtmosphere::updateAtmosphereParameters, this));
|
||||
_rayleighScatteringCoeffZP = _rayleighScatteringCoeff.z * 1000.0f;
|
||||
_rayleighScatteringCoeffZP.onChange([this](){ updateAtmosphereParameters(); });
|
||||
addProperty(_rayleighScatteringCoeffZP);
|
||||
|
||||
_ozoneEnabledP.set(_ozoneLayerEnabled);
|
||||
_ozoneEnabledP.onChange(std::bind(&RenderableAtmosphere::updateAtmosphereParameters, this));
|
||||
_ozoneEnabledP = _ozoneLayerEnabled;
|
||||
_ozoneEnabledP.onChange([this](){ updateAtmosphereParameters(); });
|
||||
addProperty(_ozoneEnabledP);
|
||||
|
||||
_ozoneHeightScaleP.set(_ozoneHeightScale);
|
||||
_ozoneHeightScaleP.onChange(std::bind(&RenderableAtmosphere::updateAtmosphereParameters, this));
|
||||
_ozoneHeightScaleP = _ozoneHeightScale;
|
||||
_ozoneHeightScaleP.onChange([this](){ updateAtmosphereParameters(); });
|
||||
addProperty(_ozoneHeightScaleP);
|
||||
|
||||
_ozoneCoeffXP.set(_ozoneExtinctionCoeff.x * 100000.0f);
|
||||
_ozoneCoeffXP.onChange(std::bind(&RenderableAtmosphere::updateAtmosphereParameters, this));
|
||||
_ozoneCoeffXP = _ozoneExtinctionCoeff.x * 100000.0f;
|
||||
_ozoneCoeffXP.onChange([this](){ updateAtmosphereParameters(); });
|
||||
addProperty(_ozoneCoeffXP);
|
||||
|
||||
_ozoneCoeffYP.set(_ozoneExtinctionCoeff.y * 100000.0f);
|
||||
_ozoneCoeffYP.onChange(std::bind(&RenderableAtmosphere::updateAtmosphereParameters, this));
|
||||
_ozoneCoeffYP = _ozoneExtinctionCoeff.y * 100000.0f;
|
||||
_ozoneCoeffYP.onChange([this](){ updateAtmosphereParameters(); });
|
||||
addProperty(_ozoneCoeffYP);
|
||||
|
||||
_ozoneCoeffZP.set(_ozoneExtinctionCoeff.z * 100000.0f);
|
||||
_ozoneCoeffZP.onChange(std::bind(&RenderableAtmosphere::updateAtmosphereParameters, this));
|
||||
|
||||
_ozoneCoeffZP = _ozoneExtinctionCoeff.z * 100000.0f;
|
||||
_ozoneCoeffZP.onChange([this](){ updateAtmosphereParameters(); });
|
||||
addProperty(_ozoneCoeffZP);
|
||||
|
||||
_mieHeightScaleP.set(_mieHeightScale);
|
||||
_mieHeightScaleP.onChange(std::bind(&RenderableAtmosphere::updateAtmosphereParameters, this));
|
||||
_mieHeightScaleP = _mieHeightScale;
|
||||
_mieHeightScaleP.onChange([this](){ updateAtmosphereParameters(); });
|
||||
addProperty(_mieHeightScaleP);
|
||||
|
||||
_mieScatteringCoeffXP.set(_mieScatteringCoeff.x * 1000.0f);
|
||||
_mieScatteringCoeffXP.onChange(std::bind(&RenderableAtmosphere::updateAtmosphereParameters, this));
|
||||
_mieScatteringCoeffXP = _mieScatteringCoeff.x * 1000.0f;
|
||||
_mieScatteringCoeffXP.onChange([this](){ updateAtmosphereParameters(); });
|
||||
addProperty(_mieScatteringCoeffXP);
|
||||
|
||||
_mieScatteringCoeffYP.set(_mieScatteringCoeff.y * 1000.0f);
|
||||
_mieScatteringCoeffYP.onChange(std::bind(&RenderableAtmosphere::updateAtmosphereParameters, this));
|
||||
_mieScatteringCoeffYP = _mieScatteringCoeff.y * 1000.0f;
|
||||
_mieScatteringCoeffYP.onChange([this](){ updateAtmosphereParameters(); });
|
||||
addProperty(_mieScatteringCoeffYP);
|
||||
|
||||
_mieScatteringCoeffZP.set(_mieScatteringCoeff.z * 1000.0f);
|
||||
_mieScatteringCoeffZP.onChange(std::bind(&RenderableAtmosphere::updateAtmosphereParameters, this));
|
||||
_mieScatteringCoeffZP = _mieScatteringCoeff.z * 1000.0f;
|
||||
_mieScatteringCoeffZP.onChange([this](){ updateAtmosphereParameters(); });
|
||||
addProperty(_mieScatteringCoeffZP);
|
||||
|
||||
_mieScatteringExtinctionPropCoefficientP.set(_mieScatteringCoeff.x / _mieExtinctionCoeff.x);
|
||||
_mieScatteringExtinctionPropCoefficientP.onChange(std::bind(&RenderableAtmosphere::updateAtmosphereParameters, this));
|
||||
_mieScatteringExtinctionPropCoefficientP = _mieScatteringCoeff.x / _mieExtinctionCoeff.x;
|
||||
_mieScatteringExtinctionPropCoefficientP.onChange([this](){ updateAtmosphereParameters(); });
|
||||
addProperty(_mieScatteringExtinctionPropCoefficientP);
|
||||
|
||||
_mieAsymmetricFactorGP.set(_miePhaseConstant);
|
||||
_mieAsymmetricFactorGP.onChange(std::bind(&RenderableAtmosphere::updateAtmosphereParameters, this));
|
||||
_mieAsymmetricFactorGP = _miePhaseConstant;
|
||||
_mieAsymmetricFactorGP.onChange([this](){ updateAtmosphereParameters(); });
|
||||
addProperty(_mieAsymmetricFactorGP);
|
||||
|
||||
_sunIntensityP.set(_sunRadianceIntensity);
|
||||
_sunIntensityP.onChange(std::bind(&RenderableAtmosphere::updateAtmosphereParameters, this));
|
||||
_sunIntensityP = _sunRadianceIntensity;
|
||||
_sunIntensityP.onChange([this](){ updateAtmosphereParameters(); });
|
||||
addProperty(_sunIntensityP);
|
||||
|
||||
_hdrExpositionP.set(_hdrConstant);
|
||||
_hdrExpositionP.onChange(std::bind(&RenderableAtmosphere::updateAtmosphereParameters, this));
|
||||
_hdrExpositionP = _hdrConstant;
|
||||
_hdrExpositionP.onChange([this](){ updateAtmosphereParameters(); });
|
||||
addProperty(_hdrExpositionP);
|
||||
|
||||
_gammaConstantP.set(_gammaConstant);
|
||||
_gammaConstantP.onChange(std::bind(&RenderableAtmosphere::updateAtmosphereParameters, this));
|
||||
_gammaConstantP = _gammaConstant;
|
||||
_gammaConstantP.onChange([this](){ updateAtmosphereParameters(); });
|
||||
addProperty(_gammaConstantP);
|
||||
|
||||
_sunFollowingCameraEnabledP.set(_sunFollowingCameraEnabled);
|
||||
_sunFollowingCameraEnabledP.onChange(std::bind(&RenderableAtmosphere::updateAtmosphereParameters, this));
|
||||
_sunFollowingCameraEnabledP = _sunFollowingCameraEnabled;
|
||||
_sunFollowingCameraEnabledP.onChange([this](){ updateAtmosphereParameters(); });
|
||||
addProperty(_sunFollowingCameraEnabledP);
|
||||
}
|
||||
}
|
||||
@@ -661,22 +657,12 @@ namespace openspace {
|
||||
}
|
||||
|
||||
OsEng.renderEngine().deferredcasterManager().attachDeferredcaster(*_deferredcaster.get());
|
||||
|
||||
std::function<void(bool)> onChange = [&](bool enabled) {
|
||||
if (enabled) {
|
||||
OsEng.renderEngine().deferredcasterManager().attachDeferredcaster(*_deferredcaster.get());
|
||||
}
|
||||
else {
|
||||
OsEng.renderEngine().deferredcasterManager().detachDeferredcaster(*_deferredcaster.get());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return isReady();
|
||||
}
|
||||
|
||||
bool RenderableAtmosphere::deinitialize() {
|
||||
|
||||
if (_deferredcaster) {
|
||||
OsEng.renderEngine().deferredcasterManager().detachDeferredcaster(*_deferredcaster.get());
|
||||
_deferredcaster = nullptr;
|
||||
@@ -691,11 +677,9 @@ namespace openspace {
|
||||
return ready;
|
||||
}
|
||||
|
||||
void RenderableAtmosphere::computeModelTransformMatrix(const openspace::TransformData & transformData,
|
||||
glm::dmat4 * modelTransform) {
|
||||
glm::dmat4 RenderableAtmosphere::computeModelTransformMatrix(const openspace::TransformData& transformData) {
|
||||
// scale the planet to appropriate size since the planet is a unit sphere
|
||||
*modelTransform =
|
||||
glm::translate(glm::dmat4(1.0), transformData.translation) * // Translation
|
||||
return glm::translate(glm::dmat4(1.0), transformData.translation) * // Translation
|
||||
glm::dmat4(transformData.rotation) * // Spice rotation
|
||||
glm::dmat4(glm::scale(glm::dmat4(1.0), glm::dvec3(transformData.scale)));
|
||||
}
|
||||
@@ -715,8 +699,7 @@ namespace openspace {
|
||||
|
||||
if (_deferredcaster) {
|
||||
_deferredcaster->setTime(data.time.j2000Seconds());
|
||||
glm::dmat4 modelTransform;
|
||||
computeModelTransformMatrix(data.modelTransform, &modelTransform);
|
||||
glm::dmat4 modelTransform = computeModelTransformMatrix(data.modelTransform);
|
||||
if (_atmosphereType == AtmosphereDeferredcaster::RenderablePlanet) {
|
||||
//earth needs to be rotated
|
||||
glm::dmat4 rot = glm::rotate(glm::dmat4(1.0), M_PI_2, glm::dvec3(1, 0, 0));
|
||||
@@ -737,8 +720,10 @@ namespace openspace {
|
||||
_hdrConstant != _hdrExpositionP ||
|
||||
_exposureBackgroundConstant != OsEng.renderEngine().renderer()->hdrBackground() ||
|
||||
_gammaConstant != _gammaConstantP ||
|
||||
_sunFollowingCameraEnabled != _sunFollowingCameraEnabledP)
|
||||
_sunFollowingCameraEnabled != _sunFollowingCameraEnabledP) {
|
||||
executeComputation = false;
|
||||
}
|
||||
|
||||
|
||||
_atmosphereRadius = _atmospherePlanetRadius + _atmosphereHeightP;
|
||||
_planetAverageGroundReflectance = _groundAverageReflectanceP;
|
||||
|
||||
@@ -62,20 +62,21 @@ namespace planetgeometry { class PlanetGeometry; }
|
||||
class RenderableAtmosphere : public Renderable {
|
||||
public:
|
||||
// Shadow structure
|
||||
typedef struct {
|
||||
struct ShadowConfiguration {
|
||||
std::pair<std::string, float> source;
|
||||
std::pair<std::string, float> caster;
|
||||
} ShadowConf;
|
||||
};
|
||||
|
||||
struct ShadowRenderingStruct {
|
||||
float xu, xp;
|
||||
float rs, rc;
|
||||
float xu,
|
||||
xp;
|
||||
float rs,
|
||||
rc;
|
||||
glm::vec3 sourceCasterVec;
|
||||
glm::vec3 casterPositionVec;
|
||||
bool isShadowing;
|
||||
};
|
||||
|
||||
public:
|
||||
RenderableAtmosphere(const ghoul::Dictionary& dictionary);
|
||||
|
||||
bool initialize() override;
|
||||
@@ -88,10 +89,8 @@ public:
|
||||
static documentation::Documentation Documentation();
|
||||
|
||||
private:
|
||||
void computeModelTransformMatrix(const openspace::TransformData & transformData, glm::dmat4 * modelTransform);
|
||||
glm::dmat4 computeModelTransformMatrix(const openspace::TransformData& transformData);
|
||||
void updateAtmosphereParameters();
|
||||
|
||||
private:
|
||||
|
||||
AtmosphereDeferredcaster::AtmospherRenderableClass _atmosphereType;
|
||||
|
||||
@@ -148,7 +147,7 @@ private:
|
||||
|
||||
glm::dmat3 _stateMatrix;
|
||||
|
||||
std::vector< ShadowConf > _shadowConfArray;
|
||||
std::vector<ShadowConfiguration> _shadowConfArray;
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* 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 *
|
||||
|
||||
@@ -266,17 +266,14 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary)
|
||||
unsigned int sourceCounter = 1;
|
||||
while (dicSuccess) {
|
||||
std::string sourceName;
|
||||
std::stringstream ss;
|
||||
ss << keyShadowSource << sourceCounter << ".Name";
|
||||
dicSuccess = shadowDictionary.getValue(ss.str(), sourceName);
|
||||
dicSuccess = shadowDictionary.getValue(keyShadowSource +
|
||||
std::to_string(sourceCounter) + ".Name", sourceName);
|
||||
if (dicSuccess) {
|
||||
float sourceRadius;
|
||||
ss.str(std::string());
|
||||
ss << keyShadowSource << sourceCounter << ".Radius";
|
||||
dicSuccess = shadowDictionary.getValue(ss.str(), sourceRadius);
|
||||
dicSuccess = shadowDictionary.getValue(keyShadowSource +
|
||||
std::to_string(sourceCounter) + ".Radius", sourceRadius);
|
||||
if (dicSuccess) {
|
||||
sourceArray.push_back(std::pair< std::string, float>(
|
||||
sourceName, sourceRadius));
|
||||
sourceArray.emplace_back(sourceName, sourceRadius);
|
||||
}
|
||||
else {
|
||||
/*LWARNING("No Radius value expecified for Shadow Source Name "
|
||||
@@ -295,17 +292,14 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary)
|
||||
unsigned int casterCounter = 1;
|
||||
while (dicSuccess) {
|
||||
std::string casterName;
|
||||
std::stringstream ss;
|
||||
ss << keyShadowCaster << casterCounter << ".Name";
|
||||
dicSuccess = shadowDictionary.getValue(ss.str(), casterName);
|
||||
dicSuccess = shadowDictionary.getValue(keyShadowCaster +
|
||||
std::to_string(casterCounter) + ".Name", casterName);
|
||||
if (dicSuccess) {
|
||||
float casterRadius;
|
||||
ss.str(std::string());
|
||||
ss << keyShadowCaster << casterCounter << ".Radius";
|
||||
dicSuccess = shadowDictionary.getValue(ss.str(), casterRadius);
|
||||
dicSuccess = shadowDictionary.getValue(keyShadowCaster +
|
||||
std::to_string(casterCounter) + ".Radius", casterRadius);
|
||||
if (dicSuccess) {
|
||||
casterArray.push_back(std::pair< std::string, float>(
|
||||
casterName, casterRadius));
|
||||
casterArray.emplace_back(casterName, casterRadius);
|
||||
}
|
||||
else {
|
||||
/*LWARNING("No Radius value expecified for Shadow Caster Name "
|
||||
@@ -320,9 +314,9 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary)
|
||||
}
|
||||
|
||||
if (!disableShadows && (!sourceArray.empty() && !casterArray.empty())) {
|
||||
for (const auto & source : sourceArray)
|
||||
for (const auto & caster : casterArray) {
|
||||
ShadowConf sc;
|
||||
for (auto source : sourceArray)
|
||||
for (auto caster : casterArray) {
|
||||
ShadowConfiguration sc;
|
||||
sc.source = source;
|
||||
sc.caster = caster;
|
||||
_shadowConfArray.push_back(sc);
|
||||
@@ -334,12 +328,10 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary)
|
||||
}
|
||||
|
||||
bool RenderableGlobe::initialize() {
|
||||
|
||||
return _distanceSwitch.initialize();
|
||||
}
|
||||
|
||||
bool RenderableGlobe::deinitialize() {
|
||||
|
||||
return _distanceSwitch.deinitialize();
|
||||
}
|
||||
|
||||
|
||||
@@ -85,14 +85,16 @@ public:
|
||||
};
|
||||
|
||||
// Shadow structure
|
||||
typedef struct {
|
||||
struct ShadowConfiguration {
|
||||
std::pair<std::string, float> source;
|
||||
std::pair<std::string, float> caster;
|
||||
} ShadowConf;
|
||||
};
|
||||
|
||||
struct ShadowRenderingStruct {
|
||||
float xu, xp;
|
||||
float rs, rc;
|
||||
float xu,
|
||||
xp;
|
||||
float rs,
|
||||
rc;
|
||||
glm::vec3 sourceCasterVec;
|
||||
glm::vec3 casterPositionVec;
|
||||
bool isShadowing;
|
||||
@@ -154,7 +156,7 @@ private:
|
||||
|
||||
// Shadow
|
||||
bool _shadowEnabled;
|
||||
std::vector< ShadowConf > _shadowConfArray;
|
||||
std::vector<ShadowConfiguration> _shadowConfArray;
|
||||
};
|
||||
|
||||
} // namespace openspace::globebrowsing
|
||||
|
||||
@@ -404,7 +404,8 @@ vec4 calculateWater(
|
||||
const vec3 ellipsoidNormalCameraSpace,
|
||||
const vec3 lightDirectionCameraSpace,
|
||||
const vec3 positionCameraSpace,
|
||||
out float reflectance) {
|
||||
out float reflectance)
|
||||
{
|
||||
|
||||
vec4 waterColor = vec4(0,0,0,0);
|
||||
|
||||
|
||||
@@ -270,25 +270,22 @@ RenderablePlanet::RenderablePlanet(const ghoul::Dictionary& dictionary)
|
||||
bool success = dictionary.getValue(keyShadowGroup, shadowDictionary);
|
||||
bool disableShadows = false;
|
||||
if (success) {
|
||||
std::vector< std::pair<std::string, float > > sourceArray;
|
||||
std::vector<std::pair<std::string, float>> sourceArray;
|
||||
unsigned int sourceCounter = 1;
|
||||
while (success) {
|
||||
std::string sourceName;
|
||||
std::stringstream ss;
|
||||
ss << keyShadowSource << sourceCounter << ".Name";
|
||||
success = shadowDictionary.getValue(ss.str(), sourceName);
|
||||
success = shadowDictionary.getValue(keyShadowSource +
|
||||
std::to_string(sourceCounter) + ".Name", sourceName);
|
||||
if (success) {
|
||||
float sourceRadius;
|
||||
ss.str(std::string());
|
||||
ss << keyShadowSource << sourceCounter << ".Radius";
|
||||
success = shadowDictionary.getValue(ss.str(), sourceRadius);
|
||||
success = shadowDictionary.getValue(keyShadowSource +
|
||||
std::to_string(sourceCounter) + ".Radius", sourceRadius);
|
||||
if (success) {
|
||||
sourceArray.push_back(std::pair< std::string, float>(
|
||||
sourceName, sourceRadius));
|
||||
sourceArray.emplace_back(sourceName, sourceRadius);
|
||||
}
|
||||
else {
|
||||
LWARNING("No Radius value expecified for Shadow Source Name "
|
||||
<< sourceName << " from " << name
|
||||
LWARNING("No Radius value expecified for Shadow Source Name "
|
||||
<< sourceName << " from " << name
|
||||
<< " planet.\nDisabling shadows for this planet.");
|
||||
disableShadows = true;
|
||||
break;
|
||||
@@ -303,17 +300,14 @@ RenderablePlanet::RenderablePlanet(const ghoul::Dictionary& dictionary)
|
||||
unsigned int casterCounter = 1;
|
||||
while (success) {
|
||||
std::string casterName;
|
||||
std::stringstream ss;
|
||||
ss << keyShadowCaster << casterCounter << ".Name";
|
||||
success = shadowDictionary.getValue(ss.str(), casterName);
|
||||
success = shadowDictionary.getValue(keyShadowCaster +
|
||||
std::to_string(casterCounter) + ".Name", casterName);
|
||||
if (success) {
|
||||
float casterRadius;
|
||||
ss.str(std::string());
|
||||
ss << keyShadowCaster << casterCounter << ".Radius";
|
||||
success = shadowDictionary.getValue(ss.str(), casterRadius);
|
||||
success = shadowDictionary.getValue(keyShadowCaster +
|
||||
std::to_string(casterCounter) + ".Radius", casterRadius);
|
||||
if (success) {
|
||||
casterArray.push_back(std::pair< std::string, float>(
|
||||
casterName, casterRadius));
|
||||
casterArray.emplace_back(casterName, casterRadius);
|
||||
}
|
||||
else {
|
||||
LWARNING("No Radius value expecified for Shadow Caster Name "
|
||||
@@ -328,13 +322,14 @@ RenderablePlanet::RenderablePlanet(const ghoul::Dictionary& dictionary)
|
||||
}
|
||||
|
||||
if (!disableShadows && (!sourceArray.empty() && !casterArray.empty())) {
|
||||
for (const auto & source : sourceArray)
|
||||
for (const auto & caster : casterArray) {
|
||||
ShadowConf sc;
|
||||
for (auto & source : sourceArray) {
|
||||
for (auto & caster : casterArray) {
|
||||
ShadowConfiguration sc;
|
||||
sc.source = source;
|
||||
sc.caster = caster;
|
||||
_shadowConfArray.push_back(sc);
|
||||
}
|
||||
}
|
||||
_shadowEnabled = true;
|
||||
}
|
||||
}
|
||||
@@ -414,9 +409,9 @@ bool RenderablePlanet::isReady() const {
|
||||
return ready;
|
||||
}
|
||||
|
||||
void RenderablePlanet::computeModelTransformMatrix(const openspace::TransformData & transformData, glm::dmat4 * modelTransform) {
|
||||
glm::dmat4 RenderablePlanet::computeModelTransformMatrix(const openspace::TransformData & transformData) {
|
||||
// scale the planet to appropriate size since the planet is a unit sphere
|
||||
*modelTransform =
|
||||
glm::dmat4 modelTransform =
|
||||
glm::translate(glm::dmat4(1.0), transformData.translation) * // Translation
|
||||
glm::dmat4(transformData.rotation) * // Spice rotation
|
||||
glm::dmat4(glm::scale(glm::dmat4(1.0), glm::dvec3(transformData.scale)));
|
||||
@@ -424,16 +419,15 @@ void RenderablePlanet::computeModelTransformMatrix(const openspace::TransformDat
|
||||
//earth needs to be rotated for that to work.
|
||||
glm::dmat4 rot = glm::rotate(glm::dmat4(1.0), M_PI_2, glm::dvec3(1, 0, 0));
|
||||
glm::dmat4 roty = glm::rotate(glm::dmat4(1.0), M_PI_2, glm::dvec3(0, -1, 0));
|
||||
//glm::dmat4 rotProp = glm::rotate(glm::dmat4(1.0), glm::radians(static_cast<double>(_rotation)), glm::dvec3(0, 1, 0));
|
||||
*modelTransform = *modelTransform * rot * roty /** rotProp*/;
|
||||
|
||||
return modelTransform * rot * roty;
|
||||
}
|
||||
|
||||
void RenderablePlanet::render(const RenderData& data, RendererTasks& renderTask) {
|
||||
// activate shader
|
||||
_programObject->activate();
|
||||
|
||||
glm::dmat4 modelTransform = glm::dmat4(1.0);
|
||||
computeModelTransformMatrix(data.modelTransform, &modelTransform);
|
||||
glm::dmat4 modelTransform = computeModelTransformMatrix(data.modelTransform);
|
||||
|
||||
glm::dmat4 modelViewTransform = data.camera.combinedViewMatrix() * modelTransform;
|
||||
|
||||
|
||||
@@ -58,20 +58,21 @@ namespace planetgeometry { class PlanetGeometry; }
|
||||
class RenderablePlanet : public Renderable {
|
||||
public:
|
||||
// Shadow structure
|
||||
typedef struct {
|
||||
struct ShadowConfiguration {
|
||||
std::pair<std::string, float> source;
|
||||
std::pair<std::string, float> caster;
|
||||
} ShadowConf;
|
||||
};
|
||||
|
||||
struct ShadowRenderingStruct {
|
||||
float xu, xp;
|
||||
float rs, rc;
|
||||
float xu,
|
||||
xp;
|
||||
float rs,
|
||||
rc;
|
||||
glm::vec3 sourceCasterVec;
|
||||
glm::vec3 casterPositionVec;
|
||||
bool isShadowing;
|
||||
};
|
||||
|
||||
public:
|
||||
RenderablePlanet(const ghoul::Dictionary& dictionary);
|
||||
|
||||
bool initialize() override;
|
||||
@@ -87,9 +88,8 @@ protected:
|
||||
void loadTexture();
|
||||
|
||||
private:
|
||||
void computeModelTransformMatrix(const openspace::TransformData & transformData, glm::dmat4 * modelTransform);
|
||||
glm::dmat4 computeModelTransformMatrix(const openspace::TransformData & transformData);
|
||||
|
||||
private:
|
||||
properties::StringProperty _colorTexturePath;
|
||||
properties::StringProperty _nightTexturePath;
|
||||
properties::StringProperty _heightMapTexturePath;
|
||||
@@ -113,7 +113,7 @@ private:
|
||||
|
||||
glm::dmat3 _stateMatrix;
|
||||
|
||||
std::vector< ShadowConf > _shadowConfArray;
|
||||
std::vector<ShadowConfiguration> _shadowConfArray;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
****************************************************************************************/
|
||||
* *
|
||||
* 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. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/space/rendering/simplespheregeometry.h>
|
||||
|
||||
|
||||
@@ -39,5 +39,5 @@ void main() {
|
||||
color /= nAaSamples;
|
||||
color.rgb *= blackoutFactor;
|
||||
|
||||
finalColor = vec4(color.rgb, 1.0);
|
||||
finalColor = vec4(color.rgb, 1.0);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* 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 *
|
||||
@@ -27,25 +27,22 @@ uniform float gamma;
|
||||
|
||||
vec3 exponentialToneMapping(vec3 color) {
|
||||
color *= exposure;
|
||||
|
||||
|
||||
color.r = color.r < 1.413 ? pow(color.r * 0.38317, 1.0 / gamma) : 1.0 - exp(-color.r);
|
||||
color.g = color.g < 1.413 ? pow(color.g * 0.38317, 1.0 / gamma) : 1.0 - exp(-color.g);
|
||||
color.b = color.b < 1.413 ? pow(color.b * 0.38317, 1.0 / gamma) : 1.0 - exp(-color.b);
|
||||
|
||||
return color;
|
||||
|
||||
}
|
||||
|
||||
vec3 linearToneMapping(vec3 color)
|
||||
{
|
||||
vec3 linearToneMapping(vec3 color) {
|
||||
float tExposure = 1.0f;
|
||||
color = clamp(tExposure * color, 0.0f, 1.0f);
|
||||
color = pow(color, vec3(1.0f / gamma));
|
||||
return color;
|
||||
}
|
||||
|
||||
vec3 simpleReinhardToneMapping(vec3 color)
|
||||
{
|
||||
vec3 simpleReinhardToneMapping(vec3 color) {
|
||||
float tExposure = 1.5f;
|
||||
color *= tExposure/(1.0f + color / tExposure);
|
||||
color = pow(color, vec3(1. / gamma));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*****************************************************************************************
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
@@ -28,21 +28,21 @@
|
||||
#include <string>
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "DeferredcasterManager";
|
||||
const char* _loggerCat = "DeferredcasterManager";
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
|
||||
DeferredcasterManager::DeferredcasterManager() {}
|
||||
DeferredcasterManager::DeferredcasterManager() = default;
|
||||
|
||||
DeferredcasterManager::~DeferredcasterManager() {}
|
||||
DeferredcasterManager::~DeferredcasterManager() = default;
|
||||
|
||||
void DeferredcasterManager::attachDeferredcaster(Deferredcaster& deferredcaster) {
|
||||
if (!isAttached(deferredcaster)) {
|
||||
_deferredcasters.push_back(&deferredcaster);
|
||||
}
|
||||
for (auto &listener : _listeners) {
|
||||
listener->deferredcastersChanged(deferredcaster, true);
|
||||
listener->deferredcastersChanged(deferredcaster, ghoul::Boolean::Yes);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ void DeferredcasterManager::detachDeferredcaster(Deferredcaster& deferredcaster)
|
||||
if (it != _deferredcasters.end()) {
|
||||
_deferredcasters.erase(it);
|
||||
for (auto &listener : _listeners) {
|
||||
listener->deferredcastersChanged(deferredcaster, false);
|
||||
listener->deferredcastersChanged(deferredcaster, ghoul::Boolean::No);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,9 +228,9 @@ void FramebufferRenderer::raycastersChanged(VolumeRaycaster&, bool) {
|
||||
_dirtyRaycastData = true;
|
||||
}
|
||||
|
||||
void FramebufferRenderer::deferredcastersChanged(Deferredcaster& deferredcaster, bool attached) {
|
||||
void FramebufferRenderer::deferredcastersChanged(Deferredcaster& deferredcaster, ghoul::Boolean isAttached) {
|
||||
(void) deferredcaster;
|
||||
(void) attached;
|
||||
(void) isAttached;
|
||||
_dirtyDeferredcastData = true;
|
||||
}
|
||||
|
||||
@@ -250,11 +250,7 @@ void FramebufferRenderer::update() {
|
||||
// If the resolve dictionary changed (or a file changed on disk)
|
||||
// then rebuild the resolve program.
|
||||
if (_hdrBackGroundProgram && _hdrBackGroundProgram->isDirty()) {
|
||||
try {
|
||||
_hdrBackGroundProgram->rebuildFromFile();
|
||||
} catch (const ghoul::RuntimeError& error) {
|
||||
LERRORC(error.component, error.message);
|
||||
}
|
||||
_hdrBackGroundProgram->rebuildFromFile();
|
||||
}
|
||||
|
||||
if (_resolveProgram->isDirty()) {
|
||||
@@ -299,11 +295,7 @@ void FramebufferRenderer::update() {
|
||||
|
||||
for (auto &program : _deferredcastPrograms) {
|
||||
if (program.second && program.second->isDirty()) {
|
||||
try {
|
||||
program.second->rebuildFromFile();
|
||||
} catch (ghoul::RuntimeError e) {
|
||||
LERROR(e.message);
|
||||
}
|
||||
program.second->rebuildFromFile();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -508,15 +500,15 @@ void FramebufferRenderer::updateDeferredcastData() {
|
||||
data.id = nextId++;
|
||||
data.namespaceName = "HELPER";
|
||||
|
||||
std::string vsPath = deferredcaster->getDeferredcastVSPath();
|
||||
std::string fsPath = deferredcaster->getDeferredcastFSPath();
|
||||
std::string deferredShaderPath = deferredcaster->getDeferredcastPath();
|
||||
std::string vsPath = deferredcaster->deferredcastVSPath();
|
||||
std::string fsPath = deferredcaster->deferredcastFSPath();
|
||||
std::string deferredShaderPath = deferredcaster->deferredcastPath();
|
||||
|
||||
ghoul::Dictionary dict;
|
||||
dict.setValue("rendererData", _rendererData);
|
||||
//dict.setValue("fragmentPath", fsPath);
|
||||
dict.setValue("id", data.id);
|
||||
std::string helperPath = deferredcaster->getHelperPath();
|
||||
std::string helperPath = deferredcaster->helperPath();
|
||||
ghoul::Dictionary helpersDict;
|
||||
if (helperPath != "") {
|
||||
helpersDict.setValue("0", helperPath);
|
||||
|
||||
@@ -1456,4 +1456,4 @@ void RenderEngine::sortScreenspaceRenderables() {
|
||||
);
|
||||
}
|
||||
|
||||
}// namespace openspace
|
||||
}// namespace openspace
|
||||
|
||||
Reference in New Issue
Block a user