Removed redudent shaders, and updated remaining shaders to match OpenSceneGraph-Data/shaders

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14705 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield 2015-02-20 15:04:56 +00:00
parent afbf20eba9
commit 72c4f3a8ba
7 changed files with 61 additions and 76 deletions

View File

@ -1,21 +0,0 @@
char terrain_displacement_mapping_CCC_frag[] = "uniform sampler2D colorTexture1;\n"
"uniform sampler2D colorTexture2;\n"
"uniform sampler2D colorTexture3;\n"
"\n"
"varying vec2 texcoord;\n"
"varying vec4 basecolor;\n"
"\n"
"void main(void)\n"
"{\n"
"#ifdef GL_TEXTURE_2D\n"
" const float multiplier = 1.0/3.0;\n"
" vec4 color = texture2D( colorTexture1, texcoord)*multiplier +\n"
" texture2D( colorTexture2, texcoord)*multiplier +\n"
" texture2D( colorTexture3, texcoord)*multiplier;\n"
"\n"
" gl_FragColor = basecolor * color;\n"
"#else\n"
" gl_FragColor = basecolor;\n"
"#endif\n"
"}\n"
"\n";

View File

@ -1,19 +0,0 @@
char terrain_displacement_mapping_CC_frag[] = "uniform sampler2D colorTexture1;\n"
"uniform sampler2D colorTexture2;\n"
"\n"
"varying vec2 texcoord;\n"
"varying vec4 basecolor;\n"
"\n"
"void main(void)\n"
"{\n"
"#ifdef GL_TEXTURE_2D\n"
" const float multiplier = 1.0/2.0;\n"
" vec4 color = texture2D( colorTexture1, texcoord)*multiplier +\n"
" texture2D( colorTexture2, texcoord)*multiplier;\n"
"\n"
" gl_FragColor = basecolor * color;\n"
"#else\n"
" gl_FragColor = basecolor;\n"
"#endif\n"
"}\n"
"\n";

View File

@ -1,15 +0,0 @@
char terrain_displacement_mapping_C_frag[] = "uniform sampler2D colorTexture1;\n"
"\n"
"varying vec2 texcoord;\n"
"varying vec4 basecolor;\n"
"\n"
"void main(void)\n"
"{\n"
"#ifdef GL_TEXTURE_2D\n"
" vec4 color = texture2D( colorTexture1, texcoord);\n"
" gl_FragColor = basecolor * color;\n"
"#else\n"
" gl_FragColor = basecolor;\n"
"#endif\n"
"}\n"
"\n";

View File

@ -1,18 +0,0 @@
char terrain_displacement_mapping_flat_vert[] = "varying vec2 texcoord;\n"
"varying vec4 basecolor;\n"
"\n"
"void main(void)\n"
"{\n"
" texcoord = gl_MultiTexCoord0.xy;\n"
"\n"
" float height_center = 0;\n"
"\n"
" // note, need to introduce a proper lighting computation based on the gl_Normal.xyz\n"
" vec3 normal = vec3(0.0, 0.0, 1.0);\n"
" float intensity = normal.z;\n"
" basecolor = vec4(intensity, intensity, intensity, 1.0);\n"
"\n"
" vec3 position = gl_Vertex.xyz + gl_Normal.xyz * height_center ;\n"
" gl_Position = gl_ModelViewProjectionMatrix * vec4(position,1.0);\n"
"};\n"
"\n";

View File

@ -1,7 +1,49 @@
char terrain_displacement_mapping_frag[] = "varying vec4 basecolor;\n"
char terrain_displacement_mapping_frag[] = "#pragma import_defines ( TEXTURE_2D, TEXTURE_WEIGHTS, COLOR_LAYER0, COLOR_LAYER1, COLOR_LAYER2)\n"
"\n"
"\n"
"#if defined(TEXTURE_2D) && defined(COLOR_LAYER0)\n"
"uniform sampler2D colorTexture0;\n"
"#endif\n"
"\n"
"#if defined(TEXTURE_2D) && defined(COLOR_LAYER1)\n"
"uniform sampler2D colorTexture1;\n"
"#endif\n"
"\n"
"#if defined(TEXTURE_2D) && defined(COLOR_LAYER2)\n"
"uniform sampler2D colorTexture2;\n"
"#endif\n"
"\n"
"\n"
"#if defined(TEXTURE_2D) && defined(TEXTURE_WEIGHTS)\n"
"uniform float TextureWeights[];\n"
"#define WEIGHTS_LOOKUP(i) TextureWeights[i]\n"
"#else\n"
"#define WEIGHTS_LOOKUP(i) 1.0\n"
"#endif\n"
"\n"
"varying vec2 texcoord;\n"
"varying vec4 basecolor;\n"
"\n"
"void main(void)\n"
"{\n"
"#ifdef TEXTURE_2D\n"
" vec4 color = vec4(0.0, 0.0, 0.0, 0.0);\n"
"\n"
" #ifdef COLOR_LAYER0\n"
" color = color + texture2D( colorTexture0, texcoord)*WEIGHTS_LOOKUP(0);\n"
" #endif\n"
"\n"
" #ifdef COLOR_LAYER1\n"
" color = color + texture2D( colorTexture1, texcoord)*WEIGHTS_LOOKUP(1);\n"
" #endif\n"
"\n"
" #ifdef COLOR_LAYER2\n"
" color = color + texture2D( colorTexture2, texcoord)*WEIGHTS_LOOKUP(2);\n"
" #endif\n"
"\n"
" gl_FragColor = basecolor * color;\n"
"#else\n"
" gl_FragColor = basecolor;\n"
"#endif\n"
"}\n"
"\n";

View File

@ -1,4 +1,7 @@
char terrain_displacement_mapping_geom[] = "#version 120\n"
"\n"
"#pragma requires(COMPUTE_DIAGONALS)\n"
"\n"
"#extension GL_EXT_geometry_shader4 : enable\n"
"\n"
"varying in vec3 normals_in[4];\n"

View File

@ -1,9 +1,14 @@
char terrain_displacement_mapping_vert[] = "#version 120\n"
"\n"
"#pragma import_defines ( HEIGHTFIELD_LAYER, COMPUTE_DIAGONALS, LIGHTING )\n"
"\n"
"#ifdef COMPUTE_DIAGONALS\n"
"#extension GL_EXT_geometry_shader4 : enable\n"
"#endif\n"
"\n"
"#ifdef HEIGHTFIELD_LAYER\n"
"uniform sampler2D terrainTexture;\n"
"#endif\n"
"\n"
"#ifdef COMPUTE_DIAGONALS\n"
"varying vec2 texcoord_in;\n"
@ -15,7 +20,7 @@ char terrain_displacement_mapping_vert[] = "#version 120\n"
"#endif\n"
"\n"
"\n"
"#ifdef GL_LIGHTING\n"
"#ifdef LIGHTING\n"
"// forward declare lighting computation, provided by lighting.vert shader\n"
"void directionalLight( int lightNum, vec3 normal, inout vec4 color );\n"
"#endif\n"
@ -24,9 +29,13 @@ char terrain_displacement_mapping_vert[] = "#version 120\n"
"{\n"
" vec2 texcoord_center = gl_MultiTexCoord0.xy;\n"
"\n"
"#ifdef HEIGHTFIELD_LAYER\n"
" float height_center = texture2D(terrainTexture, texcoord_center).r;\n"
"#else\n"
" float height_center = 0.0;\n"
"#endif\n"
"\n"
"#ifdef GL_LIGHTING\n"
"#if defined(LIGHTING) && defined(HEIGHTFIELD_LAYER)\n"
" vec2 texelWorldRatio = gl_MultiTexCoord0.zw;\n"
" vec2 texelTexcoordSize = gl_Color.xy;\n"
"\n"
@ -94,6 +103,10 @@ char terrain_displacement_mapping_vert[] = "#version 120\n"
" vec4 color = vec4(1.0,1.0,1.0,1.0);\n"
" directionalLight( 0, normal, color);\n"
"\n"
"#elif defined(LIGHTING)\n"
" vec3 normal = gl_Normal.xyz;\n"
" vec4 color = vec4(1.0, 1.0, 1.0, 1.0);\n"
" directionalLight( 0, normal, color);\n"
"#else\n"
" vec3 normal = gl_Normal.xyz;\n"
" vec4 color = vec4(1.0, 1.0, 1.0, 1.0);\n"