Recompile shaders at initialization of globes

This commit is contained in:
Kalle Bladin
2017-07-19 10:01:53 +02:00
parent a14eae32e4
commit 3aa8f2a056
4 changed files with 20 additions and 11 deletions
+1 -11
View File
@@ -66,11 +66,6 @@ return {
SegmentsPerPatch = 64,
Layers = {
ColorLayers = {
{
Name = "Earth Bluemarble Height",
FilePath = "textures/earth_bluemarble_height.jpg",
Enabled = true,
},
{
Name = "ESRI VIIRS Combo",
Type = "ByLevelTileLayer",
@@ -98,8 +93,8 @@ return {
}
},
{
Name = "ESRI_Imagery_World_2D",
FilePath = "map_service_configs/ESRI/ESRI_Imagery_World_2D.wms",
Name = "ESRI",
},
{
Name = "BMNG",
@@ -165,11 +160,6 @@ return {
Name = "MODIS_Water_Mask",
FilePath = "map_service_configs/GIBS/MODIS_Water_Mask.xml",
Enabled = true,
Fallback = {
Name = "Earth Reflectance",
FilePath = "textures/earth_reflectance.jpg",
Enabled = true,
}
},
{
Name = "GEBCO",
@@ -279,6 +279,11 @@ void ChunkedLodGlobe::notifyShaderRecompilation() {
_shadersNeedRecompilation = true;
}
void ChunkedLodGlobe::recompileShaders() {
_renderer->recompileShaders(_owner);
_shadersNeedRecompilation = false;
}
void ChunkedLodGlobe::render(const RenderData& data) {
stats.startNewRecord();
if (_shadersNeedRecompilation) {
@@ -107,8 +107,18 @@ public:
*/
float getHeight(glm::dvec3 position) const;
/**
* Notifies the renderer to recompile its shaders the next time the render function is
* called. The actual shader recompilation takes place in the render function because
* properties that the shader depends on need to be properly synced.
*/
void notifyShaderRecompilation();
/**
* Directly recompile the shaders of the renderer.
*/
void recompileShaders();
const int minSplitDepth;
const int maxSplitDepth;
@@ -141,6 +141,10 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary)
addPropertySubOwner(_debugPropertyOwner);
addPropertySubOwner(_layerManager.get());
//addPropertySubOwner(_pointGlobe.get());
// Recompile the shaders directly so that it is not done the first time the render
// function is called.
_chunkedLodGlobe->recompileShaders();
}
bool RenderableGlobe::initialize() {