!!ARBvp1.0 PARAM sunColor = program.local[0]; PARAM textureTransform = program.local[1]; PARAM losTransform = program.local[2]; PARAM shadowTransform[4] = { program.local[3..6] }; #if USE_FP_SHADOW && USE_SHADOW_PCF PARAM shadowScale = program.local[7]; #endif TEMP lighting; //// Compute position and normal: ATTRIB position = vertex.position; DP4 result.position.x, state.matrix.mvp.row[0], position; DP4 result.position.y, state.matrix.mvp.row[1], position; DP4 result.position.z, state.matrix.mvp.row[2], position; DP4 result.position.w, state.matrix.mvp.row[3], position; //// Compute lighting: // Diffuse factor is precomputed in vertex attribute // Scale diffuse to allow overbrightness (since result.color will be clamped to [0, 1]) MUL lighting, vertex.color, 0.5; // Apply light colour MUL result.color, lighting, sunColor; //// Texture coordinates: #if DECAL MOV result.texcoord[0], vertex.texcoord[0]; #else // Compute texcoords from position and terrain-texture-dependent transform. // textureTransform is stored as [c, -s, s, 0], // and we want texcoord = (x*c + z*-s, x*-s + z*-c, 0, 1) DP3 result.texcoord[0].x, textureTransform.xyww, position.xzww; DP3 result.texcoord[0].y, -textureTransform.zxww, position.xzww; MOV result.texcoord[0].z, 0; MOV result.texcoord[0].w, 1; #endif #if BLEND MOV result.texcoord[1], vertex.texcoord[1]; #endif #if USE_SHADOW #if USE_FP_SHADOW && USE_SHADOW_PCF TEMP shadowtc; DP4 shadowtc.x, shadowTransform[0], position; DP4 shadowtc.y, shadowTransform[1], position; MUL result.texcoord[2].xy, shadowtc, shadowScale; #else DP4 result.texcoord[2].x, shadowTransform[0], position; DP4 result.texcoord[2].y, shadowTransform[1], position; #endif DP4 result.texcoord[2].z, shadowTransform[2], position; DP4 result.texcoord[2].w, shadowTransform[3], position; #endif MAD result.texcoord[3], position.xzzz, losTransform.x, losTransform.y; END