0 Members and 1 Guest are viewing this topic.

renderProgram water/shoreline_froth { program vertex arb { <% OPTION ARB_position_invariant; TEMP R0, R1, R2, bitangent; XPD bitangent, $normalAttrib, $tangentAttrib; MUL bitangent, bitangent, $tangentAttrib.w; # bumpmap texture coords DP4 result.texcoord[0].x, $texCoordAttrib, $diffuseMatrix_s; DP4 result.texcoord[0].y, $texCoordAttrib, $diffuseMatrix_t; # vector to eye SUB R1, $positionAttrib, $viewOrigin; DP3 result.texcoord[3].x, R1, $transposedModelMatrix_x; DP3 result.texcoord[3].y, R1, $transposedModelMatrix_y; DP3 result.texcoord[3].z, R1, $transposedModelMatrix_z; # tangent->world matrix DP3 result.texcoord[4].x, $tangentAttrib, $transposedModelMatrix_x; DP3 result.texcoord[4].y, bitangent, $transposedModelMatrix_x; DP3 result.texcoord[4].z, $normalAttrib, $transposedModelMatrix_x; DP3 result.texcoord[5].x, $tangentAttrib, $transposedModelMatrix_y; DP3 result.texcoord[5].y, bitangent, $transposedModelMatrix_y; DP3 result.texcoord[5].z, $normalAttrib, $transposedModelMatrix_y; DP3 result.texcoord[6].x, $tangentAttrib, $transposedModelMatrix_z; DP3 result.texcoord[6].y, bitangent, $transposedModelMatrix_z; DP3 result.texcoord[6].z, $normalAttrib, $transposedModelMatrix_z; MAD R0, $colorAttrib, $colorModulate, $colorAdd; MUL result.color, $diffuseColor, R0; %> } program fragment arb { <% OPTION ARB_precision_hint_fastest; TEMP R0, R1, R2, R3, R4, eye, mix, spec; # get diffuse TEX R1, fragment.texcoord[0], $diffuseMap, 2D; # get normal from normal map TEX R0, fragment.texcoord[0], $bumpMap, 2D; $if !r_dxnNormalMaps MOV R0.x, R0.a; $endif MAD R2, R0, 2, -1; $if r_normalizeNormalMaps TEMP NR1; MOV R2.z, 0; DP3 NR1.x, R2,R2; ADD NR1.x, 1, -NR1.x; RSQ NR1.x, NR1.x; RCP R2.z, NR1.x; $endif # put in world space DP3 R0.x, R2, fragment.texcoord[4]; DP3 R0.y, R2, fragment.texcoord[5]; DP3 R0.z, R2, fragment.texcoord[6]; # normalize to eye DP3 eye.w, fragment.texcoord[3], fragment.texcoord[3]; RSQ eye.w, eye.w; MUL eye, fragment.texcoord[3], eye.w; # calc reflection vector: i - 2 * dot(i, n) * n DP3 R2, eye, R0; MUL R2, R2, 2; MAD R4, -R0, R2.x, eye; # specular DP3_SAT R0, R4, $sunDirection; TEX spec, R0, $map, 2D; MUL spec, spec, $sunColor; MUL spec, spec, $water_glare; MUL spec, spec, fragment.color.r; MOV spec.a, 0; ADD result.color, spec, R1; MUL result.color.a, R1, fragment.color.a; #MOV result.color, fragment.color.a; #MAD result.color, R4, 0.5, 0.5; %> }}renderProgram water/shoreline_wetshine { program vertex arb { <% OPTION ARB_position_invariant; TEMP R0, R1, R2, bitangent; XPD bitangent, $normalAttrib, $tangentAttrib; MUL bitangent, bitangent, $tangentAttrib.w; # bumpmap texture coords DP4 result.texcoord[0].x, $texCoordAttrib, $diffuseMatrix_s; DP4 result.texcoord[0].y, $texCoordAttrib, $diffuseMatrix_t; # sand texture coords DP4 result.texcoord[1].x, $texCoordAttrib, $bumpMatrix_s; DP4 result.texcoord[1].y, $texCoordAttrib, $bumpMatrix_t; # vector to eye SUB R1, $positionAttrib, $viewOrigin; DP3 result.texcoord[3].x, R1, $transposedModelMatrix_x; DP3 result.texcoord[3].y, R1, $transposedModelMatrix_y; DP3 result.texcoord[3].z, R1, $transposedModelMatrix_z; # tangent->world matrix DP3 result.texcoord[4].x, $tangentAttrib, $transposedModelMatrix_x; DP3 result.texcoord[4].y, bitangent, $transposedModelMatrix_x; DP3 result.texcoord[4].z, $normalAttrib, $transposedModelMatrix_x; DP3 result.texcoord[5].x, $tangentAttrib, $transposedModelMatrix_y; DP3 result.texcoord[5].y, bitangent, $transposedModelMatrix_y; DP3 result.texcoord[5].z, $normalAttrib, $transposedModelMatrix_y; DP3 result.texcoord[6].x, $tangentAttrib, $transposedModelMatrix_z; DP3 result.texcoord[6].y, bitangent, $transposedModelMatrix_z; DP3 result.texcoord[6].z, $normalAttrib, $transposedModelMatrix_z; MAD R0, $colorAttrib, $colorModulate, $colorAdd; MUL result.color, $diffuseColor, R0; %> } program fragment arb { <% OPTION ARB_precision_hint_fastest; TEMP R0, R1, R2, R3, R4, eye, mix, spec; # get diffuse-mask TEX R1, fragment.texcoord[0], $diffuseMap, 2D; # get normal from normal map TEX R0, fragment.texcoord[1], $bumpMap, 2D; $if !r_dxnNormalMaps MOV R0.x, R0.a; $endif MAD R2, R0, 2, -1; $if r_normalizeNormalMaps TEMP NR1; MOV R2.z, 0; DP3 NR1.x, R2,R2; ADD NR1.x, 1, -NR1.x; RSQ NR1.x, NR1.x; RCP R2.z, NR1.x; $endif # put in world space DP3 R0.x, R2, fragment.texcoord[4]; DP3 R0.y, R2, fragment.texcoord[5]; DP3 R0.z, R2, fragment.texcoord[6]; # normalize to eye DP3 eye.w, fragment.texcoord[3], fragment.texcoord[3]; RSQ eye.w, eye.w; MUL eye, fragment.texcoord[3], eye.w; # calc reflection vector: i - 2 * dot(i, n) * n DP3 R2, eye, R0; MUL R2, R2, 2; MAD R4, -R0, R2.x, eye; # specular DP3_SAT R0, R4, $sunDirection; TEX spec, R0, $map, 2D; MUL spec, spec, $sunColor; MUL spec, spec, $water_glare; MUL spec, spec, R1.x; MUL result.color, spec, fragment.color.r; %> }}