| .. | .. |
|---|
| 71 | 71 | perspective = false; |
|---|
| 72 | 72 | break; |
|---|
| 73 | 73 | case 4: // Default light |
|---|
| 74 | | - location = LA.newVector(-5, 20, 10); |
|---|
| 74 | + location = LA.newVector(-5, 15, 10); |
|---|
| 75 | 75 | perspective = false; |
|---|
| 76 | 76 | break; |
|---|
| 77 | 77 | } |
|---|
| .. | .. |
|---|
| 106 | 106 | background = LA.newVector(0.8, 0.8, 0.8); |
|---|
| 107 | 107 | } |
|---|
| 108 | 108 | |
|---|
| 109 | + void CreateMaterial(boolean multiply) |
|---|
| 110 | + { |
|---|
| 111 | + super.CreateMaterial(multiply); |
|---|
| 112 | + |
|---|
| 113 | + material.shift = 90; |
|---|
| 114 | + material.cameralight = 0.2f; |
|---|
| 115 | + } |
|---|
| 116 | + |
|---|
| 109 | 117 | void setAspect(int width, int height) |
|---|
| 110 | 118 | { |
|---|
| 111 | 119 | //hAspect = width; |
|---|
| .. | .. |
|---|
| 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 | |
|---|
| .. | .. |
|---|
| 15 | 15 | material.specular = 0.001f; |
|---|
| 16 | 16 | material.diffuse = 0.01f; |
|---|
| 17 | 17 | material.cameralight = 0.001f; |
|---|
| 18 | | - material.opacity = 0.5f; |
|---|
| 18 | + material.opacity = 0.25f; |
|---|
| 19 | 19 | |
|---|
| 20 | 20 | flipV = true; |
|---|
| 21 | 21 | } |
|---|
| .. | .. |
|---|
| 2129 | 2129 | switch(axis) |
|---|
| 2130 | 2130 | { |
|---|
| 2131 | 2131 | case 0 : |
|---|
| 2132 | | - vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z; |
|---|
| 2133 | | - vert2.x = minima.x; vert2.y = maxima.y; vert2.z = minima.z; |
|---|
| 2134 | | - vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z; |
|---|
| 2135 | | - vert4.x = minima.x; vert4.y = maxima.y; vert4.z = maxima.z; |
|---|
| 2132 | + vert1.x = minima.x + 0.001f; vert1.y = minima.y; vert1.z = minima.z; |
|---|
| 2133 | + vert2.x = minima.x + 0.001f; vert2.y = maxima.y; vert2.z = minima.z; |
|---|
| 2134 | + vert3.x = minima.x + 0.001f; vert3.y = minima.y; vert3.z = maxima.z; |
|---|
| 2135 | + vert4.x = minima.x + 0.001f; vert4.y = maxima.y; vert4.z = maxima.z; |
|---|
| 2136 | 2136 | norm = cVector.X; |
|---|
| 2137 | 2137 | break; |
|---|
| 2138 | 2138 | case 1 : |
|---|
| 2139 | | - vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z; |
|---|
| 2140 | | - vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z; |
|---|
| 2141 | | - vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z; |
|---|
| 2142 | | - vert4.x = maxima.x; vert4.y = minima.y; vert4.z = maxima.z; |
|---|
| 2139 | + vert1.x = minima.x; vert1.y = minima.y + 0.001f; vert1.z = minima.z; |
|---|
| 2140 | + vert2.x = maxima.x; vert2.y = minima.y + 0.001f; vert2.z = minima.z; |
|---|
| 2141 | + vert3.x = minima.x; vert3.y = minima.y + 0.001f; vert3.z = maxima.z; |
|---|
| 2142 | + vert4.x = maxima.x; vert4.y = minima.y + 0.001f; vert4.z = maxima.z; |
|---|
| 2143 | 2143 | norm = cVector.Y; |
|---|
| 2144 | 2144 | break; |
|---|
| 2145 | 2145 | case 2 : |
|---|
| 2146 | | - vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z; |
|---|
| 2147 | | - vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z; |
|---|
| 2148 | | - vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z; |
|---|
| 2149 | | - vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z; |
|---|
| 2146 | + vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z + 0.001f; |
|---|
| 2147 | + vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z + 0.001f; |
|---|
| 2148 | + vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z + 0.001f; |
|---|
| 2149 | + vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z + 0.001f; |
|---|
| 2150 | 2150 | norm = cVector.Z; |
|---|
| 2151 | 2151 | break; |
|---|
| 2152 | 2152 | } |
|---|
| .. | .. |
|---|
| 1767 | 1767 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
|---|
| 1768 | 1768 | |
|---|
| 1769 | 1769 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
|---|
| 1770 | | - scenePanel.preferredWidth = 6; |
|---|
| 1770 | + scenePanel.preferredWidth = 5; |
|---|
| 1771 | 1771 | |
|---|
| 1772 | 1772 | JTabbedPane tabbedPane = new JTabbedPane(); |
|---|
| 1773 | 1773 | tabbedPane.add(scrollpane); |
|---|
| .. | .. |
|---|
| 687 | 687 | { |
|---|
| 688 | 688 | if (maxcount != 1) |
|---|
| 689 | 689 | { |
|---|
| 690 | | - new Exception().printStackTrace(); |
|---|
| 690 | + //new Exception().printStackTrace(); |
|---|
| 691 | 691 | } |
|---|
| 692 | 692 | |
|---|
| 693 | 693 | toParentMarked = LA.newMatrix(); |
|---|
| .. | .. |
|---|
| 2369 | 2369 | |
|---|
| 2370 | 2370 | InitOthers(); |
|---|
| 2371 | 2371 | |
|---|
| 2372 | | - if (this instanceof Camera) |
|---|
| 2373 | | - { |
|---|
| 2374 | | - material.shift = 90; |
|---|
| 2375 | | - } |
|---|
| 2376 | | - |
|---|
| 2377 | 2372 | material.multiply = multiply; |
|---|
| 2378 | 2373 | |
|---|
| 2379 | 2374 | if (multiply) |
|---|
| .. | .. |
|---|
| 7716 | 7711 | |
|---|
| 7717 | 7712 | scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance(); |
|---|
| 7718 | 7713 | |
|---|
| 7719 | | - if (modified || opposite) |
|---|
| 7714 | + // Modified could snap |
|---|
| 7715 | + if (//modified || |
|---|
| 7716 | + opposite) |
|---|
| 7720 | 7717 | { |
|---|
| 7721 | 7718 | //assert(false); |
|---|
| 7722 | 7719 | /* |
|---|
| .. | .. |
|---|
| 7810 | 7807 | |
|---|
| 7811 | 7808 | if (modified) |
|---|
| 7812 | 7809 | { |
|---|
| 7813 | | - // Rotate 90 degrees |
|---|
| 7810 | + // Rotate 45 degrees |
|---|
| 7814 | 7811 | angle /= (Math.PI / 4); |
|---|
| 7815 | 7812 | angle = Math.floor(angle + 0.5); |
|---|
| 7816 | 7813 | angle *= (Math.PI / 4); |
|---|
| .. | .. |
|---|
| 7896 | 7893 | case 3: // '\001' |
|---|
| 7897 | 7894 | if (modified || opposite) |
|---|
| 7898 | 7895 | { |
|---|
| 7899 | | - if (modified && opposite) |
|---|
| 7896 | + if (modified) // && opposite) |
|---|
| 7900 | 7897 | LA.matScale(toParent, totalScale, totalScale, totalScale); |
|---|
| 7901 | 7898 | else |
|---|
| 7902 | 7899 | //LA.matScale(toParent, 1, hScale, vScale); |
|---|
| .. | .. |
|---|
| 7912 | 7909 | case 2: // '\002' |
|---|
| 7913 | 7910 | if (modified || opposite) |
|---|
| 7914 | 7911 | { |
|---|
| 7915 | | - if (modified && opposite) |
|---|
| 7912 | + if (modified) // && opposite) |
|---|
| 7916 | 7913 | LA.matScale(toParent, totalScale, totalScale, totalScale); |
|---|
| 7917 | 7914 | else |
|---|
| 7918 | 7915 | //LA.matScale(toParent, hScale, 1, vScale); |
|---|
| .. | .. |
|---|
| 7926 | 7923 | case 1: // '\003' |
|---|
| 7927 | 7924 | if (modified || opposite) |
|---|
| 7928 | 7925 | { |
|---|
| 7929 | | - if (modified && opposite) |
|---|
| 7926 | + if (modified) // && opposite) |
|---|
| 7930 | 7927 | LA.matScale(toParent, totalScale, totalScale, totalScale); |
|---|
| 7931 | 7928 | else |
|---|
| 7932 | 7929 | //LA.matScale(toParent, hScale, vScale, 1); |
|---|
| .. | .. |
|---|
| 362 | 362 | // } |
|---|
| 363 | 363 | |
|---|
| 364 | 364 | float color = 0.5f, modulation /*SATURATION*/ = 0.001f, metalness = 0.001f; |
|---|
| 365 | | - float diffuse = 0.75f, specular = 0.25f, shininess = 0.75f, shift = 1; |
|---|
| 365 | + float diffuse = 1f, specular = 0.25f, shininess = 0.75f, shift = 1; |
|---|
| 366 | 366 | float ambient = 0.001f, lightarea = 0.025f, factor = 0.001f, velvet = 0.001f; |
|---|
| 367 | 367 | float sheen = 1f, subsurface = 0.001f, bump = 0.75f, aniso = 0.001f, anisoV = 0.001f; |
|---|
| 368 | | - float cameralight = 0.3f, diffuseness = 0.001f, shadow = 5f, texture = 1f, opacity = 1; |
|---|
| 368 | + float cameralight = 0.5f, diffuseness = 0.001f, shadow = 5f, texture = 1f, opacity = 1; |
|---|
| 369 | 369 | float fakedepth = 0.5f, shadowbias = 0.01f; // 0.001f; |
|---|
| 370 | 370 | |
|---|
| 371 | 371 | float parallax = 0; |
|---|