1
0
Fork 0

Use different vertex attribute for orthoscenery

See related SimGear commit e8ffe461

Now the orthophoto texture coordinates are contained in gl_TexCoord[2],
so no need to pass any custom vertex attributes to Effects that use
photoscenery.
This commit is contained in:
Fernando García Liñán 2023-03-08 18:30:47 +01:00
parent eb9508ed56
commit 85771b2863
17 changed files with 9 additions and 65 deletions

View file

@ -148,10 +148,6 @@
<fragment-shader>Shaders/filters-ALS.frag</fragment-shader>
<fragment-shader>Shaders/shadows-include.frag</fragment-shader>
<fragment-shader>Shaders/clustered-include.frag</fragment-shader>
<attribute>
<name>orthophotoTexCoord</name>
<index>14</index>
</attribute>
</program>
<uniform>
<name>visibility</name>

View file

@ -141,10 +141,6 @@
<fragment-shader>Shaders/filters-ALS.frag</fragment-shader>
<fragment-shader>Shaders/shadows-include.frag</fragment-shader>
<fragment-shader>Shaders/clustered-include.frag</fragment-shader>
<attribute>
<name>orthophotoTexCoord</name>
<index>14</index>
</attribute>
</program>
<uniform>
<name>visibility</name>

View file

@ -336,10 +336,6 @@
<fragment-shader>Shaders/filters-ALS.frag</fragment-shader>
<fragment-shader>Shaders/shadows-include.frag</fragment-shader>
<fragment-shader>Shaders/clustered-include.frag</fragment-shader>
<attribute>
<name>orthophotoTexCoord</name>
<index>14</index>
</attribute>
</program>
<uniform>
<name>grain_strength</name>
@ -994,10 +990,6 @@
<fragment-shader>Shaders/filters-ALS.frag</fragment-shader>
<fragment-shader>Shaders/shadows-include.frag</fragment-shader>
<fragment-shader>Shaders/clustered-include.frag</fragment-shader>
<attribute>
<name>orthophotoTexCoord</name>
<index>14</index>
</attribute>
</program>
<uniform>
<name>visibility</name>
@ -1313,10 +1305,6 @@
<fragment-shader>Shaders/filters-ALS.frag</fragment-shader>
<fragment-shader>Shaders/shadows-include.frag</fragment-shader>
<fragment-shader>Shaders/clustered-include.frag</fragment-shader>
<attribute>
<name>orthophotoTexCoord</name>
<index>14</index>
</attribute>
</program>
<uniform>
<name>visibility</name>
@ -1572,10 +1560,6 @@
<fragment-shader>Shaders/include_fog.frag</fragment-shader>
<fragment-shader>Shaders/shadows-include.frag</fragment-shader>
<fragment-shader>Shaders/clustered-include.frag</fragment-shader>
<attribute>
<name>orthophotoTexCoord</name>
<index>14</index>
</attribute>
</program>
<uniform>
<name>visibility</name>

View file

@ -169,10 +169,6 @@
<fragment-shader>Shaders/filters-ALS.frag</fragment-shader>
<fragment-shader>Shaders/shadows-include.frag</fragment-shader>
<fragment-shader>Shaders/clustered-include.frag</fragment-shader>
<attribute>
<name>orthophotoTexCoord</name>
<index>14</index>
</attribute>
</program>
<uniform>
<name>grain_strength</name>

View file

@ -233,11 +233,6 @@
<name>binormal</name>
<index>7</index>
</attribute>
<attribute>
<name>orthophotoTexCoord</name>
<index>14</index>
</attribute>
</program>
<uniform>

View file

@ -10,7 +10,6 @@ varying vec3 worldPos;
varying vec2 rawPos;
varying vec3 ecViewdir;
varying vec4 ecPosition;
varying vec2 orthoTexCoord;
uniform sampler2D texture;
@ -170,7 +169,7 @@ float noise_2000m = Noise3D(worldPos.xyz, 2000.0);
float local_autumn_factor = texel.a;
if (orthophotoAvailable) {
vec4 sat_texel = texture2D(orthophotoTexture, orthoTexCoord);
vec4 sat_texel = texture2D(orthophotoTexture, gl_TexCoord[2].st);
if (sat_texel.a > 0) {
texel.rgb = sat_texel.rgb;
}

View file

@ -5,7 +5,6 @@
varying vec4 diffuse_term;
varying vec3 normal;
varying vec2 orthoTexCoord;
varying vec4 ecPosition;
uniform sampler2D texture;
@ -62,7 +61,7 @@ void main()
texel = texture2D(texture, gl_TexCoord[0].st);
if (orthophotoAvailable) {
vec4 sat_texel = texture2D(orthophotoTexture, orthoTexCoord);
vec4 sat_texel = texture2D(orthophotoTexture, gl_TexCoord[2].st);
if (sat_texel.a > 0) {
texel.rgb = sat_texel.rgb;
}

View file

@ -12,15 +12,12 @@
#define MODE_DIFFUSE 1
#define MODE_AMBIENT_AND_DIFFUSE 2
attribute vec2 orthophotoTexCoord;
// The constant term of the lighting equation that doesn't depend on
// the surface normal is passed in gl_{Front,Back}Color. The alpha
// component is set to 1 for front, 0 for back in order to work around
// bugs with gl_FrontFacing in the fragment shader.
varying vec4 diffuse_term;
varying vec3 normal;
varying vec2 orthoTexCoord;
varying vec4 ecPosition;
uniform int colorMode;
@ -38,7 +35,7 @@ void main()
gl_Position = ftransform();
ecPosition = gl_ModelViewMatrix * gl_Vertex;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
orthoTexCoord = orthophotoTexCoord;
gl_TexCoord[2] = gl_TextureMatrix[2] * gl_MultiTexCoord2;
normal = gl_NormalMatrix * gl_Normal;
vec4 ambient_color, diffuse_color;
if (colorMode == MODE_DIFFUSE) {

View file

@ -15,8 +15,6 @@
#define MODE_DIFFUSE 1
#define MODE_AMBIENT_AND_DIFFUSE 2
attribute vec2 orthophotoTexCoord;
// The constant term of the lighting equation that doesn't depend on
// the surface normal is passed in gl_{Front,Back}Color. The alpha
// component is set to 1 for front, 0 for back in order to work around
@ -24,7 +22,6 @@ attribute vec2 orthophotoTexCoord;
varying vec4 diffuse_term;
varying vec3 normal;
varying vec3 relPos;
varying vec2 orthoTexCoord;
varying vec4 ecPosition;
varying float yprime_alt;
@ -81,7 +78,7 @@ void main()
ecPosition = gl_ModelViewMatrix * gl_Vertex;
gl_Position = ftransform();
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
orthoTexCoord = orthophotoTexCoord;
gl_TexCoord[2] = gl_TextureMatrix[2] * gl_MultiTexCoord2;
normal = gl_NormalMatrix * gl_Normal;
vec4 ambient_color, diffuse_color;
if (colorMode == MODE_DIFFUSE) {

View file

@ -14,7 +14,6 @@ uniform sampler2D orthophotoTexture;
varying float yprime_alt;
varying float mie_angle;
varying vec2 orthoTexCoord;
varying vec4 ecPosition;
@ -94,7 +93,7 @@ void main()
texel = texture2D(texture, gl_TexCoord[0].st);
if (orthophotoAvailable) {
vec4 sat_texel = texture2D(orthophotoTexture, orthoTexCoord);
vec4 sat_texel = texture2D(orthophotoTexture, gl_TexCoord[2].st);
if (sat_texel.a > 0) {
texel.rgb = sat_texel.rgb;
}

View file

@ -8,7 +8,6 @@ varying vec3 normal;
varying vec3 relPos;
varying vec2 rawPos;
varying vec3 worldPos;
varying vec2 orthoTexCoord;
varying vec4 eyePos;
@ -135,7 +134,7 @@ float noise_2000m = Noise3D(worldPos.xyz, 2000.0);
float local_autumn_factor = texel.a;
if (orthophotoAvailable) {
vec4 sat_texel = texture2D(orthophotoTexture, orthoTexCoord);
vec4 sat_texel = texture2D(orthophotoTexture, gl_TexCoord[2].st);
if (sat_texel.a > 0) {
texel.rgb = sat_texel.rgb;
flag = 0;

View file

@ -15,8 +15,6 @@
#define MODE_DIFFUSE 1
#define MODE_AMBIENT_AND_DIFFUSE 2
attribute vec2 orthophotoTexCoord;
// The constant term of the lighting equation that doesn't depend on
// the surface normal is passed in gl_{Front,Back}Color. The alpha
// component is set to 1 for front, 0 for back in order to work around
@ -26,7 +24,6 @@ varying vec3 normal;
varying vec3 relPos;
varying vec2 rawPos;
varying vec3 worldPos;
varying vec2 orthoTexCoord;
varying vec4 eyePos;
@ -99,7 +96,7 @@ void main()
//vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
gl_Position = ftransform();
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
orthoTexCoord = orthophotoTexCoord;
gl_TexCoord[2] = gl_TextureMatrix[2] * gl_MultiTexCoord2;
normal = gl_NormalMatrix * gl_Normal;
//nvec = (gl_NormalMatrix * gl_Normal).xy;
vec4 ambient_color, diffuse_color;

View file

@ -10,7 +10,6 @@ varying vec2 rawPos;
varying vec3 worldPos;
varying vec3 ecViewdir;
varying vec2 grad_dir;
varying vec2 orthoTexCoord;
varying vec4 ecPosition;
@ -244,7 +243,7 @@ float snownoise_50m = mix(noise_50m, slopenoise_100m, clamp(3.0*(1.0-steepness),
float local_autumn_factor = texel.a;
if (orthophotoAvailable) {
vec4 sat_texel = texture2D(orthophotoTexture, orthoTexCoord);
vec4 sat_texel = texture2D(orthophotoTexture, gl_TexCoord[2].st);
if (sat_texel.a > 0) {
texel.rgb = sat_texel.rgb;
flag = 0;

View file

@ -15,8 +15,6 @@
#define MODE_DIFFUSE 1
#define MODE_AMBIENT_AND_DIFFUSE 2
attribute vec2 orthophotoTexCoord;
// The constant term of the lighting equation that doesn't depend on
// the surface normal is passed in gl_{Front,Back}Color. The alpha
// component is set to 1 for front, 0 for back in order to work around
@ -28,7 +26,6 @@ varying vec2 rawPos;
varying vec3 worldPos;
varying vec3 ecViewdir;
varying vec2 grad_dir;
varying vec2 orthoTexCoord;
varying vec4 ecPosition;
varying float mie_angle;
@ -114,7 +111,7 @@ void main()
ecPosition = gl_ModelViewMatrix * gl_Vertex;
//gl_Position = ftransform();
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
orthoTexCoord = orthophotoTexCoord;
gl_TexCoord[2] = gl_TextureMatrix[2] * gl_MultiTexCoord2;
normal = gl_NormalMatrix * gl_Normal;
//nvec = (gl_NormalMatrix * gl_Normal).xy;
vec4 ambient_color, diffuse_color;

View file

@ -51,7 +51,6 @@ varying vec2 rawPos;
varying vec3 worldPos;
// Testing code:
//vec3 worldPos = vec3(5000.0, 6000.0, 7000.0) + vec3(vec2(rawPos), 600.0); // vec3(100.0, 10.0, 3.0);
//varying vec2 orthoTexCoord;
varying vec4 eyePos;

View file

@ -16,8 +16,6 @@
#define MODE_DIFFUSE 1
#define MODE_AMBIENT_AND_DIFFUSE 2
attribute vec2 orthophotoTexCoord;
// The constant term of the lighting equation that doesn't depend on
// the surface normal is passed in gl_{Front,Back}Color. The alpha
// component is set to 1 for front, 0 for back in order to work around
@ -28,7 +26,6 @@ varying vec3 relPos;
varying vec2 ground_tex_coord;
varying vec2 rawPos;
varying vec3 worldPos;
//varying vec2 orthoTexCoord;
varying vec4 eyePos;
varying vec4 ecPosition;
@ -128,7 +125,6 @@ void main()
ecPosition = gl_ModelViewMatrix * gl_Vertex;
gl_Position = ftransform();
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
//orthoTexCoord = orthophotoTexCoord;
normal = gl_NormalMatrix * gl_Normal;
//nvec = (gl_NormalMatrix * gl_Normal).xy;

View file

@ -51,7 +51,6 @@ varying vec2 rawPos;
varying vec3 worldPos;
// Testing code:
//vec3 worldPos = vec3(5000.0, 6000.0, 7000.0) + vec3(vec2(rawPos), 600.0); // vec3(100.0, 10.0, 3.0);
//varying vec2 orthoTexCoord;
varying vec4 eyePos;