.. | .. |
---|
86 | 86 | static boolean FULLSCREEN = false; |
---|
87 | 87 | static boolean SUPPORT = true; |
---|
88 | 88 | static boolean INERTIA = true; |
---|
89 | | -static boolean FAST = false; |
---|
| 89 | +static boolean FAST = true; // false; |
---|
90 | 90 | static boolean SLOWPOSE = false; |
---|
91 | 91 | static boolean FOOTCONTACT = true; |
---|
92 | 92 | |
---|
93 | 93 | static int tickcount = 0; // slow pose issue |
---|
94 | 94 | |
---|
| 95 | +static boolean BUTTONLESSWHEEL = false; |
---|
| 96 | +static boolean ZOOMBOXMODE = false; |
---|
95 | 97 | static boolean BOXMODE = false; |
---|
96 | 98 | static boolean IMAGEFLIP = false; |
---|
97 | 99 | static boolean SMOOTHFOCUS = false; |
---|
.. | .. |
---|
149 | 151 | defaultcaps.setAccumBlueBits(16); |
---|
150 | 152 | defaultcaps.setAccumAlphaBits(16); |
---|
151 | 153 | } |
---|
152 | | - static CameraPane theRenderer; |
---|
153 | | - |
---|
| 154 | + |
---|
154 | 155 | void SetAsGLRenderer(boolean b) |
---|
155 | 156 | { |
---|
156 | 157 | isRenderer = b; |
---|
157 | | - theRenderer = this; |
---|
| 158 | + Globals.theRenderer = this; |
---|
158 | 159 | } |
---|
159 | 160 | |
---|
160 | 161 | CameraPane(Object3D o, Camera cam, boolean withcontext) |
---|
.. | .. |
---|
192 | 193 | |
---|
193 | 194 | /// INTERFACE |
---|
194 | 195 | |
---|
| 196 | + public javax.media.opengl.GL GetGL0() |
---|
| 197 | + { |
---|
| 198 | + return null; |
---|
| 199 | + } |
---|
| 200 | + |
---|
| 201 | + public int GenList() |
---|
| 202 | + { |
---|
| 203 | + javax.media.opengl.GL gl = GetGL(); |
---|
| 204 | + return gl.glGenLists(1); |
---|
| 205 | + } |
---|
| 206 | + |
---|
| 207 | + public void NewList(int id) |
---|
| 208 | + { |
---|
| 209 | + javax.media.opengl.GL gl = GetGL(); |
---|
| 210 | + gl.glNewList(id, gl.GL_COMPILE); //_AND_EXECUTE); |
---|
| 211 | + } |
---|
| 212 | + |
---|
| 213 | + public void CallList(int id) |
---|
| 214 | + { |
---|
| 215 | + javax.media.opengl.GL gl = GetGL(); |
---|
| 216 | + gl.glCallList(id); |
---|
| 217 | + } |
---|
| 218 | + |
---|
| 219 | + public void EndList() |
---|
| 220 | + { |
---|
| 221 | + javax.media.opengl.GL gl = GetGL(); |
---|
| 222 | + gl.glEndList(); |
---|
| 223 | + } |
---|
| 224 | + |
---|
195 | 225 | public boolean IsBoxMode() |
---|
196 | 226 | { |
---|
197 | 227 | return BOXMODE; |
---|
| 228 | + } |
---|
| 229 | + |
---|
| 230 | + public boolean IsZoomBoxMode() |
---|
| 231 | + { |
---|
| 232 | + return ZOOMBOXMODE; |
---|
198 | 233 | } |
---|
199 | 234 | |
---|
200 | 235 | public void ClearDepth() |
---|
.. | .. |
---|
236 | 271 | return this.ambientOcclusion; |
---|
237 | 272 | } |
---|
238 | 273 | |
---|
| 274 | + public boolean IsDebugSelection() |
---|
| 275 | + { |
---|
| 276 | + return DEBUG_SELECTION; |
---|
| 277 | + } |
---|
| 278 | + |
---|
239 | 279 | public boolean IsFrozen() |
---|
240 | 280 | { |
---|
241 | | - boolean selectmode = this.DrawMode() == SELECTION || CameraPane.DEBUG_SELECTION; |
---|
| 281 | + boolean selectmode = this.DrawMode() == SELECTION || this.IsDebugSelection(); |
---|
242 | 282 | |
---|
243 | 283 | return !selectmode && cameracount == 0; // != 0; |
---|
244 | 284 | } |
---|
.. | .. |
---|
259 | 299 | return lightCamera; |
---|
260 | 300 | } |
---|
261 | 301 | |
---|
| 302 | + public Camera ManipCamera() |
---|
| 303 | + { |
---|
| 304 | + return manipCamera; |
---|
| 305 | + } |
---|
| 306 | + |
---|
262 | 307 | public Camera RenderCamera() |
---|
263 | 308 | { |
---|
264 | 309 | return renderCamera; |
---|
| 310 | + } |
---|
| 311 | + |
---|
| 312 | + public Camera[] Cameras() |
---|
| 313 | + { |
---|
| 314 | + return cameras; |
---|
265 | 315 | } |
---|
266 | 316 | |
---|
267 | 317 | public void PushMaterial(Object3D obj, boolean selected) |
---|
.. | .. |
---|
408 | 458 | |
---|
409 | 459 | javax.media.opengl.GL gl = display.GetGL(); |
---|
410 | 460 | |
---|
411 | | - boolean selectmode = display.DrawMode() == display.SELECTION || CameraPane.DEBUG_SELECTION; |
---|
| 461 | + boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
412 | 462 | |
---|
413 | 463 | //System.out.println("p = " + pv + "; q = " + qv + "; r = " + rv); |
---|
414 | 464 | if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0) |
---|
.. | .. |
---|
760 | 810 | //// tris.postdraw(this); |
---|
761 | 811 | } |
---|
762 | 812 | |
---|
| 813 | + static Camera localcamera = new Camera(); |
---|
| 814 | + static cVector from = new cVector(); |
---|
| 815 | + static cVector to = new cVector(); |
---|
| 816 | + |
---|
| 817 | + public void PrepOcclusion(BoundaryRep br, double[][] transform) |
---|
| 818 | + { |
---|
| 819 | + CameraPane cp = this; |
---|
| 820 | + |
---|
| 821 | + Camera keep = cp.RenderCamera(); |
---|
| 822 | + cp.renderCamera = localcamera; |
---|
| 823 | + |
---|
| 824 | + if (br.trimmed) |
---|
| 825 | + { |
---|
| 826 | + float[] colors = new float[br.positions.length / 3]; |
---|
| 827 | + |
---|
| 828 | + int i3 = 0; |
---|
| 829 | + for (int i = 0; i < br.positions.length / 3; i++, i3 += 3) |
---|
| 830 | + { |
---|
| 831 | + if (br.normals[i3] == 0 && br.normals[i3+1] == 0 && br.normals[i3+2] == 0) |
---|
| 832 | + continue; |
---|
| 833 | + |
---|
| 834 | + from.set(br.positions[i3], br.positions[i3 + 1], br.positions[i3 + 2]); |
---|
| 835 | + to.set(br.positions[i3] + br.normals[i3], |
---|
| 836 | + br.positions[i3 + 1] + br.normals[i3 + 1], |
---|
| 837 | + br.positions[i3 + 2] + br.normals[i3 + 2]); |
---|
| 838 | + LA.xformPos(from, transform, from); |
---|
| 839 | + LA.xformPos(to, transform, to); // RIGID ONLY |
---|
| 840 | + localcamera.setAim(from, to); |
---|
| 841 | + |
---|
| 842 | + CameraPane.occlusionbuffer.display(); |
---|
| 843 | + |
---|
| 844 | + if (CameraPane.DEBUG_OCCLUSION) |
---|
| 845 | + cp.display(); // debug |
---|
| 846 | + |
---|
| 847 | + colors[i] = cp.vertexOcclusion.r; |
---|
| 848 | + //colors[i3 + 1] = cp.vertexOcclusion.g; |
---|
| 849 | + //colors[i3 + 2] = cp.vertexOcclusion.b; |
---|
| 850 | + |
---|
| 851 | + if ((i % 100) == 0 && i != 0) |
---|
| 852 | + { |
---|
| 853 | + Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR)); |
---|
| 854 | + //System.out.println("Color = " + cp.vertexOcclusion.r + ", " + cp.vertexOcclusion.g + ", " + cp.vertexOcclusion.b + "; " + (int)(100.0*i/(positions.length/3)) + "% done"); |
---|
| 855 | + System.out.println((int) (100.0 * i / (br.positions.length / 3)) + "% (" + i + " of " + (br.positions.length / 3) + ")"); |
---|
| 856 | + } |
---|
| 857 | + } |
---|
| 858 | + |
---|
| 859 | + br.colors = colors; |
---|
| 860 | + } |
---|
| 861 | + else |
---|
| 862 | + { |
---|
| 863 | + for (int i = 0; i < br.VertexCount(); i++) |
---|
| 864 | + { |
---|
| 865 | + Vertex v = br.GetVertex(i); |
---|
| 866 | + |
---|
| 867 | + if (v.norm == null || v.norm.x == 0 && v.norm.y == 0 && v.norm.z == 0) |
---|
| 868 | + continue; |
---|
| 869 | + |
---|
| 870 | + from.set(v.x, v.y, v.z); |
---|
| 871 | + to.set(v.x+v.norm.x, v.y+v.norm.y, v.z+v.norm.z); |
---|
| 872 | + LA.xformPos(from, transform, from); |
---|
| 873 | + LA.xformPos(to, transform, to); // RIGID ONLY |
---|
| 874 | + localcamera.setAim(from, to); |
---|
| 875 | + |
---|
| 876 | + CameraPane.occlusionbuffer.display(); |
---|
| 877 | + |
---|
| 878 | + if (CameraPane.DEBUG_OCCLUSION) |
---|
| 879 | + cp.display(); // debug |
---|
| 880 | + |
---|
| 881 | + v.AO = cp.vertexOcclusion.r; |
---|
| 882 | + |
---|
| 883 | + if ((i % 100) == 0 && i != 0) |
---|
| 884 | + { |
---|
| 885 | + Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR)); |
---|
| 886 | + //System.out.println("Color = " + cp.vertexOcclusion.r + ", " + cp.vertexOcclusion.g + ", " + cp.vertexOcclusion.b + "; " + (int)(100.0*i/(positions.length/3)) + "% done"); |
---|
| 887 | + System.out.println((int) (100.0 * i / br.VertexCount()) + "% (" + i + " of " + br.VertexCount() + ")"); |
---|
| 888 | + } |
---|
| 889 | + } |
---|
| 890 | + } |
---|
| 891 | + |
---|
| 892 | + //System.out.println("done."); |
---|
| 893 | + |
---|
| 894 | + cp.renderCamera = keep; |
---|
| 895 | + } |
---|
| 896 | + |
---|
| 897 | + void DrawPointFLow(PointFlow pointFlow, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 898 | + { |
---|
| 899 | + CameraPane display = this; |
---|
| 900 | + pointFlow.CreateHT(); |
---|
| 901 | + |
---|
| 902 | + float r = display.modelParams0[0]; |
---|
| 903 | + float g = display.modelParams0[1]; |
---|
| 904 | + float b = display.modelParams0[2]; |
---|
| 905 | + float opacity = display.modelParams5[1]; |
---|
| 906 | + |
---|
| 907 | + //final GL gl = GLU.getCurrentGL(); |
---|
| 908 | + GL gl = display.GetGL(); // getGL(); |
---|
| 909 | + |
---|
| 910 | + int s = pointFlow.points.size(); |
---|
| 911 | + |
---|
| 912 | + boolean cf = gl.glIsEnabled(gl.GL_CULL_FACE); |
---|
| 913 | + gl.glEnable(gl.GL_CULL_FACE); |
---|
| 914 | + |
---|
| 915 | + for (int i=s; --i>=0;) |
---|
| 916 | + //for (int i=0; i<s; i++) |
---|
| 917 | + { |
---|
| 918 | + cVector v = pointFlow.points.get(i); |
---|
| 919 | + |
---|
| 920 | + double mindist = Double.MAX_VALUE; |
---|
| 921 | + |
---|
| 922 | + double size = pointFlow.minimumSize; |
---|
| 923 | + |
---|
| 924 | + double distancenext = 0; |
---|
| 925 | + |
---|
| 926 | + if (i > 0) |
---|
| 927 | + { |
---|
| 928 | + cVector w = pointFlow.points.get(i-1); |
---|
| 929 | + |
---|
| 930 | + double dist = w.distance(v); |
---|
| 931 | + |
---|
| 932 | + distancenext = dist; |
---|
| 933 | + |
---|
| 934 | + if (mindist > dist) |
---|
| 935 | + { |
---|
| 936 | + mindist = dist; |
---|
| 937 | + size = mindist*pointFlow.resizefactor; |
---|
| 938 | + } |
---|
| 939 | + } |
---|
| 940 | + |
---|
| 941 | + if (i < s-1) |
---|
| 942 | + { |
---|
| 943 | + cVector w = pointFlow.points.get(i+1); |
---|
| 944 | + |
---|
| 945 | + double dist = w.distance(v); |
---|
| 946 | + |
---|
| 947 | + if (mindist > dist) |
---|
| 948 | + { |
---|
| 949 | + mindist = dist; |
---|
| 950 | + size = mindist*pointFlow.resizefactor; |
---|
| 951 | + } |
---|
| 952 | + } |
---|
| 953 | + |
---|
| 954 | + if (size < pointFlow.minimumSize) |
---|
| 955 | + size = pointFlow.minimumSize; |
---|
| 956 | + if (size > pointFlow.maximumSize) |
---|
| 957 | + size = pointFlow.maximumSize; |
---|
| 958 | + |
---|
| 959 | + double tx = v.x; |
---|
| 960 | + double ty = v.y; |
---|
| 961 | + double tz = v.z; |
---|
| 962 | + |
---|
| 963 | + // if (tx == 0 && ty == 0 && tz == 0) |
---|
| 964 | + // continue; |
---|
| 965 | + |
---|
| 966 | + gl.glMatrixMode(gl.GL_TEXTURE); |
---|
| 967 | + gl.glPushMatrix(); |
---|
| 968 | + pointFlow.texmat[12] = pointFlow.texmat[13] = pointFlow.texmat[14] = i; |
---|
| 969 | + |
---|
| 970 | + gl.glMultMatrixf(pointFlow.texmat, 0); |
---|
| 971 | + |
---|
| 972 | + gl.glMatrixMode(gl.GL_MODELVIEW); |
---|
| 973 | + gl.glPushMatrix(); |
---|
| 974 | + |
---|
| 975 | + gl.glTranslated(tx,ty,tz); |
---|
| 976 | + |
---|
| 977 | + gl.glScaled(size,size,size); |
---|
| 978 | + |
---|
| 979 | +// float cr = colorBuf.get(index4); |
---|
| 980 | +// float cg = colorBuf.get(index4+1); |
---|
| 981 | +// float cb = colorBuf.get(index4+2); |
---|
| 982 | +// float ca = colorBuf.get(index4+3); |
---|
| 983 | +// |
---|
| 984 | +// display.modelParams0[0] = r * cr; |
---|
| 985 | +// display.modelParams0[1] = g * cg; |
---|
| 986 | +// display.modelParams0[2] = b * cb; |
---|
| 987 | +// |
---|
| 988 | +// display.modelParams5[1] = opacity * ca; |
---|
| 989 | +// |
---|
| 990 | +// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 0, display.modelParams0, 0); |
---|
| 991 | +// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 5, display.modelParams5, 0); |
---|
| 992 | +// |
---|
| 993 | +// RandomNode.globalseed = (int)sizeBuf.get(index3+2); // i; |
---|
| 994 | +// RandomNode.globalseed2 = RandomNode.globalseed; |
---|
| 995 | +// |
---|
| 996 | +//// gl.glColor4f(cr,cg,cb,ca); |
---|
| 997 | +// // gl.glScalef(1024/16,1024/16,1024/16); |
---|
| 998 | + pointFlow.geo.Draw/*Node*/(display,null,selected, blocked); |
---|
| 999 | + |
---|
| 1000 | + gl.glPopMatrix(); |
---|
| 1001 | + |
---|
| 1002 | + double step = size/4; // |
---|
| 1003 | + |
---|
| 1004 | + if (i == 0 || size == 0 || distancenext > 8*size || distancenext < step) |
---|
| 1005 | + continue; |
---|
| 1006 | + |
---|
| 1007 | + int nbsteps = (int)(distancenext/step); |
---|
| 1008 | + |
---|
| 1009 | + step = distancenext/nbsteps; |
---|
| 1010 | + |
---|
| 1011 | + cVector next = pointFlow.points.get(i-1); |
---|
| 1012 | + |
---|
| 1013 | + tmp.set(next); |
---|
| 1014 | + tmp.sub(v); |
---|
| 1015 | + tmp.normalize(); |
---|
| 1016 | + tmp.mul(step); |
---|
| 1017 | + |
---|
| 1018 | + // calculate next size |
---|
| 1019 | + mindist = Double.MAX_VALUE; |
---|
| 1020 | + |
---|
| 1021 | + double nextsize = pointFlow.minimumSize; |
---|
| 1022 | + |
---|
| 1023 | + if (i > 1) |
---|
| 1024 | + { |
---|
| 1025 | + cVector w = pointFlow.points.get(i-2); |
---|
| 1026 | + |
---|
| 1027 | + double dist = w.distance(next); |
---|
| 1028 | + |
---|
| 1029 | + if (mindist > dist) |
---|
| 1030 | + { |
---|
| 1031 | + mindist = dist; |
---|
| 1032 | + nextsize = mindist*pointFlow.resizefactor; |
---|
| 1033 | + } |
---|
| 1034 | + } |
---|
| 1035 | + |
---|
| 1036 | + double dist = v.distance(next); |
---|
| 1037 | + |
---|
| 1038 | + if (mindist > dist) |
---|
| 1039 | + { |
---|
| 1040 | + mindist = dist; |
---|
| 1041 | + nextsize = mindist*pointFlow.resizefactor; |
---|
| 1042 | + } |
---|
| 1043 | + |
---|
| 1044 | + if (nextsize < pointFlow.minimumSize) |
---|
| 1045 | + nextsize = pointFlow.minimumSize; |
---|
| 1046 | + if (nextsize > pointFlow.maximumSize) |
---|
| 1047 | + nextsize = pointFlow.maximumSize; |
---|
| 1048 | + // |
---|
| 1049 | + |
---|
| 1050 | + double count = 0; |
---|
| 1051 | + |
---|
| 1052 | + while (distancenext > 0.000000001) // step |
---|
| 1053 | + { |
---|
| 1054 | + gl.glPushMatrix(); |
---|
| 1055 | + |
---|
| 1056 | + gl.glTranslated(tx + tmp.x*count, ty + tmp.y*count, tz + tmp.z*count); |
---|
| 1057 | + |
---|
| 1058 | + double K = count/nbsteps; |
---|
| 1059 | + |
---|
| 1060 | + double intersize = K*nextsize + (1-K)*size; |
---|
| 1061 | + |
---|
| 1062 | + gl.glScaled(intersize,intersize,intersize); |
---|
| 1063 | + |
---|
| 1064 | + pointFlow.geo.Draw/*Node*/(display,null,selected,blocked); |
---|
| 1065 | + |
---|
| 1066 | + count++; |
---|
| 1067 | + |
---|
| 1068 | + distancenext -= step; |
---|
| 1069 | + |
---|
| 1070 | + gl.glPopMatrix(); |
---|
| 1071 | + } |
---|
| 1072 | + |
---|
| 1073 | + if (count != nbsteps) |
---|
| 1074 | + assert(count == nbsteps); |
---|
| 1075 | + |
---|
| 1076 | + // gl.glScalef(16.0f/1024,16.0f/1024,16.0f/1024); |
---|
| 1077 | + //gl.glTranslatef(-tx,-ty,-tz); |
---|
| 1078 | + |
---|
| 1079 | + gl.glMatrixMode(gl.GL_TEXTURE); |
---|
| 1080 | + gl.glPopMatrix(); |
---|
| 1081 | + } |
---|
| 1082 | + |
---|
| 1083 | + if (!cf) |
---|
| 1084 | + gl.glDisable(gl.GL_CULL_FACE); |
---|
| 1085 | + |
---|
| 1086 | +// display.modelParams0[0] = r; |
---|
| 1087 | +// display.modelParams0[1] = g; |
---|
| 1088 | +// display.modelParams0[2] = b; |
---|
| 1089 | +// |
---|
| 1090 | +// display.modelParams5[1] = opacity; |
---|
| 1091 | +// |
---|
| 1092 | +// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 0, display.modelParams0, 0); |
---|
| 1093 | +// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 5, display.modelParams5, 0); |
---|
| 1094 | + |
---|
| 1095 | + gl.glMatrixMode(gl.GL_MODELVIEW); |
---|
| 1096 | + } |
---|
| 1097 | + |
---|
| 1098 | + public void DrawBox(cVector min, cVector max) |
---|
| 1099 | + { |
---|
| 1100 | + javax.media.opengl.GL gl = GetGL(); |
---|
| 1101 | + gl.glBegin(gl.GL_LINES); |
---|
| 1102 | + |
---|
| 1103 | + gl.glVertex3d(min.x, min.y, min.z); |
---|
| 1104 | + gl.glVertex3d(min.x, min.y, max.z); |
---|
| 1105 | + gl.glVertex3d(min.x, min.y, min.z); |
---|
| 1106 | + gl.glVertex3d(min.x, max.y, min.z); |
---|
| 1107 | + gl.glVertex3d(min.x, min.y, min.z); |
---|
| 1108 | + gl.glVertex3d(max.x, min.y, min.z); |
---|
| 1109 | + |
---|
| 1110 | + gl.glVertex3d(max.x, max.y, max.z); |
---|
| 1111 | + gl.glVertex3d(min.x, max.y, max.z); |
---|
| 1112 | + gl.glVertex3d(max.x, max.y, max.z); |
---|
| 1113 | + gl.glVertex3d(max.x, min.y, max.z); |
---|
| 1114 | + gl.glVertex3d(max.x, max.y, max.z); |
---|
| 1115 | + gl.glVertex3d(max.x, max.y, min.z); |
---|
| 1116 | + |
---|
| 1117 | + gl.glEnd(); |
---|
| 1118 | + } |
---|
| 1119 | + |
---|
| 1120 | + public void DrawGeometry(BoundaryRep bRep, boolean flipV, boolean selectmode) |
---|
| 1121 | + { |
---|
| 1122 | + int[] strips = bRep.getRawIndices(); |
---|
| 1123 | + |
---|
| 1124 | + javax.media.opengl.GL gl = GetGL(); |
---|
| 1125 | + |
---|
| 1126 | + // TRIANGLE STRIP ARRAY |
---|
| 1127 | + if (bRep.trimmed) |
---|
| 1128 | + { |
---|
| 1129 | + float[] v = bRep.getRawVertices(); |
---|
| 1130 | + float[] n = bRep.getRawNormals(); |
---|
| 1131 | + float[] c = bRep.getRawColors(); |
---|
| 1132 | + float[] uv = bRep.getRawUVMap(); |
---|
| 1133 | + |
---|
| 1134 | + int count2 = 0; |
---|
| 1135 | + int count3 = 0; |
---|
| 1136 | + |
---|
| 1137 | + if (n.length > 0) |
---|
| 1138 | + { |
---|
| 1139 | + for (int i = 0; i < strips.length; i++) |
---|
| 1140 | + { |
---|
| 1141 | + gl.glBegin(gl.GL_TRIANGLE_STRIP); |
---|
| 1142 | + |
---|
| 1143 | + /* |
---|
| 1144 | + boolean locked = false; |
---|
| 1145 | + float eps = 0.1f; |
---|
| 1146 | + boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice |
---|
| 1147 | + |
---|
| 1148 | + int dot = 0; |
---|
| 1149 | + |
---|
| 1150 | + if ((dot&1) == 0) |
---|
| 1151 | + dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1; |
---|
| 1152 | + |
---|
| 1153 | + if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) |
---|
| 1154 | + gl.glTexCoord2f((float) qv.s, (float) qv.t); |
---|
| 1155 | + else |
---|
| 1156 | + { |
---|
| 1157 | + locked = true; |
---|
| 1158 | + gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
| 1159 | + } |
---|
| 1160 | + //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z); |
---|
| 1161 | + gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z); |
---|
| 1162 | + if (hasnorm) |
---|
| 1163 | + { |
---|
| 1164 | + //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z); |
---|
| 1165 | + gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z); |
---|
| 1166 | + } |
---|
| 1167 | + |
---|
| 1168 | + if ((dot&4) == 0) |
---|
| 1169 | + dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4; |
---|
| 1170 | + |
---|
| 1171 | + if (wrap || !locked && (dot&8) != 0) |
---|
| 1172 | + gl.glTexCoord2f((float) rv.s, (float) rv.t); |
---|
| 1173 | + else |
---|
| 1174 | + gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
| 1175 | + |
---|
| 1176 | + f.dot = dot; |
---|
| 1177 | + */ |
---|
| 1178 | + |
---|
| 1179 | + if (!selectmode) |
---|
| 1180 | + { |
---|
| 1181 | + if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
| 1182 | + { |
---|
| 1183 | + gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
| 1184 | + } else |
---|
| 1185 | + { |
---|
| 1186 | + gl.glNormal3f(0, 0, 1); |
---|
| 1187 | + } |
---|
| 1188 | + |
---|
| 1189 | + if (c != null) |
---|
| 1190 | + //System.out.println("glcolor = " + c[count3] + ", " + c[count3+1] + ", " + c[count3+2]); |
---|
| 1191 | + { |
---|
| 1192 | + gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
| 1193 | + } |
---|
| 1194 | + } |
---|
| 1195 | + if (flipV) |
---|
| 1196 | + gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
| 1197 | + else |
---|
| 1198 | + gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1199 | + //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
| 1200 | + gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
| 1201 | + |
---|
| 1202 | + count2 += 2; |
---|
| 1203 | + count3 += 3; |
---|
| 1204 | + if (!selectmode) |
---|
| 1205 | + { |
---|
| 1206 | + if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
| 1207 | + { |
---|
| 1208 | + gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
| 1209 | + } else |
---|
| 1210 | + { |
---|
| 1211 | + gl.glNormal3f(0, 0, 1); |
---|
| 1212 | + } |
---|
| 1213 | + if (c != null) |
---|
| 1214 | + { |
---|
| 1215 | + gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
| 1216 | + } |
---|
| 1217 | + } |
---|
| 1218 | + if (flipV) |
---|
| 1219 | + gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
| 1220 | + else |
---|
| 1221 | + gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1222 | + //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
| 1223 | + gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
| 1224 | + |
---|
| 1225 | + count2 += 2; |
---|
| 1226 | + count3 += 3; |
---|
| 1227 | + for (int j = 0; j < strips[i] - 2; j++) |
---|
| 1228 | + { |
---|
| 1229 | + //gl.glTexCoord2d(...); |
---|
| 1230 | + if (!selectmode) |
---|
| 1231 | + { |
---|
| 1232 | + if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
| 1233 | + { |
---|
| 1234 | + gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
| 1235 | + } else |
---|
| 1236 | + { |
---|
| 1237 | + gl.glNormal3f(0, 0, 1); |
---|
| 1238 | + } |
---|
| 1239 | + if (c != null) |
---|
| 1240 | + { |
---|
| 1241 | + gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
| 1242 | + } |
---|
| 1243 | + } |
---|
| 1244 | + |
---|
| 1245 | + if (flipV) |
---|
| 1246 | + gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
| 1247 | + else |
---|
| 1248 | + gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1249 | + //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]); |
---|
| 1250 | + gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
| 1251 | + count2 += 2; |
---|
| 1252 | + count3 += 3; |
---|
| 1253 | + } |
---|
| 1254 | + |
---|
| 1255 | + gl.glEnd(); |
---|
| 1256 | + } |
---|
| 1257 | + } |
---|
| 1258 | + |
---|
| 1259 | + assert count3 == v.length; |
---|
| 1260 | + } |
---|
| 1261 | + else // !trimmed |
---|
| 1262 | + { |
---|
| 1263 | + int count = 0; |
---|
| 1264 | + for (int i = 0; i < strips.length; i++) |
---|
| 1265 | + { |
---|
| 1266 | + gl.glBegin(gl.GL_TRIANGLE_STRIP); |
---|
| 1267 | + |
---|
| 1268 | + Vertex p = bRep.GetVertex(bRep.indices[count++]); |
---|
| 1269 | + Vertex q = bRep.GetVertex(bRep.indices[count++]); |
---|
| 1270 | + |
---|
| 1271 | + drawVertex(gl, p, flipV, selectmode); |
---|
| 1272 | + drawVertex(gl, q, flipV, selectmode); |
---|
| 1273 | + |
---|
| 1274 | + for (int j = 0; j < strips[i] - 2; j++) |
---|
| 1275 | + { |
---|
| 1276 | + Vertex r = bRep.GetVertex(bRep.indices[count++]); |
---|
| 1277 | + |
---|
| 1278 | + // if (j%2 == 0) |
---|
| 1279 | + // drawFace(p, q, r, display, null); |
---|
| 1280 | + // else |
---|
| 1281 | + // drawFace(p, r, q, display, null); |
---|
| 1282 | + |
---|
| 1283 | + // p = q; |
---|
| 1284 | + // q = r; |
---|
| 1285 | + drawVertex(gl, r, flipV, selectmode); |
---|
| 1286 | + } |
---|
| 1287 | + |
---|
| 1288 | + gl.glEnd(); |
---|
| 1289 | + } |
---|
| 1290 | + } |
---|
| 1291 | + } |
---|
| 1292 | + |
---|
| 1293 | + static cSpring.Point3D temp = new cSpring.Point3D(); |
---|
| 1294 | + static cSpring.Point3D temp2 = new cSpring.Point3D(); |
---|
| 1295 | + static cSpring.Point3D temp3 = new cSpring.Point3D(); |
---|
| 1296 | + |
---|
| 1297 | + public void DrawDynamicMesh(cMesh mesh) |
---|
| 1298 | + { |
---|
| 1299 | + GL gl = GetGL(); // getGL(); |
---|
| 1300 | + |
---|
| 1301 | + cSpring.PhysicsController3D Phys = mesh.Phys; |
---|
| 1302 | + |
---|
| 1303 | + gl.glDisable(gl.GL_LIGHTING); |
---|
| 1304 | + |
---|
| 1305 | + gl.glLineWidth(1); |
---|
| 1306 | + gl.glColor3f(1,1,1); |
---|
| 1307 | + gl.glBegin(gl.GL_LINES); |
---|
| 1308 | + double scale = 0; |
---|
| 1309 | + int count = 0; |
---|
| 1310 | + for (int s=0; s<Phys.allSprings.size(); s++) |
---|
| 1311 | + { |
---|
| 1312 | + cSpring.Spring spring = Phys.allSprings.get(s); |
---|
| 1313 | + if(s == 0) |
---|
| 1314 | + { |
---|
| 1315 | + //System.out.println(" spring : " + spring.a.position + "; " + spring.b.position); |
---|
| 1316 | + } |
---|
| 1317 | + if (mesh.showsprings) |
---|
| 1318 | + { |
---|
| 1319 | + temp.set(spring.a.position); |
---|
| 1320 | + temp.add(spring.b.position); |
---|
| 1321 | + temp.mul(0.5); |
---|
| 1322 | + temp2.set(spring.a.position); |
---|
| 1323 | + temp2.sub(spring.b.position); |
---|
| 1324 | + temp2.mul(spring.restLength/2); |
---|
| 1325 | + temp.sub(temp2); |
---|
| 1326 | + gl.glVertex3f((float)temp.x, (float)temp.y, (float)temp.z); |
---|
| 1327 | + temp.add(temp2); |
---|
| 1328 | + temp.add(temp2); |
---|
| 1329 | + gl.glVertex3f((float)temp.x, (float)temp.y, (float)temp.z); |
---|
| 1330 | + } |
---|
| 1331 | + |
---|
| 1332 | + if (spring.isHandle) |
---|
| 1333 | + continue; |
---|
| 1334 | + |
---|
| 1335 | + //if (scale < spring.restLength) |
---|
| 1336 | + scale += spring.restLength; |
---|
| 1337 | + count++; |
---|
| 1338 | + } |
---|
| 1339 | + gl.glEnd(); |
---|
| 1340 | + |
---|
| 1341 | + if (count == 0) |
---|
| 1342 | + scale = 0.01; |
---|
| 1343 | + else |
---|
| 1344 | + scale /= count * 3; |
---|
| 1345 | + |
---|
| 1346 | + //scale = 0.25; |
---|
| 1347 | + |
---|
| 1348 | + if (mesh.ShowInfo()) |
---|
| 1349 | + { |
---|
| 1350 | + gl.glLineWidth(4); |
---|
| 1351 | + for (int s=0; s<Phys.allNodes.size(); s++) |
---|
| 1352 | + { |
---|
| 1353 | + cSpring.DynamicNode node = Phys.allNodes.get(s); |
---|
| 1354 | + if (node.mass == 0) |
---|
| 1355 | + continue; |
---|
| 1356 | + |
---|
| 1357 | + int i = node.springs==null?-1:node.springs.size(); |
---|
| 1358 | + gl.glColor3f((i>>2)&1,(i>>1)&1,i&1); |
---|
| 1359 | + //temp.set(node.springForce.x, node.springForce.y, node.springForce.z); |
---|
| 1360 | + //temp.normalize(); |
---|
| 1361 | + //gl.glColor3d((temp.x+1)/2, (temp.y+1)/2, (temp.z+1)/2); |
---|
| 1362 | + gl.glBegin(gl.GL_LINES); |
---|
| 1363 | + gl.glVertex3d(node.position.x, node.position.y, node.position.z); |
---|
| 1364 | + //gl.glVertex3d(node.position.x + node.normal.x*scale, node.position.y + node.normal.y*scale, node.position.z + node.normal.z*scale); |
---|
| 1365 | + gl.glVertex3d(node.position.x + mesh.bRep.GetVertex(s).norm.x*scale, |
---|
| 1366 | + node.position.y + mesh.bRep.GetVertex(s).norm.y*scale, |
---|
| 1367 | + node.position.z + mesh.bRep.GetVertex(s).norm.z*scale); |
---|
| 1368 | + gl.glEnd(); |
---|
| 1369 | + } |
---|
| 1370 | + |
---|
| 1371 | + gl.glLineWidth(8); |
---|
| 1372 | + for (int s=0; s<Phys.allNodes.size(); s++) |
---|
| 1373 | + { |
---|
| 1374 | + cSpring.DynamicNode node = Phys.allNodes.get(s); |
---|
| 1375 | + |
---|
| 1376 | + if (node.springs != null) |
---|
| 1377 | + { |
---|
| 1378 | + for (int i=0; i<node.springs.size(); i+=1) |
---|
| 1379 | + { |
---|
| 1380 | + cSpring.DynamicNode f = node.springs.get(i).GetOther(node); |
---|
| 1381 | + |
---|
| 1382 | + int c = i+1; |
---|
| 1383 | + // c = node.springs.get(i).nbcopies; |
---|
| 1384 | + |
---|
| 1385 | + gl.glColor3f((c>>2)&1,(c>>1)&1,c&1); |
---|
| 1386 | + gl.glBegin(gl.GL_LINES); |
---|
| 1387 | + gl.glVertex3d(node.position.x, node.position.y, node.position.z); |
---|
| 1388 | + gl.glVertex3d(f.position.x/3+node.position.x*2/3, f.position.y/3+node.position.y*2/3, f.position.z/3+node.position.z*2/3); |
---|
| 1389 | + gl.glEnd(); |
---|
| 1390 | + } |
---|
| 1391 | + } |
---|
| 1392 | + } |
---|
| 1393 | + |
---|
| 1394 | + gl.glLineWidth(1); |
---|
| 1395 | + } |
---|
| 1396 | + |
---|
| 1397 | + gl.glEnable(gl.GL_LIGHTING); |
---|
| 1398 | + } |
---|
| 1399 | + |
---|
763 | 1400 | /// INTERFACE |
---|
| 1401 | + |
---|
| 1402 | + public void StartTriangles() |
---|
| 1403 | + { |
---|
| 1404 | + javax.media.opengl.GL gl = GetGL(); |
---|
| 1405 | + gl.glBegin(gl.GL_TRIANGLES); |
---|
| 1406 | + } |
---|
| 1407 | + |
---|
| 1408 | + public void EndTriangles() |
---|
| 1409 | + { |
---|
| 1410 | + GetGL().glEnd(); |
---|
| 1411 | + } |
---|
| 1412 | + |
---|
| 1413 | + void drawVertex(javax.media.opengl.GL gl, Vertex pv, boolean flipV, boolean selectmode) |
---|
| 1414 | + { |
---|
| 1415 | + if (!selectmode) |
---|
| 1416 | + { |
---|
| 1417 | + gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z); |
---|
| 1418 | + gl.glColor4f(pv.AO, pv.AO, pv.AO, 1); |
---|
| 1419 | + |
---|
| 1420 | + if (flipV) |
---|
| 1421 | + gl.glTexCoord2f((float) pv.s, 1-(float) pv.t); |
---|
| 1422 | + else |
---|
| 1423 | + gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
| 1424 | + } |
---|
| 1425 | + |
---|
| 1426 | + gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z); |
---|
| 1427 | + } |
---|
764 | 1428 | |
---|
765 | 1429 | void SetColor(Object3D obj, Vertex p0) |
---|
766 | 1430 | { |
---|
.. | .. |
---|
955 | 1619 | //col.getColorComponents(ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB), CameraPane.modelParams0); |
---|
956 | 1620 | if (!material.multiply) |
---|
957 | 1621 | { |
---|
958 | | - display.color = color; |
---|
| 1622 | + display.color = material.color; |
---|
959 | 1623 | display.saturation = material.modulation; |
---|
960 | 1624 | } |
---|
961 | 1625 | else |
---|
962 | 1626 | { |
---|
963 | | - display.color *= color*2; |
---|
| 1627 | + display.color *= material.color*2; |
---|
964 | 1628 | display.saturation *= material.modulation*2; |
---|
965 | 1629 | } |
---|
966 | 1630 | |
---|
.. | .. |
---|
1323 | 1987 | |
---|
1324 | 1988 | static int camerachangeframe; |
---|
1325 | 1989 | |
---|
1326 | | - boolean SetCamera(Camera cam) |
---|
| 1990 | + public boolean SetCamera(Camera cam) |
---|
1327 | 1991 | { |
---|
1328 | 1992 | // may 2014 if (cam == cameras[0] || cam == cameras[1]) |
---|
1329 | 1993 | // return false; |
---|
.. | .. |
---|
1451 | 2115 | mainDL ^= true; |
---|
1452 | 2116 | } |
---|
1453 | 2117 | |
---|
1454 | | - void ToggleTexture() |
---|
| 2118 | + void ToggleFullScreen() |
---|
| 2119 | + { |
---|
| 2120 | + FULLSCREEN ^= true; |
---|
| 2121 | + } |
---|
| 2122 | + |
---|
| 2123 | + void ToggleCrowd() |
---|
| 2124 | + { |
---|
| 2125 | + Globals.CROWD ^= true; |
---|
| 2126 | + } |
---|
| 2127 | + |
---|
| 2128 | + void ToggleLocal() |
---|
| 2129 | + { |
---|
| 2130 | + LOCALTRANSFORM ^= true; |
---|
| 2131 | + } |
---|
| 2132 | + |
---|
| 2133 | + public void ToggleTexture() |
---|
1455 | 2134 | { |
---|
1456 | 2135 | textureon ^= true; |
---|
1457 | 2136 | } |
---|
1458 | 2137 | |
---|
1459 | | - void ToggleLive() |
---|
| 2138 | + public void ToggleLive() |
---|
1460 | 2139 | { |
---|
1461 | 2140 | Globals.setLIVE(Globals.isLIVE() ^ true); |
---|
1462 | 2141 | |
---|
.. | .. |
---|
1468 | 2147 | repaint(); // start loop // may 2013 |
---|
1469 | 2148 | } |
---|
1470 | 2149 | |
---|
1471 | | - void ToggleSupport() |
---|
| 2150 | + public void ToggleSupport() |
---|
1472 | 2151 | { |
---|
1473 | 2152 | SUPPORT ^= true; |
---|
1474 | 2153 | } |
---|
1475 | 2154 | |
---|
1476 | | - void ToggleAbort() |
---|
| 2155 | + public void ToggleAbort() |
---|
1477 | 2156 | { |
---|
1478 | 2157 | ABORTMODE ^= true; |
---|
1479 | 2158 | } |
---|
1480 | 2159 | |
---|
1481 | | - void ToggleFullScreen() |
---|
1482 | | - { |
---|
1483 | | - FULLSCREEN ^= true; |
---|
1484 | | - } |
---|
1485 | | - |
---|
1486 | | - void ToggleCrowd() |
---|
1487 | | - { |
---|
1488 | | - Globals.CROWD ^= true; |
---|
1489 | | - } |
---|
1490 | | - |
---|
1491 | | - void ToggleInertia() |
---|
| 2160 | + public void ToggleInertia() |
---|
1492 | 2161 | { |
---|
1493 | 2162 | INERTIA ^= true; |
---|
1494 | 2163 | } |
---|
1495 | 2164 | |
---|
1496 | | - void ToggleLocal() |
---|
1497 | | - { |
---|
1498 | | - LOCALTRANSFORM ^= true; |
---|
1499 | | - } |
---|
1500 | | - |
---|
1501 | | - void ToggleFast() |
---|
| 2165 | + public void ToggleFast() |
---|
1502 | 2166 | { |
---|
1503 | 2167 | FAST ^= true; |
---|
1504 | 2168 | } |
---|
1505 | 2169 | |
---|
1506 | | - void ToggleSlowPose() |
---|
| 2170 | + public void ToggleSlowPose() |
---|
1507 | 2171 | { |
---|
1508 | 2172 | SLOWPOSE ^= true; |
---|
1509 | 2173 | } |
---|
1510 | 2174 | |
---|
1511 | | - void ToggleFootContact() |
---|
1512 | | - { |
---|
1513 | | - FOOTCONTACT ^= true; |
---|
1514 | | - } |
---|
1515 | | - |
---|
1516 | | - void ToggleBoxMode() |
---|
| 2175 | + public void ToggleBoxMode() |
---|
1517 | 2176 | { |
---|
1518 | 2177 | BOXMODE ^= true; |
---|
1519 | 2178 | } |
---|
1520 | 2179 | |
---|
1521 | | - void ToggleSmoothFocus() |
---|
| 2180 | + public void ToggleZoomBoxMode() |
---|
| 2181 | + { |
---|
| 2182 | + ZOOMBOXMODE ^= true; |
---|
| 2183 | + } |
---|
| 2184 | + |
---|
| 2185 | + public void ToggleSmoothFocus() |
---|
1522 | 2186 | { |
---|
1523 | 2187 | SMOOTHFOCUS ^= true; |
---|
1524 | 2188 | } |
---|
1525 | 2189 | |
---|
1526 | | - void ToggleImageFlip() |
---|
| 2190 | + public void ToggleImageFlip() |
---|
1527 | 2191 | { |
---|
1528 | 2192 | IMAGEFLIP ^= true; |
---|
1529 | 2193 | } |
---|
1530 | 2194 | |
---|
1531 | | - void ToggleSpeakerMocap() |
---|
| 2195 | + public void ToggleSpeakerMocap() |
---|
1532 | 2196 | { |
---|
1533 | 2197 | SPEAKERMOCAP ^= true; |
---|
1534 | 2198 | } |
---|
1535 | 2199 | |
---|
1536 | | - void ToggleSpeakerCamera() |
---|
| 2200 | + public void ToggleSpeakerCamera() |
---|
1537 | 2201 | { |
---|
1538 | 2202 | SPEAKERCAMERA ^= true; |
---|
1539 | 2203 | } |
---|
1540 | 2204 | |
---|
1541 | | - void ToggleSpeakerFocus() |
---|
| 2205 | + public void ToggleSpeakerFocus() |
---|
1542 | 2206 | { |
---|
1543 | 2207 | SPEAKERFOCUS ^= true; |
---|
1544 | 2208 | } |
---|
1545 | 2209 | |
---|
1546 | | - void ToggleDebug() |
---|
1547 | | - { |
---|
1548 | | - DEBUG ^= true; |
---|
1549 | | - } |
---|
1550 | | - |
---|
1551 | | - void ToggleFrustum() |
---|
| 2210 | + public void ToggleFrustum() |
---|
1552 | 2211 | { |
---|
1553 | 2212 | FRUSTUM ^= true; |
---|
1554 | 2213 | } |
---|
1555 | 2214 | |
---|
1556 | | - void ToggleTrack() |
---|
| 2215 | + public void ToggleTrack() |
---|
1557 | 2216 | { |
---|
1558 | 2217 | TRACK ^= true; |
---|
1559 | 2218 | if (TRACK) |
---|
.. | .. |
---|
1572 | 2231 | repaint(); |
---|
1573 | 2232 | } |
---|
1574 | 2233 | |
---|
1575 | | - void ToggleTrackOnce() |
---|
| 2234 | + public void ToggleTrackOnce() |
---|
1576 | 2235 | { |
---|
1577 | 2236 | TRACKONCE ^= true; |
---|
1578 | 2237 | } |
---|
1579 | 2238 | |
---|
1580 | | - void ToggleShadowTrack() |
---|
| 2239 | + public void ToggleShadowTrack() |
---|
1581 | 2240 | { |
---|
1582 | 2241 | SHADOWTRACK ^= true; |
---|
1583 | 2242 | repaint(); |
---|
1584 | 2243 | } |
---|
1585 | 2244 | |
---|
1586 | | - void ToggleOeil() |
---|
| 2245 | + public void ToggleOeil() |
---|
1587 | 2246 | { |
---|
1588 | 2247 | OEIL ^= true; |
---|
1589 | 2248 | } |
---|
1590 | 2249 | |
---|
1591 | | - void ToggleOeilOnce() |
---|
| 2250 | + public void ToggleOeilOnce() |
---|
1592 | 2251 | { |
---|
1593 | 2252 | OEILONCE ^= true; |
---|
| 2253 | + } |
---|
| 2254 | + |
---|
| 2255 | + void ToggleFootContact() |
---|
| 2256 | + { |
---|
| 2257 | + FOOTCONTACT ^= true; |
---|
| 2258 | + } |
---|
| 2259 | + |
---|
| 2260 | + void ToggleDebug() |
---|
| 2261 | + { |
---|
| 2262 | + DEBUG ^= true; |
---|
1594 | 2263 | } |
---|
1595 | 2264 | |
---|
1596 | 2265 | void ToggleLookAt() |
---|
.. | .. |
---|
7652 | 8321 | return texture!=null?texture.texture:null; |
---|
7653 | 8322 | } |
---|
7654 | 8323 | |
---|
7655 | | - com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution) |
---|
| 8324 | + public com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution) |
---|
7656 | 8325 | { |
---|
7657 | 8326 | CacheTexture texture = GetCacheTexture(tex, bump, resolution); |
---|
7658 | 8327 | |
---|
.. | .. |
---|
10340 | 11009 | fragmentMode |= (lightslot - 64) << 2; // 1; // first bit is available for aniso |
---|
10341 | 11010 | //System.out.println("fragmentMode = " + fragmentMode); |
---|
10342 | 11011 | |
---|
10343 | | - if (DrawMode() == DEFAULT || DrawMode() == SELECTION || DEBUG_SELECTION) |
---|
| 11012 | + if (DrawMode() == DEFAULT || DrawMode() == SELECTION || IsDebugSelection()) |
---|
10344 | 11013 | { |
---|
10345 | 11014 | /* |
---|
10346 | 11015 | if (CULLFACE || (ambientOcclusion && OCCLUSION_CULLING)) |
---|
.. | .. |
---|
10641 | 11310 | callist = gl.glGenLists(1); |
---|
10642 | 11311 | } |
---|
10643 | 11312 | |
---|
10644 | | - boolean selectmode = DrawMode() == SELECTION || CameraPane.DEBUG_SELECTION; |
---|
| 11313 | + boolean selectmode = DrawMode() == SELECTION || IsDebugSelection(); |
---|
10645 | 11314 | |
---|
10646 | 11315 | boolean active = !selectmode; // DrawMode() != SELECTION; // mouseDown; |
---|
10647 | 11316 | |
---|
.. | .. |
---|
12078 | 12747 | "MUL final.y, fragment.texcoord[0].x, c256;" + |
---|
12079 | 12748 | "FLR final.x, final.y;" + |
---|
12080 | 12749 | "SUB final.y, final.y, final.x;" + |
---|
12081 | | - "MUL final.x, final.x, c256i;" + |
---|
| 12750 | + //"MUL final.x, final.x, c256i;" + |
---|
12082 | 12751 | "MOV final.z, zero.x;" + |
---|
12083 | 12752 | "MOV final.a, one.w;":"" |
---|
12084 | 12753 | ) + |
---|
.. | .. |
---|
12086 | 12755 | "MUL final.y, fragment.texcoord[0].y, c256;" + |
---|
12087 | 12756 | "FLR final.x, final.y;" + |
---|
12088 | 12757 | "SUB final.y, final.y, final.x;" + |
---|
12089 | | - "MUL final.x, final.x, c256i;" + |
---|
| 12758 | + //"MUL final.x, final.x, c256i;" + |
---|
12090 | 12759 | "MOV final.z, zero.x;" + |
---|
12091 | 12760 | "MOV final.a, one.w;":"" |
---|
12092 | 12761 | ) + |
---|
.. | .. |
---|
12866 | 13535 | |
---|
12867 | 13536 | //System.err.println("Dtime = " + Dtime + "; units = " + e.getUnitsToScroll() + "; ratio (units/ms) = " + ratio); |
---|
12868 | 13537 | |
---|
| 13538 | + if (BUTTONLESSWHEEL) |
---|
12869 | 13539 | if (Math.abs(ratio) < 0.1 || Math.abs(Dtime) == 0) // < 30) |
---|
12870 | 13540 | { |
---|
12871 | 13541 | return; |
---|
.. | .. |
---|
12874 | 13544 | boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK); |
---|
12875 | 13545 | |
---|
12876 | 13546 | // TIMER |
---|
12877 | | - if (!wheeltimer.isRunning() && e.getModifiersEx() == 0 && !capsLocked) // VR |
---|
| 13547 | + if (ZOOMBOXMODE && !wheeltimer.isRunning() && e.getModifiersEx() == 0 && !capsLocked) // VR |
---|
12878 | 13548 | { |
---|
12879 | 13549 | keepboxmode = BOXMODE; |
---|
12880 | 13550 | keepsupport = SUPPORT; |
---|
.. | .. |
---|
13091 | 13761 | |
---|
13092 | 13762 | public void mouseDragged(MouseEvent e) |
---|
13093 | 13763 | { |
---|
| 13764 | + //System.out.println("mouseDragged: " + e); |
---|
13094 | 13765 | if (isRenderer) |
---|
13095 | 13766 | movingcamera = true; |
---|
13096 | 13767 | //if (drawing) |
---|
13097 | 13768 | //return; |
---|
13098 | | - //System.out.println("mouseDragged: " + e); |
---|
13099 | 13769 | if ((e.getModifiersEx() & CTRL) != 0 |
---|
13100 | 13770 | || (e.getModifiersEx() & COMMAND) != 0) // || IsFrozen()) |
---|
13101 | 13771 | { |
---|
.. | .. |
---|
13115 | 13785 | cVector tmp = new cVector(); |
---|
13116 | 13786 | cVector tmp2 = new cVector(); |
---|
13117 | 13787 | boolean isMoving; |
---|
| 13788 | + |
---|
| 13789 | + public cVector TargetLookAt() |
---|
| 13790 | + { |
---|
| 13791 | + return targetLookAt; |
---|
| 13792 | + } |
---|
13118 | 13793 | |
---|
13119 | 13794 | class PingThread extends Thread |
---|
13120 | 13795 | { |
---|
.. | .. |
---|
13625 | 14300 | public void mouseMoved(MouseEvent e) |
---|
13626 | 14301 | { |
---|
13627 | 14302 | //System.out.println("mouseMoved: " + e); |
---|
13628 | | - |
---|
13629 | 14303 | if (isRenderer) |
---|
13630 | 14304 | return; |
---|
13631 | 14305 | |
---|
.. | .. |
---|
13847 | 14521 | SetMouseMode(modifiers); |
---|
13848 | 14522 | } |
---|
13849 | 14523 | |
---|
13850 | | - theRenderer.keyPressed(key); |
---|
| 14524 | + Globals.theRenderer.keyPressed(key); |
---|
13851 | 14525 | } |
---|
13852 | 14526 | |
---|
13853 | 14527 | int kompactbit = 4; // power bit |
---|
.. | .. |
---|
13859 | 14533 | float SATPOW = 1; // 2; // 0.5f; |
---|
13860 | 14534 | float BRIPOW = 1; // 0.5f; // 0.5f; |
---|
13861 | 14535 | |
---|
13862 | | - void keyPressed(int key) |
---|
| 14536 | + public void keyPressed(int key) |
---|
13863 | 14537 | { |
---|
13864 | 14538 | if (key >= '0' && key <= '5') |
---|
13865 | 14539 | clampbit = (key-'0'); |
---|
.. | .. |
---|
14296 | 14970 | } |
---|
14297 | 14971 | //System.out.println("shaper_fovy = " + manipCamera.shaper_fovy); |
---|
14298 | 14972 | } |
---|
| 14973 | + |
---|
14299 | 14974 | static double OCCLUSIONBOOST = 1; // 0.5; |
---|
14300 | 14975 | |
---|
14301 | 14976 | void keyReleased(int key, int modifiers) |
---|
.. | .. |
---|
14307 | 14982 | } |
---|
14308 | 14983 | } |
---|
14309 | 14984 | |
---|
14310 | | - protected void processKeyEvent(KeyEvent e) |
---|
| 14985 | + public void processKeyEvent(KeyEvent e) |
---|
14311 | 14986 | { |
---|
14312 | 14987 | switch (e.getID()) |
---|
14313 | 14988 | { |
---|
.. | .. |
---|
14437 | 15112 | |
---|
14438 | 15113 | protected void processMouseMotionEvent(MouseEvent e) |
---|
14439 | 15114 | { |
---|
14440 | | - //System.out.println("processMouseMotionEvent: " + mouseMode); |
---|
14441 | | - if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0) |
---|
| 15115 | + //System.out.println("processMouseMotionEvent: " + mouseMode + " " + e.getModifiers() + " " + e.getModifiersEx() + " " + e.getButton()); |
---|
| 15116 | + //if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0) |
---|
| 15117 | + if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) == 0 && (mouseMode & SELECT) == 0) |
---|
14442 | 15118 | { |
---|
14443 | 15119 | mouseMoved(e); |
---|
14444 | 15120 | } else |
---|
.. | .. |
---|
15966 | 16642 | |
---|
15967 | 16643 | class AntialiasBuffer implements GLEventListener |
---|
15968 | 16644 | { |
---|
15969 | | - |
---|
15970 | 16645 | CameraPane parent = null; |
---|
15971 | 16646 | |
---|
15972 | 16647 | AntialiasBuffer(CameraPane p) |
---|
.. | .. |
---|
16359 | 17034 | } |
---|
16360 | 17035 | } |
---|
16361 | 17036 | |
---|
16362 | | - static void DrawPoints(CameraPane cpane) |
---|
| 17037 | + static void DrawPoints(iCameraPane cpane) |
---|
16363 | 17038 | { |
---|
16364 | 17039 | for (int i=0; i<8; i++) // first and last are red |
---|
16365 | 17040 | { |
---|
.. | .. |
---|
16391 | 17066 | static IntBuffer textbuffer = null; // IntBuffer.allocate(TEXT_WIDTH*8*8 * TEXT_HEIGHT); |
---|
16392 | 17067 | // Depth buffer format |
---|
16393 | 17068 | //private int depth_format; |
---|
16394 | | - static public void NextIndex(Object3D o, GL gl) |
---|
| 17069 | + |
---|
| 17070 | + public void NextIndex() |
---|
16395 | 17071 | { |
---|
16396 | 17072 | indexcount+=16; |
---|
16397 | | - gl.glColor3d(((indexcount >>> 16) & 255) / 255.0, ((indexcount >>> 8) & 255) / 255.0, ((indexcount) & 255) / 255.0); |
---|
| 17073 | + GetGL().glColor3d(((indexcount >>> 16) & 255) / 255.0, ((indexcount >>> 8) & 255) / 255.0, ((indexcount) & 255) / 255.0); |
---|
16398 | 17074 | //objects[indexcount] = o; |
---|
16399 | 17075 | //System.out.println("indexcount = " + indexcount); |
---|
16400 | 17076 | } |
---|