.. | .. |
---|
881 | 881 | //// tris.postdraw(this); |
---|
882 | 882 | } |
---|
883 | 883 | |
---|
884 | | - static Camera localcamera = new Camera(); |
---|
| 884 | + static Camera localAOcamera = new Camera(); |
---|
885 | 885 | static cVector from = new cVector(); |
---|
886 | 886 | static cVector to = new cVector(); |
---|
887 | 887 | |
---|
.. | .. |
---|
890 | 890 | CameraPane cp = this; |
---|
891 | 891 | |
---|
892 | 892 | Camera keep = cp.RenderCamera(); |
---|
893 | | - cp.renderCamera = localcamera; |
---|
| 893 | + cp.renderCamera = localAOcamera; |
---|
894 | 894 | |
---|
895 | 895 | if (br.trimmed) |
---|
896 | 896 | { |
---|
.. | .. |
---|
908 | 908 | br.positions[i3 + 2] + br.normals[i3 + 2]); |
---|
909 | 909 | LA.xformPos(from, transform, from); |
---|
910 | 910 | LA.xformPos(to, transform, to); // RIGID ONLY |
---|
911 | | - localcamera.setAim(from, to); |
---|
| 911 | + localAOcamera.setAim(from, to); |
---|
912 | 912 | |
---|
913 | 913 | CameraPane.occlusionbuffer.display(); |
---|
914 | 914 | |
---|
.. | .. |
---|
942 | 942 | to.set(v.x+v.norm.x, v.y+v.norm.y, v.z+v.norm.z); |
---|
943 | 943 | LA.xformPos(from, transform, from); |
---|
944 | 944 | LA.xformPos(to, transform, to); // RIGID ONLY |
---|
945 | | - localcamera.setAim(from, to); |
---|
| 945 | + localAOcamera.setAim(from, to); |
---|
946 | 946 | |
---|
947 | 947 | CameraPane.occlusionbuffer.display(); |
---|
948 | 948 | |
---|
.. | .. |
---|
12514 | 12514 | String programmin = |
---|
12515 | 12515 | // Min shader |
---|
12516 | 12516 | "!!ARBfp1.0\n" + |
---|
12517 | | - "PARAM zero123 = { 0.0, 1.0, 2, 1.25 };" + |
---|
12518 | | - "PARAM pow2 = { 0.5, 0.25, 0.125, 0.0 };" + |
---|
| 12517 | + "PARAM zero12t = { 0.0, 1.0, 2, 1.25 };" + |
---|
| 12518 | + "PARAM pow_2 = { 0.5, 0.25, 0.125, 0.0 };" + |
---|
| 12519 | + "PARAM pow2 = { 2, 4, 8, 0.0 };" + |
---|
12519 | 12520 | "PARAM one = { 1.0, 1.0, 1.0, 1.0 };" + |
---|
12520 | 12521 | "PARAM eps = { 0.001, 0.001, 0.001, 1.0 };" + |
---|
12521 | 12522 | "PARAM infinity = { 100000000, 100000000, 100000000, 1.0 };" + |
---|
.. | .. |
---|
12530 | 12531 | "TEMP eye;" + |
---|
12531 | 12532 | "TEMP pos;" + |
---|
12532 | 12533 | |
---|
12533 | | - "MAD normal, fragment.color, zero123.z, -zero123.y;" + |
---|
| 12534 | + "MAD normal, fragment.color, zero12t.z, -zero12t.y;" + |
---|
12534 | 12535 | Normalize("normal") + |
---|
12535 | 12536 | "MOV light, state.light[0].position;" + |
---|
12536 | 12537 | "DP3 ndotl.x, light, normal;" + |
---|
| 12538 | + "MAX ndotl.x, ndotl.x, zero12t.x;" + |
---|
12537 | 12539 | |
---|
12538 | 12540 | // shadow |
---|
12539 | 12541 | "MOV pos, fragment.texcoord[1];" + |
---|
.. | .. |
---|
12549 | 12551 | "MUL ndotl.x, ndotl.x, ndotl.z;" + // Shadow |
---|
12550 | 12552 | |
---|
12551 | 12553 | // Backlit |
---|
12552 | | - "MOV pos.w, zero123.y;" + |
---|
| 12554 | + "MOV pos.w, zero12t.y;" + // one |
---|
12553 | 12555 | "DP4 eye.x, pos, light2cam0;" + |
---|
12554 | 12556 | "DP4 eye.y, pos, light2cam1;" + |
---|
12555 | 12557 | "DP4 eye.z, pos, light2cam2;" + |
---|
.. | .. |
---|
12557 | 12559 | |
---|
12558 | 12560 | "DP3 ndotl.y, -eye, normal;" + |
---|
12559 | 12561 | //"MUL ndotl.y, ndotl.y, pow2.x;" + |
---|
12560 | | - "POW ndotl.y, ndotl.y, pow2.z;" + // backlit |
---|
12561 | | - "SUB ndotl.y, zero123.y, ndotl.y;" + |
---|
| 12562 | + "POW ndotl.y, ndotl.y, pow2.x;" + // backlit |
---|
| 12563 | + "SUB ndotl.y, zero12t.y, ndotl.y;" + // 1 - y |
---|
| 12564 | + //"POW ndotl.y, ndotl.y, pow2.z;" + // backlit |
---|
12562 | 12565 | //"SUB ndotl.y, zero123.y, ndotl.y;" + |
---|
12563 | 12566 | //"MUL ndotl.y, ndotl.y, pow2.z;" + |
---|
| 12567 | + "ADD ndotl.y, ndotl.y, one.x;" + |
---|
| 12568 | + "MUL ndotl.y, ndotl.y, pow_2.x;" + |
---|
12564 | 12569 | |
---|
12565 | 12570 | //"MAX ndotl.x, ndotl.x, ndotl.y;" + // Ambient |
---|
12566 | 12571 | //"MAX ndotl.x, ndotl.x, pow2.y;" + // Ambient |
---|
12567 | 12572 | |
---|
12568 | 12573 | // Pigment |
---|
12569 | 12574 | "TEX temp, fragment.texcoord[0], texture[0], 2D;" + |
---|
12570 | | - "LRP temp, zero123.w, temp, one;" + // texture proportion |
---|
12571 | | - "MUL temp, temp, ndotl.x;" + |
---|
12572 | | - |
---|
12573 | | - "MUL temp, temp, zero123.z;" + |
---|
| 12575 | + "LRP temp, zero12t.w, temp, one;" + // texture proportion |
---|
| 12576 | + "MUL temp, temp, zero12t.w;" + // Times x |
---|
12574 | 12577 | |
---|
12575 | 12578 | //"MUL temp, temp, ndotl.y;" + |
---|
| 12579 | + "MAD ndotl.x, pow_2.xxxx, ndotl.yyyy, ndotl.x;" + |
---|
12576 | 12580 | |
---|
12577 | | - "MOV temp.w, zero123.y;" + // reset alpha |
---|
| 12581 | + "MUL temp, temp, ndotl.x;" + // lambert |
---|
| 12582 | + |
---|
| 12583 | + "MOV temp.w, zero12t.y;" + // reset alpha |
---|
12578 | 12584 | "MOV result.color, temp;" + |
---|
12579 | 12585 | "END"; |
---|
12580 | 12586 | |
---|
.. | .. |
---|
12999 | 13005 | "POW temp.a, temp.a, params6.w;" + // punch through |
---|
13000 | 13006 | |
---|
13001 | 13007 | "ADD texSamp, temp, texSamp;" + |
---|
13002 | | - "MUL temp.xyz, half, texSamp;" + |
---|
| 13008 | + "MUL texSamp.xyz, half, texSamp;" + |
---|
13003 | 13009 | |
---|
13004 | 13010 | "MOV alpha, texSamp.aaaa;" + |
---|
13005 | 13011 | |
---|
.. | .. |
---|
15504 | 15510 | repaint(); |
---|
15505 | 15511 | break; |
---|
15506 | 15512 | case 'O': |
---|
15507 | | - Globals.drawMode = OCCLUSION; // WARNING |
---|
| 15513 | + // Too dangerous. Use menu. Globals.drawMode = OCCLUSION; // WARNING |
---|
15508 | 15514 | repaint(); |
---|
15509 | 15515 | break; |
---|
15510 | 15516 | case 'o': |
---|