From 096c19e49fa90ac98bff26bd38d9c99dbc5482fb Mon Sep 17 00:00:00 2001 From: Kalle Bladin Date: Tue, 31 May 2016 12:17:40 -0400 Subject: [PATCH] Change definition of for loop statements in shader preprocessor to include both max and min. --- ext/ghoul | 2 +- .../shaders/globalchunkedlodpatch_fs.glsl | 9 +++++---- .../shaders/globalchunkedlodpatch_vs.glsl | 13 +++++++------ .../shaders/localchunkedlodpatch_fs.glsl | 9 +++++---- .../shaders/localchunkedlodpatch_vs.glsl | 13 +++++++------ 5 files changed, 25 insertions(+), 21 deletions(-) diff --git a/ext/ghoul b/ext/ghoul index 5c9f358af8..f3420c0b5c 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit 5c9f358af8056944d09b48c23cb9633aa5e533ff +Subproject commit f3420c0b5c40cb0819e9b67a85c3ab51fce6be8f diff --git a/modules/globebrowsing/shaders/globalchunkedlodpatch_fs.glsl b/modules/globebrowsing/shaders/globalchunkedlodpatch_fs.glsl index 1665862311..0c5c83bdaf 100644 --- a/modules/globebrowsing/shaders/globalchunkedlodpatch_fs.glsl +++ b/modules/globebrowsing/shaders/globalchunkedlodpatch_fs.glsl @@ -38,12 +38,13 @@ in vec2 fs_uv; Fragment getFragment() { Fragment frag; - #for i in 0..#{numLayersColor} + #for j in 1..#{numLayersColor} { + int i = #{j} - 1; vec2 samplePos = - colorTiles[#{i}].uvTransform.uvScale * fs_uv + - colorTiles[#{i}].uvTransform.uvOffset; - vec4 colorSample = texture(colorTiles[#{i}].textureSampler, samplePos); + colorTiles[i].uvTransform.uvScale * fs_uv + + colorTiles[i].uvTransform.uvOffset; + vec4 colorSample = texture(colorTiles[i].textureSampler, samplePos); frag.color = blendOver(frag.color, colorSample); } #endfor diff --git a/modules/globebrowsing/shaders/globalchunkedlodpatch_vs.glsl b/modules/globebrowsing/shaders/globalchunkedlodpatch_vs.glsl index da7f692152..25938406d3 100644 --- a/modules/globebrowsing/shaders/globalchunkedlodpatch_vs.glsl +++ b/modules/globebrowsing/shaders/globalchunkedlodpatch_vs.glsl @@ -61,18 +61,19 @@ void main() float height = 0; - #for i in 0..#{numLayersHeight} + #for j in 1..#{numLayersHeight} { + int i = #{j} - 1; vec2 samplePos = - heightTiles[#{i}].uvTransform.uvScale * in_uv + - heightTiles[#{i}].uvTransform.uvOffset; + heightTiles[i].uvTransform.uvScale * in_uv + + heightTiles[i].uvTransform.uvOffset; - float sampledValue = texture(heightTiles[#{i}].textureSampler, samplePos).r; + float sampledValue = texture(heightTiles[i].textureSampler, samplePos).r; // TODO : Some kind of blending here. Now it just writes over height = (sampledValue * - heightTiles[#{i}].depthTransform.depthScale + - heightTiles[#{i}].depthTransform.depthOffset); + heightTiles[i].depthTransform.depthScale + + heightTiles[i].depthTransform.depthOffset); // Skirts int vertexIDx = gl_VertexID % (xSegments + 3); diff --git a/modules/globebrowsing/shaders/localchunkedlodpatch_fs.glsl b/modules/globebrowsing/shaders/localchunkedlodpatch_fs.glsl index f0cb8f2ed0..487bc44f90 100644 --- a/modules/globebrowsing/shaders/localchunkedlodpatch_fs.glsl +++ b/modules/globebrowsing/shaders/localchunkedlodpatch_fs.glsl @@ -38,12 +38,13 @@ in vec2 fs_uv; Fragment getFragment() { Fragment frag; - #for i in 0..#{numLayersColor} + #for j in 1..#{numLayersColor} { + int i = #{j} - 1; vec2 samplePos = - colorTiles[#{i}].uvTransform.uvScale * fs_uv + - colorTiles[#{i}].uvTransform.uvOffset; - vec4 colorSample = texture(colorTiles[#{i}].textureSampler, samplePos); + colorTiles[i].uvTransform.uvScale * fs_uv + + colorTiles[i].uvTransform.uvOffset; + vec4 colorSample = texture(colorTiles[i].textureSampler, samplePos); frag.color = blendOver(frag.color, colorSample); } #endfor diff --git a/modules/globebrowsing/shaders/localchunkedlodpatch_vs.glsl b/modules/globebrowsing/shaders/localchunkedlodpatch_vs.glsl index 51128d0a7e..1b54b2c395 100644 --- a/modules/globebrowsing/shaders/localchunkedlodpatch_vs.glsl +++ b/modules/globebrowsing/shaders/localchunkedlodpatch_vs.glsl @@ -65,18 +65,19 @@ void main() float height = 0; - #for i in 0..#{numLayersHeight} + #for j in 1..#{numLayersHeight} { + int i = #{j} - 1; vec2 samplePos = - heightTiles[#{i}].uvTransform.uvScale * in_uv + - heightTiles[#{i}].uvTransform.uvOffset; + heightTiles[i].uvTransform.uvScale * in_uv + + heightTiles[i].uvTransform.uvOffset; - float sampledValue = texture(heightTiles[#{i}].textureSampler, samplePos).r; + float sampledValue = texture(heightTiles[i].textureSampler, samplePos).r; // TODO : Some kind of blending here. Now it just writes over height = (sampledValue * - heightTiles[#{i}].depthTransform.depthScale + - heightTiles[#{i}].depthTransform.depthOffset); + heightTiles[i].depthTransform.depthScale + + heightTiles[i].depthTransform.depthOffset); // Skirts int vertexIDx = gl_VertexID % (xSegments + 3);