X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fprogram.cpp;h=729018a1a4b1edc69438d426c32426e82b19b09b;hb=01d2500733766710f4a11f49216a5b3dcc75a4a3;hp=adbb5c4cfd1a4ccf7ffd3fe41dc75646c33a1a6c;hpb=6afbace895a7bbcf216ab8e48280ea0303ab5892;p=libs%2Fgl.git diff --git a/source/program.cpp b/source/program.cpp index adbb5c4c..729018a1 100644 --- a/source/program.cpp +++ b/source/program.cpp @@ -17,6 +17,7 @@ namespace { const char *standard_vertex_src[] = { + "s", "uniform int shadow_unit;\n", "n", "attribute vec3 tangent;\n", "n", "attribute vec3 binormal;\n", "t|n", "varying vec2 v_texcoord;\n", @@ -46,7 +47,7 @@ const char *standard_vertex_src[] = "p|en", "\tv_eye_dir = vec3(dot(eye_tangent, eye_dir), dot(eye_binormal, eye_dir), dot(eye_normal, eye_dir));\n", "p|e!n", "\tv_eye_dir = eye_dir;\n", "t|n", "\tv_texcoord = gl_MultiTexCoord0.xy;\n", - "s", "\tv_shadowcoord = vec3(dot(gl_EyePlaneS[3], eye_pos), dot(gl_EyePlaneT[3], eye_pos), dot(gl_EyePlaneR[3], eye_pos));\n", + "s", "\tv_shadowcoord = vec3(dot(gl_EyePlaneS[shadow_unit], eye_pos), dot(gl_EyePlaneT[shadow_unit], eye_pos), dot(gl_EyePlaneR[shadow_unit], eye_pos));\n", "!lm", "\tv_color = gl_Color;\n", 0, "}", 0, 0 @@ -78,9 +79,10 @@ const char *standard_fragment_src[] = "e", "\tvec4 reflection = textureCube(environment, n_normal*(dot(n_normal, v_eye_dir)*2.0)-v_eye_dir);\n", "t", "\tvec4 tex_sample = texture2D(texture, v_texcoord);\n", 0, "\tgl_FragColor.rgb = ", - "!t!l!m", "vec3(1.0)", + "!t!m", "vec3(1.0)", "t", "tex_sample.rgb", "l|mt", "*", + "l!m!t", "*", "!lm", "v_color.rgb", "l", "((l_diffuse", "lm", "*gl_FrontLightProduct[0].diffuse.rgb", @@ -93,10 +95,11 @@ const char *standard_fragment_src[] = "e", "+reflection.rgb*reflectivity", 0, ";\n", 0, "\tgl_FragColor.a = ", - "!m", "1.0", + "!t!m", "1.0", + "t", "tex_sample.a", + "tm", "*", "!lm", "v_color.a", "lm", "gl_FrontMaterial.diffuse.a", - "t", "*tex_sample.a", 0, ";\n", 0, "}\n", 0, 0