!!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 planeb, planel, planer; XPD planeb, v2dir, v1dir; DP3 planeb.w, planeb, -v2; 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], planel; MOV result.texcoord[2], planer; TEMP forward1, forward2; DP3 forward1.w, up1, edge; MAD forward1.xyz, -edge, forward1.w, up1; DP3 forward1.w, forward1, forward1; RSQ forward1.w, forward1.w; MUL forward1.xyz, forward1, forward1.w; DP3 forward2.w, up2, edge; MAD forward2.xyz, -edge, forward2.w, up2; DP3 forward2.w, forward2, forward2; RSQ forward2.w, forward2.w; MUL forward2.xyz, forward2, forward2.w; TEMP scale1, scale2, planef1, planef2; DP3 scale1.x, forward1, planeb; MUL planef1.w, scale1.x, v1dir.w; MUL planef1.w, planef1.w, lightpos.w; MUL planef1.xyz, v1dir, planef1.w; DP3 planef1.w, planef1, -v1; DP3 scale2.x, forward2, planeb; MUL planef2.w, scale2.x, v2dir.w; MUL planef2.w, planef2.w, lightpos.w; MUL planef2.xyz, v2dir, planef2.w; DP3 planef2.w, planef2, -v2; MOV result.texcoord[3], planef1; MOV result.texcoord[4], planef2; TEMP cone1, cone2; # find plane of cone start XPD cone1, forward1, v1dir; DP3 cone1.w, cone1, -v1; DP3 scale1.y, cone1, -edge; RCP scale1.y, scale1.y; MUL scale1.x, scale1.x, scale1.y; MUL cone1, cone1, scale1.x; # find plane of cone start XPD cone2, v2dir, forward2; DP3 cone2.w, cone2, -v2; DP3 scale2.y, cone2, edge; RCP scale2.y, scale2.y; MUL scale2.x, scale2.x, scale2.y; MUL cone2, cone2, scale2.x; MOV result.texcoord[5], cone1; MOV result.texcoord[6], cone2; END !!ARBfp1.0 ATTRIB planeb = fragment.texcoord[0]; ATTRIB planel = fragment.texcoord[1]; ATTRIB planer = fragment.texcoord[2]; ATTRIB planef1 = fragment.texcoord[3]; ATTRIB planef2 = fragment.texcoord[4]; ATTRIB cone1 = fragment.texcoord[5]; ATTRIB cone2 = fragment.texcoord[6]; 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; KIL dist.xyzz; TEMP fdist; DP4 fdist.x, surface, planef1; DP4 fdist.y, surface, planef2; MAX fdist.z, fdist.x, fdist.y; SUB fdist.z, fdist.z, dist.z; KIL fdist.z; DP4 dist.x, surface, cone1; DP4 dist.y, surface, cone2; TEMP side; MOV_SAT side, -dist; ADD side.y, side.y, side.x; RCP side.y, side.y; MUL side.x, side.x, side.y; LRP fdist.z, side.x, fdist.y, fdist.x; RCP fdist.z, fdist.z; MUL_SAT dist.xyz, dist, fdist.z; DP3 dist.w, dist, dist; PARAM half = 0.5; POW result.color, dist.w, half.x; END