gel.demo: Use 'gel_sdl'.
This commit is contained in:
@@ -1,5 +1,34 @@
|
||||
#version 140
|
||||
|
||||
|
||||
|
||||
// Texturing snippet.
|
||||
//
|
||||
uniform int texture_Count;
|
||||
uniform sampler2D Textures [32];
|
||||
uniform float Fade [32];
|
||||
|
||||
vec4
|
||||
apply_Texturing (vec2 Coords)
|
||||
{
|
||||
vec4 Color = vec4 (0);
|
||||
|
||||
for (int i = 0; i < texture_Count; ++i)
|
||||
{
|
||||
Color.rgb += texture (Textures [i], Coords).rgb
|
||||
* texture (Textures [i], Coords).a
|
||||
* (1.0 - Fade [i]);
|
||||
|
||||
Color.a = max (Color.a, texture (Textures [i],
|
||||
Coords).a);
|
||||
}
|
||||
|
||||
return Color;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
struct light
|
||||
{
|
||||
vec4 Site;
|
||||
@@ -15,7 +44,7 @@ uniform mat4 model_Transform;
|
||||
uniform mat3 inverse_model_Rotation;
|
||||
uniform vec3 camera_Site;
|
||||
uniform vec3 specular_Color; // The materials specular color.
|
||||
uniform sampler2D Texture;
|
||||
//uniform sampler2D Texture;
|
||||
uniform int light_Count;
|
||||
uniform light Lights [10];
|
||||
|
||||
@@ -95,8 +124,8 @@ apply_Light (light Light,
|
||||
void
|
||||
main()
|
||||
{
|
||||
vec4 texture_Color = texture (Texture, frag_Coords);
|
||||
|
||||
vec4 texture_Color = apply_Texturing (frag_Coords); // texture (Texture, frag_Coords);
|
||||
|
||||
vec4 surface_Color = vec4 (mix (texture_Color.rgb,
|
||||
frag_Color .rgb,
|
||||
0.5),
|
||||
|
||||
@@ -1,5 +1,32 @@
|
||||
#version 140
|
||||
|
||||
|
||||
// Texturing snippet.
|
||||
//
|
||||
uniform int texture_Count;
|
||||
uniform sampler2D Textures [32];
|
||||
uniform float Fade [32];
|
||||
|
||||
vec4
|
||||
apply_Texturing (vec2 Coords)
|
||||
{
|
||||
vec4 Color = vec4 (0);
|
||||
|
||||
for (int i = 0; i < texture_Count; ++i)
|
||||
{
|
||||
Color.rgb += texture (Textures [i], Coords).rgb
|
||||
* texture (Textures [i], Coords).a
|
||||
* (1.0 - Fade [i]);
|
||||
|
||||
Color.a = max (Color.a, texture (Textures [i],
|
||||
Coords).a);
|
||||
}
|
||||
|
||||
return Color;
|
||||
}
|
||||
|
||||
|
||||
|
||||
struct light
|
||||
{
|
||||
vec4 Site;
|
||||
@@ -15,7 +42,7 @@ uniform mat4 model_Transform;
|
||||
uniform mat3 inverse_model_Rotation;
|
||||
uniform vec3 camera_Site;
|
||||
uniform vec3 specular_Color; // The materials specular color.
|
||||
uniform sampler2D Texture;
|
||||
//uniform sampler2D Texture;
|
||||
uniform int light_Count;
|
||||
uniform light Lights [10];
|
||||
|
||||
@@ -29,6 +56,8 @@ in float frag_Shine;
|
||||
out vec4 final_Color;
|
||||
|
||||
|
||||
|
||||
|
||||
vec3
|
||||
apply_Light (light Light,
|
||||
vec3 surface_Color,
|
||||
@@ -92,16 +121,15 @@ apply_Light (light Light,
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
main()
|
||||
{
|
||||
vec3 surface_Site = vec3 ( model_Transform
|
||||
* vec4 (frag_Site, 1));
|
||||
|
||||
vec4 surface_Color = mix (texture (Texture, frag_Coords),
|
||||
vec4 surface_Color = mix (apply_Texturing (frag_Coords),
|
||||
frag_Color,
|
||||
0.5);
|
||||
|
||||
vec3 Surface_to_Camera = normalize (camera_Site - surface_Site);
|
||||
vec3 Normal = normalize (frag_Normal * inverse_model_Rotation);
|
||||
|
||||
@@ -118,8 +146,7 @@ main()
|
||||
Surface_to_Camera);
|
||||
}
|
||||
|
||||
vec3 Gamma = vec3 (1.0 / 2.2);
|
||||
|
||||
vec3 Gamma = vec3 (1.0 / 2.2);
|
||||
final_Color = vec4 (pow (linear_Color, // Final color (after gamma correction).
|
||||
Gamma),
|
||||
surface_Color.a);
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#version 140
|
||||
// Include 'version.header'.
|
||||
// Include 'texturing.frag'.
|
||||
|
||||
|
||||
struct light
|
||||
{
|
||||
@@ -15,7 +17,7 @@ uniform mat4 model_Transform;
|
||||
uniform mat3 inverse_model_Rotation;
|
||||
uniform vec3 camera_Site;
|
||||
uniform vec3 specular_Color; // The materials specular color.
|
||||
uniform sampler2D Texture;
|
||||
|
||||
uniform int light_Count;
|
||||
uniform light Lights [10];
|
||||
|
||||
@@ -28,6 +30,8 @@ in float frag_Shine;
|
||||
out vec4 final_Color;
|
||||
|
||||
|
||||
|
||||
|
||||
vec3
|
||||
apply_Light (light Light,
|
||||
vec3 surface_Color,
|
||||
@@ -91,18 +95,16 @@ apply_Light (light Light,
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
main()
|
||||
{
|
||||
vec3 surface_Site = vec3 ( model_Transform
|
||||
* vec4 (frag_Site, 1));
|
||||
|
||||
vec4 surface_Color = texture (Texture, frag_Coords);
|
||||
|
||||
vec4 surface_Color = apply_Texturing (frag_Coords);
|
||||
vec3 Surface_to_Camera = normalize (camera_Site - surface_Site);
|
||||
vec3 Normal = normalize ( frag_Normal
|
||||
* inverse_model_Rotation);
|
||||
|
||||
// Combine color from all the lights.
|
||||
//
|
||||
vec3 linear_Color = vec3 (0);
|
||||
@@ -116,8 +118,7 @@ main()
|
||||
Surface_to_Camera);
|
||||
}
|
||||
|
||||
vec3 Gamma = vec3 (1.0 / 2.2);
|
||||
|
||||
vec3 Gamma = vec3 (1.0 / 2.2);
|
||||
final_Color = vec4 (pow (linear_Color, // Final color (after gamma correction).
|
||||
Gamma),
|
||||
surface_Color.a);
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
#version 140
|
||||
// Include 'version.header'.
|
||||
// Include 'texturing.frag'.
|
||||
|
||||
uniform sampler2D sTexture;
|
||||
|
||||
varying vec4 vColor;
|
||||
varying vec2 vCoords;
|
||||
in vec2 frag_Coords;
|
||||
out vec4 final_Color;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = texture2D (sTexture, vCoords) * vColor; // Modulate light color with texture.
|
||||
}
|
||||
final_Color = apply_Texturing (frag_Coords);
|
||||
}
|
||||
@@ -1,25 +1,16 @@
|
||||
#version 140
|
||||
|
||||
uniform mat4 mvp_Transform;
|
||||
uniform vec3 Scale;
|
||||
uniform mat4 mvp_Transform;
|
||||
uniform vec3 Scale;
|
||||
|
||||
in vec3 Site;
|
||||
in vec2 Coords;
|
||||
|
||||
attribute vec3 Site;
|
||||
attribute vec2 Coords;
|
||||
|
||||
|
||||
varying vec4 vColor;
|
||||
varying vec2 vCoords;
|
||||
|
||||
|
||||
const float c_zero = 0.0;
|
||||
const float c_one = 1.0;
|
||||
out vec2 frag_Coords;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
frag_Coords = Coords;
|
||||
gl_Position = mvp_Transform * vec4 (Site * Scale, 1.0);
|
||||
|
||||
vColor = vec4 (1.0, 1.0, 1.0, 1.0);
|
||||
vCoords = Coords;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user