!!ARBvp1.0 OPTION ARB_position_invariant; ATTRIB v1 = vertex.texcoord[0]; # 3F ATTRIB v2 = vertex.texcoord[1]; # 3F ATTRIB up1 = vertex.texcoord[2]; # 3F ATTRIB up2 = vertex.texcoord[3]; # 3F PARAM lightpos = program.env[0]; # # transform v1, v2 into eye space here, or on CPU? TEMP v1dir, v2dir; SUB v1dir.xyz, v1, lightpos; DP3 v1dir.w, v1dir, v1dir; RSQ v1dir.w, v1dir.w; MUL v1dir.xyz, v1dir, v1dir.w; SUB v2dir.xyz, v2, lightpos; DP3 v2dir.w, v2dir, v2dir; RSQ v2dir.w, v2dir.w; MUL v2dir.xyz, v2dir, v2dir.w; TEMP lightbottom1, lightbottom2; MAD lightbottom1, -up1, lightpos.w, lightpos; MAD lightbottom2, -up2, lightpos.w, lightpos; TEMP v1fdir, v2fdir; SUB v1fdir.xyz, v1, lightbottom1; DP3 v1fdir.w, v1fdir, v1fdir; RSQ v1fdir.w, v1fdir.w; MUL v1fdir.xyz, v1fdir, v1fdir.w; SUB v2fdir.xyz, v2, lightbottom2; DP3 v2fdir.w, v2fdir, v2fdir; RSQ v2fdir.w, v2fdir.w; MUL v2fdir.xyz, v2fdir, v2fdir.w; TEMP planef, planeb, planel, planer; XPD planeb, v2dir, v1dir; DP3 planeb.w, planeb, -v1; XPD planef, v1fdir, v2fdir; DP3 planef.w, planef, -v1; XPD planel, v1dir, v1fdir; DP3 planel.w, planel, -v1; XPD planer, v2fdir, v2dir; DP3 planer.w, planer, -v2; TEMP edge; SUB edge.xyz, v2, v1; DP3 edge.w, edge, edge; RSQ edge.w, edge.w; MUL edge.xyz, edge, edge.w; TEMP hit; DP3 hit.x, edge, planel; RCP hit.x, hit.x; MUL planel, planel, hit.x; DP3 hit.y, -edge, planer; RCP hit.y, hit.y; MUL planer, planer, hit.y; MOV result.texcoord[0], planeb; MOV result.texcoord[1], planef; MOV result.texcoord[2], planel; MOV result.texcoord[3], planer; MOV result.texcoord[4], up1; MOV result.texcoord[5], up2; END !!ARBfp1.0 ATTRIB planeb = fragment.texcoord[0]; ATTRIB planef = fragment.texcoord[1]; ATTRIB planel = fragment.texcoord[2]; ATTRIB planer = fragment.texcoord[3]; ATTRIB up1 = fragment.texcoord[4]; ATTRIB up2 = fragment.texcoord[5]; TEMP surface; TEX surface, fragment.position, texture[0], RECT; TEMP dist; DP4 dist.x, surface, planel; DP4 dist.y, surface, planer; DP4 dist.z, surface, planeb; DP4 dist.w, surface, planef; KIL dist; ADD dist.y, dist.y, dist.x; RCP dist.y, dist.y; MUL dist.x, dist.x, dist.y; TEMP dir; LRP dir, up2, up1, dist.x; DP3 dir.w, dir, dir; RSQ dir.w, dir.w; MUL dir.xyz, dir, dir.w; TEMP hit; DP3 hit.z, planeb, dir; RCP hit.z, hit.z; DP3 hit.w, planef, -dir; RCP hit.w, hit.w; MUL dist.zw, dist, hit; ADD dist.z, dist.z, dist.w; RCP dist.z, dist.z; MUL dist.w, dist.w, dist.z; MOV result.color, dist.w; END