.. | .. |
---|
56 | 56 | static int CURRENTANTIALIAS = 0; // 1; |
---|
57 | 57 | /*static*/ boolean RENDERSHADOW = true; |
---|
58 | 58 | /*static*/ int RENDERPROGRAM = 2; // 0 == none, 1 == fast, 2 == normal |
---|
59 | | - static boolean ANIMATION = false; |
---|
60 | | - static String filename; |
---|
61 | 59 | |
---|
62 | 60 | boolean DISPLAYTEXT = false; |
---|
63 | 61 | //boolean REDUCETEXTURE = true; |
---|
.. | .. |
---|
92 | 90 | |
---|
93 | 91 | static int tickcount = 0; // slow pose issue |
---|
94 | 92 | |
---|
| 93 | +static boolean BUTTONLESSWHEEL = false; |
---|
| 94 | +static boolean ZOOMBOXMODE = false; |
---|
95 | 95 | static boolean BOXMODE = false; |
---|
96 | 96 | static boolean IMAGEFLIP = false; |
---|
97 | 97 | static boolean SMOOTHFOCUS = false; |
---|
.. | .. |
---|
106 | 106 | static boolean OEIL = true; |
---|
107 | 107 | static boolean OEILONCE = false; // do oeilon then oeiloff |
---|
108 | 108 | static boolean LOOKAT = true; |
---|
109 | | -static boolean RANDOM = true; // false; |
---|
| 109 | +static boolean SWITCH = true; // false; |
---|
110 | 110 | static boolean HANDLES = false; // selection doesn't work!! |
---|
111 | 111 | static boolean PAINTMODE = false; |
---|
112 | 112 | |
---|
.. | .. |
---|
149 | 149 | defaultcaps.setAccumBlueBits(16); |
---|
150 | 150 | defaultcaps.setAccumAlphaBits(16); |
---|
151 | 151 | } |
---|
152 | | - static CameraPane theRenderer; |
---|
153 | | - |
---|
| 152 | + |
---|
154 | 153 | void SetAsGLRenderer(boolean b) |
---|
155 | 154 | { |
---|
156 | 155 | isRenderer = b; |
---|
157 | | - theRenderer = this; |
---|
| 156 | + Globals.theRenderer = this; |
---|
158 | 157 | } |
---|
159 | 158 | |
---|
160 | 159 | CameraPane(Object3D o, Camera cam, boolean withcontext) |
---|
.. | .. |
---|
192 | 191 | |
---|
193 | 192 | /// INTERFACE |
---|
194 | 193 | |
---|
| 194 | + public javax.media.opengl.GL GetGL0() |
---|
| 195 | + { |
---|
| 196 | + return null; |
---|
| 197 | + } |
---|
| 198 | + |
---|
| 199 | + public int GenList() |
---|
| 200 | + { |
---|
| 201 | + javax.media.opengl.GL gl = GetGL(); |
---|
| 202 | + return gl.glGenLists(1); |
---|
| 203 | + } |
---|
| 204 | + |
---|
| 205 | + public void NewList(int id) |
---|
| 206 | + { |
---|
| 207 | + javax.media.opengl.GL gl = GetGL(); |
---|
| 208 | + gl.glNewList(id, gl.GL_COMPILE); //_AND_EXECUTE); |
---|
| 209 | + } |
---|
| 210 | + |
---|
| 211 | + public void CallList(int id) |
---|
| 212 | + { |
---|
| 213 | + javax.media.opengl.GL gl = GetGL(); |
---|
| 214 | + gl.glCallList(id); |
---|
| 215 | + } |
---|
| 216 | + |
---|
| 217 | + public void EndList() |
---|
| 218 | + { |
---|
| 219 | + javax.media.opengl.GL gl = GetGL(); |
---|
| 220 | + gl.glEndList(); |
---|
| 221 | + } |
---|
| 222 | + |
---|
195 | 223 | public boolean IsBoxMode() |
---|
196 | 224 | { |
---|
197 | 225 | return BOXMODE; |
---|
| 226 | + } |
---|
| 227 | + |
---|
| 228 | + public boolean IsZoomBoxMode() |
---|
| 229 | + { |
---|
| 230 | + return ZOOMBOXMODE; |
---|
198 | 231 | } |
---|
199 | 232 | |
---|
200 | 233 | public void ClearDepth() |
---|
.. | .. |
---|
236 | 269 | return this.ambientOcclusion; |
---|
237 | 270 | } |
---|
238 | 271 | |
---|
| 272 | + public boolean IsDebugSelection() |
---|
| 273 | + { |
---|
| 274 | + return DEBUG_SELECTION; |
---|
| 275 | + } |
---|
| 276 | + |
---|
239 | 277 | public boolean IsFrozen() |
---|
240 | 278 | { |
---|
241 | | - boolean selectmode = this.DrawMode() == SELECTION || CameraPane.DEBUG_SELECTION; |
---|
| 279 | + boolean selectmode = this.DrawMode() == SELECTION || this.IsDebugSelection(); |
---|
242 | 280 | |
---|
243 | 281 | return !selectmode && cameracount == 0; // != 0; |
---|
244 | 282 | } |
---|
.. | .. |
---|
259 | 297 | return lightCamera; |
---|
260 | 298 | } |
---|
261 | 299 | |
---|
| 300 | + public Camera ManipCamera() |
---|
| 301 | + { |
---|
| 302 | + return manipCamera; |
---|
| 303 | + } |
---|
| 304 | + |
---|
262 | 305 | public Camera RenderCamera() |
---|
263 | 306 | { |
---|
264 | 307 | return renderCamera; |
---|
| 308 | + } |
---|
| 309 | + |
---|
| 310 | + public Camera[] Cameras() |
---|
| 311 | + { |
---|
| 312 | + return cameras; |
---|
265 | 313 | } |
---|
266 | 314 | |
---|
267 | 315 | public void PushMaterial(Object3D obj, boolean selected) |
---|
.. | .. |
---|
408 | 456 | |
---|
409 | 457 | javax.media.opengl.GL gl = display.GetGL(); |
---|
410 | 458 | |
---|
411 | | - boolean selectmode = display.DrawMode() == display.SELECTION || CameraPane.DEBUG_SELECTION; |
---|
| 459 | + boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
412 | 460 | |
---|
413 | 461 | //System.out.println("p = " + pv + "; q = " + qv + "; r = " + rv); |
---|
414 | 462 | if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0) |
---|
.. | .. |
---|
760 | 808 | //// tris.postdraw(this); |
---|
761 | 809 | } |
---|
762 | 810 | |
---|
| 811 | + static Camera localcamera = new Camera(); |
---|
| 812 | + static cVector from = new cVector(); |
---|
| 813 | + static cVector to = new cVector(); |
---|
| 814 | + |
---|
| 815 | + public void PrepOcclusion(BoundaryRep br, double[][] transform) |
---|
| 816 | + { |
---|
| 817 | + CameraPane cp = this; |
---|
| 818 | + |
---|
| 819 | + Camera keep = cp.RenderCamera(); |
---|
| 820 | + cp.renderCamera = localcamera; |
---|
| 821 | + |
---|
| 822 | + if (br.trimmed) |
---|
| 823 | + { |
---|
| 824 | + float[] colors = new float[br.positions.length / 3]; |
---|
| 825 | + |
---|
| 826 | + int i3 = 0; |
---|
| 827 | + for (int i = 0; i < br.positions.length / 3; i++, i3 += 3) |
---|
| 828 | + { |
---|
| 829 | + if (br.normals[i3] == 0 && br.normals[i3+1] == 0 && br.normals[i3+2] == 0) |
---|
| 830 | + continue; |
---|
| 831 | + |
---|
| 832 | + from.set(br.positions[i3], br.positions[i3 + 1], br.positions[i3 + 2]); |
---|
| 833 | + to.set(br.positions[i3] + br.normals[i3], |
---|
| 834 | + br.positions[i3 + 1] + br.normals[i3 + 1], |
---|
| 835 | + br.positions[i3 + 2] + br.normals[i3 + 2]); |
---|
| 836 | + LA.xformPos(from, transform, from); |
---|
| 837 | + LA.xformPos(to, transform, to); // RIGID ONLY |
---|
| 838 | + localcamera.setAim(from, to); |
---|
| 839 | + |
---|
| 840 | + CameraPane.occlusionbuffer.display(); |
---|
| 841 | + |
---|
| 842 | + if (CameraPane.DEBUG_OCCLUSION) |
---|
| 843 | + cp.display(); // debug |
---|
| 844 | + |
---|
| 845 | + colors[i] = cp.vertexOcclusion.r; |
---|
| 846 | + //colors[i3 + 1] = cp.vertexOcclusion.g; |
---|
| 847 | + //colors[i3 + 2] = cp.vertexOcclusion.b; |
---|
| 848 | + |
---|
| 849 | + if ((i % 100) == 0 && i != 0) |
---|
| 850 | + { |
---|
| 851 | + Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR)); |
---|
| 852 | + //System.out.println("Color = " + cp.vertexOcclusion.r + ", " + cp.vertexOcclusion.g + ", " + cp.vertexOcclusion.b + "; " + (int)(100.0*i/(positions.length/3)) + "% done"); |
---|
| 853 | + System.out.println((int) (100.0 * i / (br.positions.length / 3)) + "% (" + i + " of " + (br.positions.length / 3) + ")"); |
---|
| 854 | + } |
---|
| 855 | + } |
---|
| 856 | + |
---|
| 857 | + br.colors = colors; |
---|
| 858 | + } |
---|
| 859 | + else |
---|
| 860 | + { |
---|
| 861 | + for (int i = 0; i < br.VertexCount(); i++) |
---|
| 862 | + { |
---|
| 863 | + Vertex v = br.GetVertex(i); |
---|
| 864 | + |
---|
| 865 | + if (v.norm == null || v.norm.x == 0 && v.norm.y == 0 && v.norm.z == 0) |
---|
| 866 | + continue; |
---|
| 867 | + |
---|
| 868 | + from.set(v.x, v.y, v.z); |
---|
| 869 | + to.set(v.x+v.norm.x, v.y+v.norm.y, v.z+v.norm.z); |
---|
| 870 | + LA.xformPos(from, transform, from); |
---|
| 871 | + LA.xformPos(to, transform, to); // RIGID ONLY |
---|
| 872 | + localcamera.setAim(from, to); |
---|
| 873 | + |
---|
| 874 | + CameraPane.occlusionbuffer.display(); |
---|
| 875 | + |
---|
| 876 | + if (CameraPane.DEBUG_OCCLUSION) |
---|
| 877 | + cp.display(); // debug |
---|
| 878 | + |
---|
| 879 | + v.AO = cp.vertexOcclusion.r; |
---|
| 880 | + |
---|
| 881 | + if ((i % 100) == 0 && i != 0) |
---|
| 882 | + { |
---|
| 883 | + Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR)); |
---|
| 884 | + //System.out.println("Color = " + cp.vertexOcclusion.r + ", " + cp.vertexOcclusion.g + ", " + cp.vertexOcclusion.b + "; " + (int)(100.0*i/(positions.length/3)) + "% done"); |
---|
| 885 | + System.out.println((int) (100.0 * i / br.VertexCount()) + "% (" + i + " of " + br.VertexCount() + ")"); |
---|
| 886 | + } |
---|
| 887 | + } |
---|
| 888 | + } |
---|
| 889 | + |
---|
| 890 | + //System.out.println("done."); |
---|
| 891 | + |
---|
| 892 | + cp.renderCamera = keep; |
---|
| 893 | + } |
---|
| 894 | + |
---|
| 895 | + void DrawPointFLow(PointFlow pointFlow, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 896 | + { |
---|
| 897 | + CameraPane display = this; |
---|
| 898 | + pointFlow.CreateHT(); |
---|
| 899 | + |
---|
| 900 | + float r = display.modelParams0[0]; |
---|
| 901 | + float g = display.modelParams0[1]; |
---|
| 902 | + float b = display.modelParams0[2]; |
---|
| 903 | + float opacity = display.modelParams5[1]; |
---|
| 904 | + |
---|
| 905 | + //final GL gl = GLU.getCurrentGL(); |
---|
| 906 | + GL gl = display.GetGL(); // getGL(); |
---|
| 907 | + |
---|
| 908 | + int s = pointFlow.points.size(); |
---|
| 909 | + |
---|
| 910 | + boolean cf = gl.glIsEnabled(gl.GL_CULL_FACE); |
---|
| 911 | + gl.glEnable(gl.GL_CULL_FACE); |
---|
| 912 | + |
---|
| 913 | + for (int i=s; --i>=0;) |
---|
| 914 | + //for (int i=0; i<s; i++) |
---|
| 915 | + { |
---|
| 916 | + cVector v = pointFlow.points.get(i); |
---|
| 917 | + |
---|
| 918 | + double mindist = Double.MAX_VALUE; |
---|
| 919 | + |
---|
| 920 | + double size = pointFlow.minimumSize; |
---|
| 921 | + |
---|
| 922 | + double distancenext = 0; |
---|
| 923 | + |
---|
| 924 | + if (i > 0) |
---|
| 925 | + { |
---|
| 926 | + cVector w = pointFlow.points.get(i-1); |
---|
| 927 | + |
---|
| 928 | + double dist = w.distance(v); |
---|
| 929 | + |
---|
| 930 | + distancenext = dist; |
---|
| 931 | + |
---|
| 932 | + if (mindist > dist) |
---|
| 933 | + { |
---|
| 934 | + mindist = dist; |
---|
| 935 | + size = mindist*pointFlow.resizefactor; |
---|
| 936 | + } |
---|
| 937 | + } |
---|
| 938 | + |
---|
| 939 | + if (i < s-1) |
---|
| 940 | + { |
---|
| 941 | + cVector w = pointFlow.points.get(i+1); |
---|
| 942 | + |
---|
| 943 | + double dist = w.distance(v); |
---|
| 944 | + |
---|
| 945 | + if (mindist > dist) |
---|
| 946 | + { |
---|
| 947 | + mindist = dist; |
---|
| 948 | + size = mindist*pointFlow.resizefactor; |
---|
| 949 | + } |
---|
| 950 | + } |
---|
| 951 | + |
---|
| 952 | + if (size < pointFlow.minimumSize) |
---|
| 953 | + size = pointFlow.minimumSize; |
---|
| 954 | + if (size > pointFlow.maximumSize) |
---|
| 955 | + size = pointFlow.maximumSize; |
---|
| 956 | + |
---|
| 957 | + double tx = v.x; |
---|
| 958 | + double ty = v.y; |
---|
| 959 | + double tz = v.z; |
---|
| 960 | + |
---|
| 961 | + // if (tx == 0 && ty == 0 && tz == 0) |
---|
| 962 | + // continue; |
---|
| 963 | + |
---|
| 964 | + gl.glMatrixMode(gl.GL_TEXTURE); |
---|
| 965 | + gl.glPushMatrix(); |
---|
| 966 | + pointFlow.texmat[12] = pointFlow.texmat[13] = pointFlow.texmat[14] = i; |
---|
| 967 | + |
---|
| 968 | + gl.glMultMatrixf(pointFlow.texmat, 0); |
---|
| 969 | + |
---|
| 970 | + gl.glMatrixMode(gl.GL_MODELVIEW); |
---|
| 971 | + gl.glPushMatrix(); |
---|
| 972 | + |
---|
| 973 | + gl.glTranslated(tx,ty,tz); |
---|
| 974 | + |
---|
| 975 | + gl.glScaled(size,size,size); |
---|
| 976 | + |
---|
| 977 | +// float cr = colorBuf.get(index4); |
---|
| 978 | +// float cg = colorBuf.get(index4+1); |
---|
| 979 | +// float cb = colorBuf.get(index4+2); |
---|
| 980 | +// float ca = colorBuf.get(index4+3); |
---|
| 981 | +// |
---|
| 982 | +// display.modelParams0[0] = r * cr; |
---|
| 983 | +// display.modelParams0[1] = g * cg; |
---|
| 984 | +// display.modelParams0[2] = b * cb; |
---|
| 985 | +// |
---|
| 986 | +// display.modelParams5[1] = opacity * ca; |
---|
| 987 | +// |
---|
| 988 | +// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 0, display.modelParams0, 0); |
---|
| 989 | +// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 5, display.modelParams5, 0); |
---|
| 990 | +// |
---|
| 991 | +// RandomNode.globalseed = (int)sizeBuf.get(index3+2); // i; |
---|
| 992 | +// RandomNode.globalseed2 = RandomNode.globalseed; |
---|
| 993 | +// |
---|
| 994 | +//// gl.glColor4f(cr,cg,cb,ca); |
---|
| 995 | +// // gl.glScalef(1024/16,1024/16,1024/16); |
---|
| 996 | + pointFlow.geo.Draw/*Node*/(display,null,selected, blocked); |
---|
| 997 | + |
---|
| 998 | + gl.glPopMatrix(); |
---|
| 999 | + |
---|
| 1000 | + double step = size/4; // |
---|
| 1001 | + |
---|
| 1002 | + if (i == 0 || size == 0 || distancenext > 8*size || distancenext < step) |
---|
| 1003 | + continue; |
---|
| 1004 | + |
---|
| 1005 | + int nbsteps = (int)(distancenext/step); |
---|
| 1006 | + |
---|
| 1007 | + step = distancenext/nbsteps; |
---|
| 1008 | + |
---|
| 1009 | + cVector next = pointFlow.points.get(i-1); |
---|
| 1010 | + |
---|
| 1011 | + tmp.set(next); |
---|
| 1012 | + tmp.sub(v); |
---|
| 1013 | + tmp.normalize(); |
---|
| 1014 | + tmp.mul(step); |
---|
| 1015 | + |
---|
| 1016 | + // calculate next size |
---|
| 1017 | + mindist = Double.MAX_VALUE; |
---|
| 1018 | + |
---|
| 1019 | + double nextsize = pointFlow.minimumSize; |
---|
| 1020 | + |
---|
| 1021 | + if (i > 1) |
---|
| 1022 | + { |
---|
| 1023 | + cVector w = pointFlow.points.get(i-2); |
---|
| 1024 | + |
---|
| 1025 | + double dist = w.distance(next); |
---|
| 1026 | + |
---|
| 1027 | + if (mindist > dist) |
---|
| 1028 | + { |
---|
| 1029 | + mindist = dist; |
---|
| 1030 | + nextsize = mindist*pointFlow.resizefactor; |
---|
| 1031 | + } |
---|
| 1032 | + } |
---|
| 1033 | + |
---|
| 1034 | + double dist = v.distance(next); |
---|
| 1035 | + |
---|
| 1036 | + if (mindist > dist) |
---|
| 1037 | + { |
---|
| 1038 | + mindist = dist; |
---|
| 1039 | + nextsize = mindist*pointFlow.resizefactor; |
---|
| 1040 | + } |
---|
| 1041 | + |
---|
| 1042 | + if (nextsize < pointFlow.minimumSize) |
---|
| 1043 | + nextsize = pointFlow.minimumSize; |
---|
| 1044 | + if (nextsize > pointFlow.maximumSize) |
---|
| 1045 | + nextsize = pointFlow.maximumSize; |
---|
| 1046 | + // |
---|
| 1047 | + |
---|
| 1048 | + double count = 0; |
---|
| 1049 | + |
---|
| 1050 | + while (distancenext > 0.000000001) // step |
---|
| 1051 | + { |
---|
| 1052 | + gl.glPushMatrix(); |
---|
| 1053 | + |
---|
| 1054 | + gl.glTranslated(tx + tmp.x*count, ty + tmp.y*count, tz + tmp.z*count); |
---|
| 1055 | + |
---|
| 1056 | + double K = count/nbsteps; |
---|
| 1057 | + |
---|
| 1058 | + double intersize = K*nextsize + (1-K)*size; |
---|
| 1059 | + |
---|
| 1060 | + gl.glScaled(intersize,intersize,intersize); |
---|
| 1061 | + |
---|
| 1062 | + pointFlow.geo.Draw/*Node*/(display,null,selected,blocked); |
---|
| 1063 | + |
---|
| 1064 | + count++; |
---|
| 1065 | + |
---|
| 1066 | + distancenext -= step; |
---|
| 1067 | + |
---|
| 1068 | + gl.glPopMatrix(); |
---|
| 1069 | + } |
---|
| 1070 | + |
---|
| 1071 | + if (count != nbsteps) |
---|
| 1072 | + assert(count == nbsteps); |
---|
| 1073 | + |
---|
| 1074 | + // gl.glScalef(16.0f/1024,16.0f/1024,16.0f/1024); |
---|
| 1075 | + //gl.glTranslatef(-tx,-ty,-tz); |
---|
| 1076 | + |
---|
| 1077 | + gl.glMatrixMode(gl.GL_TEXTURE); |
---|
| 1078 | + gl.glPopMatrix(); |
---|
| 1079 | + } |
---|
| 1080 | + |
---|
| 1081 | + if (!cf) |
---|
| 1082 | + gl.glDisable(gl.GL_CULL_FACE); |
---|
| 1083 | + |
---|
| 1084 | +// display.modelParams0[0] = r; |
---|
| 1085 | +// display.modelParams0[1] = g; |
---|
| 1086 | +// display.modelParams0[2] = b; |
---|
| 1087 | +// |
---|
| 1088 | +// display.modelParams5[1] = opacity; |
---|
| 1089 | +// |
---|
| 1090 | +// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 0, display.modelParams0, 0); |
---|
| 1091 | +// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 5, display.modelParams5, 0); |
---|
| 1092 | + |
---|
| 1093 | + gl.glMatrixMode(gl.GL_MODELVIEW); |
---|
| 1094 | + } |
---|
| 1095 | + |
---|
| 1096 | + public void DrawBox(cVector min, cVector max) |
---|
| 1097 | + { |
---|
| 1098 | + javax.media.opengl.GL gl = GetGL(); |
---|
| 1099 | + gl.glBegin(gl.GL_LINES); |
---|
| 1100 | + |
---|
| 1101 | + gl.glVertex3d(min.x, min.y, min.z); |
---|
| 1102 | + gl.glVertex3d(min.x, min.y, max.z); |
---|
| 1103 | + gl.glVertex3d(min.x, min.y, min.z); |
---|
| 1104 | + gl.glVertex3d(min.x, max.y, min.z); |
---|
| 1105 | + gl.glVertex3d(min.x, min.y, min.z); |
---|
| 1106 | + gl.glVertex3d(max.x, min.y, min.z); |
---|
| 1107 | + |
---|
| 1108 | + gl.glVertex3d(max.x, max.y, max.z); |
---|
| 1109 | + gl.glVertex3d(min.x, max.y, max.z); |
---|
| 1110 | + gl.glVertex3d(max.x, max.y, max.z); |
---|
| 1111 | + gl.glVertex3d(max.x, min.y, max.z); |
---|
| 1112 | + gl.glVertex3d(max.x, max.y, max.z); |
---|
| 1113 | + gl.glVertex3d(max.x, max.y, min.z); |
---|
| 1114 | + |
---|
| 1115 | + gl.glEnd(); |
---|
| 1116 | + } |
---|
| 1117 | + |
---|
| 1118 | + public void DrawGeometry(BoundaryRep bRep, boolean flipV, boolean selectmode) |
---|
| 1119 | + { |
---|
| 1120 | + int[] strips = bRep.getRawIndices(); |
---|
| 1121 | + |
---|
| 1122 | + javax.media.opengl.GL gl = GetGL(); |
---|
| 1123 | + |
---|
| 1124 | + // TRIANGLE STRIP ARRAY |
---|
| 1125 | + if (bRep.trimmed) |
---|
| 1126 | + { |
---|
| 1127 | + float[] v = bRep.getRawVertices(); |
---|
| 1128 | + float[] n = bRep.getRawNormals(); |
---|
| 1129 | + float[] c = bRep.getRawColors(); |
---|
| 1130 | + float[] uv = bRep.getRawUVMap(); |
---|
| 1131 | + |
---|
| 1132 | + int count2 = 0; |
---|
| 1133 | + int count3 = 0; |
---|
| 1134 | + |
---|
| 1135 | + if (n.length > 0) |
---|
| 1136 | + { |
---|
| 1137 | + for (int i = 0; i < strips.length; i++) |
---|
| 1138 | + { |
---|
| 1139 | + gl.glBegin(gl.GL_TRIANGLE_STRIP); |
---|
| 1140 | + |
---|
| 1141 | + /* |
---|
| 1142 | + boolean locked = false; |
---|
| 1143 | + float eps = 0.1f; |
---|
| 1144 | + boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice |
---|
| 1145 | + |
---|
| 1146 | + int dot = 0; |
---|
| 1147 | + |
---|
| 1148 | + if ((dot&1) == 0) |
---|
| 1149 | + dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1; |
---|
| 1150 | + |
---|
| 1151 | + if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) |
---|
| 1152 | + gl.glTexCoord2f((float) qv.s, (float) qv.t); |
---|
| 1153 | + else |
---|
| 1154 | + { |
---|
| 1155 | + locked = true; |
---|
| 1156 | + gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
| 1157 | + } |
---|
| 1158 | + //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z); |
---|
| 1159 | + gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z); |
---|
| 1160 | + if (hasnorm) |
---|
| 1161 | + { |
---|
| 1162 | + //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z); |
---|
| 1163 | + gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z); |
---|
| 1164 | + } |
---|
| 1165 | + |
---|
| 1166 | + if ((dot&4) == 0) |
---|
| 1167 | + dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4; |
---|
| 1168 | + |
---|
| 1169 | + if (wrap || !locked && (dot&8) != 0) |
---|
| 1170 | + gl.glTexCoord2f((float) rv.s, (float) rv.t); |
---|
| 1171 | + else |
---|
| 1172 | + gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
| 1173 | + |
---|
| 1174 | + f.dot = dot; |
---|
| 1175 | + */ |
---|
| 1176 | + |
---|
| 1177 | + if (!selectmode) |
---|
| 1178 | + { |
---|
| 1179 | + if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
| 1180 | + { |
---|
| 1181 | + gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
| 1182 | + } else |
---|
| 1183 | + { |
---|
| 1184 | + gl.glNormal3f(0, 0, 1); |
---|
| 1185 | + } |
---|
| 1186 | + |
---|
| 1187 | + if (c != null) |
---|
| 1188 | + //System.out.println("glcolor = " + c[count3] + ", " + c[count3+1] + ", " + c[count3+2]); |
---|
| 1189 | + { |
---|
| 1190 | + gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
| 1191 | + } |
---|
| 1192 | + } |
---|
| 1193 | + if (flipV) |
---|
| 1194 | + gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
| 1195 | + else |
---|
| 1196 | + gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1197 | + //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
| 1198 | + gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
| 1199 | + |
---|
| 1200 | + count2 += 2; |
---|
| 1201 | + count3 += 3; |
---|
| 1202 | + if (!selectmode) |
---|
| 1203 | + { |
---|
| 1204 | + if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
| 1205 | + { |
---|
| 1206 | + gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
| 1207 | + } else |
---|
| 1208 | + { |
---|
| 1209 | + gl.glNormal3f(0, 0, 1); |
---|
| 1210 | + } |
---|
| 1211 | + if (c != null) |
---|
| 1212 | + { |
---|
| 1213 | + gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
| 1214 | + } |
---|
| 1215 | + } |
---|
| 1216 | + if (flipV) |
---|
| 1217 | + gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
| 1218 | + else |
---|
| 1219 | + gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1220 | + //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
| 1221 | + gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
| 1222 | + |
---|
| 1223 | + count2 += 2; |
---|
| 1224 | + count3 += 3; |
---|
| 1225 | + for (int j = 0; j < strips[i] - 2; j++) |
---|
| 1226 | + { |
---|
| 1227 | + //gl.glTexCoord2d(...); |
---|
| 1228 | + if (!selectmode) |
---|
| 1229 | + { |
---|
| 1230 | + if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
| 1231 | + { |
---|
| 1232 | + gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
| 1233 | + } else |
---|
| 1234 | + { |
---|
| 1235 | + gl.glNormal3f(0, 0, 1); |
---|
| 1236 | + } |
---|
| 1237 | + if (c != null) |
---|
| 1238 | + { |
---|
| 1239 | + gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
| 1240 | + } |
---|
| 1241 | + } |
---|
| 1242 | + |
---|
| 1243 | + if (flipV) |
---|
| 1244 | + gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
| 1245 | + else |
---|
| 1246 | + gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1247 | + //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]); |
---|
| 1248 | + gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
| 1249 | + count2 += 2; |
---|
| 1250 | + count3 += 3; |
---|
| 1251 | + } |
---|
| 1252 | + |
---|
| 1253 | + gl.glEnd(); |
---|
| 1254 | + } |
---|
| 1255 | + } |
---|
| 1256 | + |
---|
| 1257 | + assert count3 == v.length; |
---|
| 1258 | + } |
---|
| 1259 | + else // !trimmed |
---|
| 1260 | + { |
---|
| 1261 | + int count = 0; |
---|
| 1262 | + for (int i = 0; i < strips.length; i++) |
---|
| 1263 | + { |
---|
| 1264 | + gl.glBegin(gl.GL_TRIANGLE_STRIP); |
---|
| 1265 | + |
---|
| 1266 | + Vertex p = bRep.GetVertex(bRep.indices[count++]); |
---|
| 1267 | + Vertex q = bRep.GetVertex(bRep.indices[count++]); |
---|
| 1268 | + |
---|
| 1269 | + drawVertex(gl, p, flipV, selectmode); |
---|
| 1270 | + drawVertex(gl, q, flipV, selectmode); |
---|
| 1271 | + |
---|
| 1272 | + for (int j = 0; j < strips[i] - 2; j++) |
---|
| 1273 | + { |
---|
| 1274 | + Vertex r = bRep.GetVertex(bRep.indices[count++]); |
---|
| 1275 | + |
---|
| 1276 | + // if (j%2 == 0) |
---|
| 1277 | + // drawFace(p, q, r, display, null); |
---|
| 1278 | + // else |
---|
| 1279 | + // drawFace(p, r, q, display, null); |
---|
| 1280 | + |
---|
| 1281 | + // p = q; |
---|
| 1282 | + // q = r; |
---|
| 1283 | + drawVertex(gl, r, flipV, selectmode); |
---|
| 1284 | + } |
---|
| 1285 | + |
---|
| 1286 | + gl.glEnd(); |
---|
| 1287 | + } |
---|
| 1288 | + } |
---|
| 1289 | + } |
---|
| 1290 | + |
---|
| 1291 | + static cSpring.Point3D temp = new cSpring.Point3D(); |
---|
| 1292 | + static cSpring.Point3D temp2 = new cSpring.Point3D(); |
---|
| 1293 | + static cSpring.Point3D temp3 = new cSpring.Point3D(); |
---|
| 1294 | + |
---|
| 1295 | + public void DrawDynamicMesh(cMesh mesh) |
---|
| 1296 | + { |
---|
| 1297 | + GL gl = GetGL(); // getGL(); |
---|
| 1298 | + |
---|
| 1299 | + cSpring.PhysicsController3D Phys = mesh.Phys; |
---|
| 1300 | + |
---|
| 1301 | + gl.glDisable(gl.GL_LIGHTING); |
---|
| 1302 | + |
---|
| 1303 | + gl.glLineWidth(1); |
---|
| 1304 | + gl.glColor3f(1,1,1); |
---|
| 1305 | + gl.glBegin(gl.GL_LINES); |
---|
| 1306 | + double scale = 0; |
---|
| 1307 | + int count = 0; |
---|
| 1308 | + for (int s=0; s<Phys.allSprings.size(); s++) |
---|
| 1309 | + { |
---|
| 1310 | + cSpring.Spring spring = Phys.allSprings.get(s); |
---|
| 1311 | + if(s == 0) |
---|
| 1312 | + { |
---|
| 1313 | + //System.out.println(" spring : " + spring.a.position + "; " + spring.b.position); |
---|
| 1314 | + } |
---|
| 1315 | + if (mesh.showsprings) |
---|
| 1316 | + { |
---|
| 1317 | + temp.set(spring.a.position); |
---|
| 1318 | + temp.add(spring.b.position); |
---|
| 1319 | + temp.mul(0.5); |
---|
| 1320 | + temp2.set(spring.a.position); |
---|
| 1321 | + temp2.sub(spring.b.position); |
---|
| 1322 | + temp2.mul(spring.restLength/2); |
---|
| 1323 | + temp.sub(temp2); |
---|
| 1324 | + gl.glVertex3f((float)temp.x, (float)temp.y, (float)temp.z); |
---|
| 1325 | + temp.add(temp2); |
---|
| 1326 | + temp.add(temp2); |
---|
| 1327 | + gl.glVertex3f((float)temp.x, (float)temp.y, (float)temp.z); |
---|
| 1328 | + } |
---|
| 1329 | + |
---|
| 1330 | + if (spring.isHandle) |
---|
| 1331 | + continue; |
---|
| 1332 | + |
---|
| 1333 | + //if (scale < spring.restLength) |
---|
| 1334 | + scale += spring.restLength; |
---|
| 1335 | + count++; |
---|
| 1336 | + } |
---|
| 1337 | + gl.glEnd(); |
---|
| 1338 | + |
---|
| 1339 | + if (count == 0) |
---|
| 1340 | + scale = 0.01; |
---|
| 1341 | + else |
---|
| 1342 | + scale /= count * 3; |
---|
| 1343 | + |
---|
| 1344 | + //scale = 0.25; |
---|
| 1345 | + |
---|
| 1346 | + if (mesh.ShowInfo()) |
---|
| 1347 | + { |
---|
| 1348 | + gl.glLineWidth(4); |
---|
| 1349 | + for (int s=0; s<Phys.allNodes.size(); s++) |
---|
| 1350 | + { |
---|
| 1351 | + cSpring.DynamicNode node = Phys.allNodes.get(s); |
---|
| 1352 | + if (node.mass == 0) |
---|
| 1353 | + continue; |
---|
| 1354 | + |
---|
| 1355 | + int i = node.springs==null?-1:node.springs.size(); |
---|
| 1356 | + gl.glColor3f((i>>2)&1,(i>>1)&1,i&1); |
---|
| 1357 | + //temp.set(node.springForce.x, node.springForce.y, node.springForce.z); |
---|
| 1358 | + //temp.normalize(); |
---|
| 1359 | + //gl.glColor3d((temp.x+1)/2, (temp.y+1)/2, (temp.z+1)/2); |
---|
| 1360 | + gl.glBegin(gl.GL_LINES); |
---|
| 1361 | + gl.glVertex3d(node.position.x, node.position.y, node.position.z); |
---|
| 1362 | + //gl.glVertex3d(node.position.x + node.normal.x*scale, node.position.y + node.normal.y*scale, node.position.z + node.normal.z*scale); |
---|
| 1363 | + gl.glVertex3d(node.position.x + mesh.bRep.GetVertex(s).norm.x*scale, |
---|
| 1364 | + node.position.y + mesh.bRep.GetVertex(s).norm.y*scale, |
---|
| 1365 | + node.position.z + mesh.bRep.GetVertex(s).norm.z*scale); |
---|
| 1366 | + gl.glEnd(); |
---|
| 1367 | + } |
---|
| 1368 | + |
---|
| 1369 | + gl.glLineWidth(8); |
---|
| 1370 | + for (int s=0; s<Phys.allNodes.size(); s++) |
---|
| 1371 | + { |
---|
| 1372 | + cSpring.DynamicNode node = Phys.allNodes.get(s); |
---|
| 1373 | + |
---|
| 1374 | + if (node.springs != null) |
---|
| 1375 | + { |
---|
| 1376 | + for (int i=0; i<node.springs.size(); i+=1) |
---|
| 1377 | + { |
---|
| 1378 | + cSpring.DynamicNode f = node.springs.get(i).GetOther(node); |
---|
| 1379 | + |
---|
| 1380 | + int c = i+1; |
---|
| 1381 | + // c = node.springs.get(i).nbcopies; |
---|
| 1382 | + |
---|
| 1383 | + gl.glColor3f((c>>2)&1,(c>>1)&1,c&1); |
---|
| 1384 | + gl.glBegin(gl.GL_LINES); |
---|
| 1385 | + gl.glVertex3d(node.position.x, node.position.y, node.position.z); |
---|
| 1386 | + 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); |
---|
| 1387 | + gl.glEnd(); |
---|
| 1388 | + } |
---|
| 1389 | + } |
---|
| 1390 | + } |
---|
| 1391 | + |
---|
| 1392 | + gl.glLineWidth(1); |
---|
| 1393 | + } |
---|
| 1394 | + |
---|
| 1395 | + gl.glEnable(gl.GL_LIGHTING); |
---|
| 1396 | + } |
---|
| 1397 | + |
---|
763 | 1398 | /// INTERFACE |
---|
| 1399 | + |
---|
| 1400 | + public void StartTriangles() |
---|
| 1401 | + { |
---|
| 1402 | + javax.media.opengl.GL gl = GetGL(); |
---|
| 1403 | + gl.glBegin(gl.GL_TRIANGLES); |
---|
| 1404 | + } |
---|
| 1405 | + |
---|
| 1406 | + public void EndTriangles() |
---|
| 1407 | + { |
---|
| 1408 | + GetGL().glEnd(); |
---|
| 1409 | + } |
---|
| 1410 | + |
---|
| 1411 | + void drawVertex(javax.media.opengl.GL gl, Vertex pv, boolean flipV, boolean selectmode) |
---|
| 1412 | + { |
---|
| 1413 | + if (!selectmode) |
---|
| 1414 | + { |
---|
| 1415 | + gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z); |
---|
| 1416 | + gl.glColor4f(pv.AO, pv.AO, pv.AO, 1); |
---|
| 1417 | + |
---|
| 1418 | + if (flipV) |
---|
| 1419 | + gl.glTexCoord2f((float) pv.s, 1-(float) pv.t); |
---|
| 1420 | + else |
---|
| 1421 | + gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
| 1422 | + } |
---|
| 1423 | + |
---|
| 1424 | + gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z); |
---|
| 1425 | + } |
---|
764 | 1426 | |
---|
765 | 1427 | void SetColor(Object3D obj, Vertex p0) |
---|
766 | 1428 | { |
---|
.. | .. |
---|
955 | 1617 | //col.getColorComponents(ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB), CameraPane.modelParams0); |
---|
956 | 1618 | if (!material.multiply) |
---|
957 | 1619 | { |
---|
958 | | - display.color = color; |
---|
| 1620 | + display.color = material.color; |
---|
959 | 1621 | display.saturation = material.modulation; |
---|
960 | 1622 | } |
---|
961 | 1623 | else |
---|
962 | 1624 | { |
---|
963 | | - display.color *= color*2; |
---|
| 1625 | + display.color *= material.color*2; |
---|
964 | 1626 | display.saturation *= material.modulation*2; |
---|
965 | 1627 | } |
---|
966 | 1628 | |
---|
967 | 1629 | cColor.HSBtoRGB(display.color, display.saturation, 1, display.modelParams0); |
---|
968 | 1630 | |
---|
969 | | - float[] colorV = GrafreeD.colorV; |
---|
| 1631 | + float[] colorV = Grafreed.colorV; |
---|
970 | 1632 | |
---|
971 | 1633 | /**/ |
---|
972 | 1634 | if (display.DrawMode() == display.DEFAULT) // && display.RENDERPROGRAM == 0) |
---|
.. | .. |
---|
1323 | 1985 | |
---|
1324 | 1986 | static int camerachangeframe; |
---|
1325 | 1987 | |
---|
1326 | | - boolean SetCamera(Camera cam) |
---|
| 1988 | + public boolean SetCamera(Camera cam) |
---|
1327 | 1989 | { |
---|
1328 | 1990 | // may 2014 if (cam == cameras[0] || cam == cameras[1]) |
---|
1329 | 1991 | // return false; |
---|
.. | .. |
---|
1451 | 2113 | mainDL ^= true; |
---|
1452 | 2114 | } |
---|
1453 | 2115 | |
---|
1454 | | - void ToggleTexture() |
---|
1455 | | - { |
---|
1456 | | - textureon ^= true; |
---|
1457 | | - } |
---|
1458 | | - |
---|
1459 | | - void ToggleLive() |
---|
1460 | | - { |
---|
1461 | | - Globals.setLIVE(Globals.isLIVE() ^ true); |
---|
1462 | | - |
---|
1463 | | - System.err.println("LIVE = " + Globals.isLIVE()); |
---|
1464 | | - |
---|
1465 | | - if (!Globals.isLIVE()) // save sound |
---|
1466 | | - GrafreeD.savesound = true; // wav.save(); |
---|
1467 | | - // else |
---|
1468 | | - repaint(); // start loop // may 2013 |
---|
1469 | | - } |
---|
1470 | | - |
---|
1471 | | - void ToggleSupport() |
---|
1472 | | - { |
---|
1473 | | - SUPPORT ^= true; |
---|
1474 | | - } |
---|
1475 | | - |
---|
1476 | | - void ToggleAbort() |
---|
1477 | | - { |
---|
1478 | | - ABORTMODE ^= true; |
---|
1479 | | - } |
---|
1480 | | - |
---|
1481 | 2116 | void ToggleFullScreen() |
---|
1482 | 2117 | { |
---|
1483 | 2118 | FULLSCREEN ^= true; |
---|
.. | .. |
---|
1488 | 2123 | Globals.CROWD ^= true; |
---|
1489 | 2124 | } |
---|
1490 | 2125 | |
---|
1491 | | - void ToggleInertia() |
---|
1492 | | - { |
---|
1493 | | - INERTIA ^= true; |
---|
1494 | | - } |
---|
1495 | | - |
---|
1496 | 2126 | void ToggleLocal() |
---|
1497 | 2127 | { |
---|
1498 | 2128 | LOCALTRANSFORM ^= true; |
---|
1499 | 2129 | } |
---|
1500 | 2130 | |
---|
1501 | | - void ToggleFast() |
---|
| 2131 | + public void ToggleTexture() |
---|
| 2132 | + { |
---|
| 2133 | + textureon ^= true; |
---|
| 2134 | + } |
---|
| 2135 | + |
---|
| 2136 | + public void ToggleLive() |
---|
| 2137 | + { |
---|
| 2138 | + Globals.setLIVE(Globals.isLIVE() ^ true); |
---|
| 2139 | + |
---|
| 2140 | + System.err.println("LIVE = " + Globals.isLIVE()); |
---|
| 2141 | + |
---|
| 2142 | + if (!Globals.isLIVE()) // save sound |
---|
| 2143 | + Grafreed.savesound = true; // wav.save(); |
---|
| 2144 | + // else |
---|
| 2145 | + repaint(); // start loop // may 2013 |
---|
| 2146 | + } |
---|
| 2147 | + |
---|
| 2148 | + public void ToggleSupport() |
---|
| 2149 | + { |
---|
| 2150 | + SUPPORT ^= true; |
---|
| 2151 | + } |
---|
| 2152 | + |
---|
| 2153 | + public void ToggleAbort() |
---|
| 2154 | + { |
---|
| 2155 | + ABORTMODE ^= true; |
---|
| 2156 | + } |
---|
| 2157 | + |
---|
| 2158 | + public void ToggleInertia() |
---|
| 2159 | + { |
---|
| 2160 | + INERTIA ^= true; |
---|
| 2161 | + } |
---|
| 2162 | + |
---|
| 2163 | + public void ToggleFast() |
---|
1502 | 2164 | { |
---|
1503 | 2165 | FAST ^= true; |
---|
1504 | 2166 | } |
---|
1505 | 2167 | |
---|
1506 | | - void ToggleSlowPose() |
---|
| 2168 | + public void ToggleSlowPose() |
---|
1507 | 2169 | { |
---|
1508 | 2170 | SLOWPOSE ^= true; |
---|
1509 | 2171 | } |
---|
1510 | 2172 | |
---|
1511 | | - void ToggleFootContact() |
---|
1512 | | - { |
---|
1513 | | - FOOTCONTACT ^= true; |
---|
1514 | | - } |
---|
1515 | | - |
---|
1516 | | - void ToggleBoxMode() |
---|
| 2173 | + public void ToggleBoxMode() |
---|
1517 | 2174 | { |
---|
1518 | 2175 | BOXMODE ^= true; |
---|
1519 | 2176 | } |
---|
1520 | 2177 | |
---|
1521 | | - void ToggleSmoothFocus() |
---|
| 2178 | + public void ToggleZoomBoxMode() |
---|
| 2179 | + { |
---|
| 2180 | + ZOOMBOXMODE ^= true; |
---|
| 2181 | + } |
---|
| 2182 | + |
---|
| 2183 | + public void ToggleSmoothFocus() |
---|
1522 | 2184 | { |
---|
1523 | 2185 | SMOOTHFOCUS ^= true; |
---|
1524 | 2186 | } |
---|
1525 | 2187 | |
---|
1526 | | - void ToggleImageFlip() |
---|
| 2188 | + public void ToggleImageFlip() |
---|
1527 | 2189 | { |
---|
1528 | 2190 | IMAGEFLIP ^= true; |
---|
1529 | 2191 | } |
---|
1530 | 2192 | |
---|
1531 | | - void ToggleSpeakerMocap() |
---|
| 2193 | + public void ToggleSpeakerMocap() |
---|
1532 | 2194 | { |
---|
1533 | 2195 | SPEAKERMOCAP ^= true; |
---|
1534 | 2196 | } |
---|
1535 | 2197 | |
---|
1536 | | - void ToggleSpeakerCamera() |
---|
| 2198 | + public void ToggleSpeakerCamera() |
---|
1537 | 2199 | { |
---|
1538 | 2200 | SPEAKERCAMERA ^= true; |
---|
1539 | 2201 | } |
---|
1540 | 2202 | |
---|
1541 | | - void ToggleSpeakerFocus() |
---|
| 2203 | + public void ToggleSpeakerFocus() |
---|
1542 | 2204 | { |
---|
1543 | 2205 | SPEAKERFOCUS ^= true; |
---|
1544 | 2206 | } |
---|
1545 | 2207 | |
---|
1546 | | - void ToggleDebug() |
---|
1547 | | - { |
---|
1548 | | - DEBUG ^= true; |
---|
1549 | | - } |
---|
1550 | | - |
---|
1551 | | - void ToggleFrustum() |
---|
| 2208 | + public void ToggleFrustum() |
---|
1552 | 2209 | { |
---|
1553 | 2210 | FRUSTUM ^= true; |
---|
1554 | 2211 | } |
---|
1555 | 2212 | |
---|
1556 | | - void ToggleTrack() |
---|
| 2213 | + public void ToggleTrack() |
---|
1557 | 2214 | { |
---|
1558 | 2215 | TRACK ^= true; |
---|
1559 | 2216 | if (TRACK) |
---|
.. | .. |
---|
1572 | 2229 | repaint(); |
---|
1573 | 2230 | } |
---|
1574 | 2231 | |
---|
1575 | | - void ToggleTrackOnce() |
---|
| 2232 | + public void ToggleTrackOnce() |
---|
1576 | 2233 | { |
---|
1577 | 2234 | TRACKONCE ^= true; |
---|
1578 | 2235 | } |
---|
1579 | 2236 | |
---|
1580 | | - void ToggleShadowTrack() |
---|
| 2237 | + public void ToggleShadowTrack() |
---|
1581 | 2238 | { |
---|
1582 | 2239 | SHADOWTRACK ^= true; |
---|
1583 | 2240 | repaint(); |
---|
1584 | 2241 | } |
---|
1585 | 2242 | |
---|
1586 | | - void ToggleOeil() |
---|
| 2243 | + public void ToggleOeil() |
---|
1587 | 2244 | { |
---|
1588 | 2245 | OEIL ^= true; |
---|
1589 | 2246 | } |
---|
1590 | 2247 | |
---|
1591 | | - void ToggleOeilOnce() |
---|
| 2248 | + public void ToggleOeilOnce() |
---|
1592 | 2249 | { |
---|
1593 | 2250 | OEILONCE ^= true; |
---|
| 2251 | + } |
---|
| 2252 | + |
---|
| 2253 | + void ToggleFootContact() |
---|
| 2254 | + { |
---|
| 2255 | + FOOTCONTACT ^= true; |
---|
| 2256 | + } |
---|
| 2257 | + |
---|
| 2258 | + void ToggleDebug() |
---|
| 2259 | + { |
---|
| 2260 | + DEBUG ^= true; |
---|
1594 | 2261 | } |
---|
1595 | 2262 | |
---|
1596 | 2263 | void ToggleLookAt() |
---|
.. | .. |
---|
1600 | 2267 | |
---|
1601 | 2268 | void ToggleRandom() |
---|
1602 | 2269 | { |
---|
1603 | | - RANDOM ^= true; |
---|
| 2270 | + SWITCH ^= true; |
---|
1604 | 2271 | } |
---|
1605 | 2272 | |
---|
1606 | 2273 | void ToggleHandles() |
---|
.. | .. |
---|
3539 | 4206 | |
---|
3540 | 4207 | com.sun.opengl.util.texture.Texture CompressTexture2(String name) |
---|
3541 | 4208 | { |
---|
| 4209 | + new Exception().printStackTrace(); |
---|
3542 | 4210 | System.exit(0); |
---|
3543 | 4211 | com.sun.opengl.util.texture.Texture texture = null; |
---|
3544 | 4212 | |
---|
.. | .. |
---|
7407 | 8075 | { |
---|
7408 | 8076 | String texname = tex; |
---|
7409 | 8077 | |
---|
7410 | | - String[] split = tex.split("Textures"); |
---|
7411 | | - if (split.length > 1) |
---|
7412 | | - texname = "/Users/nbriere/Textures" + split[split.length-1]; |
---|
7413 | | - else |
---|
7414 | | - if (!texname.startsWith("/")) |
---|
7415 | | - texname = "/Users/nbriere/Textures/" + texname; |
---|
| 8078 | +// String[] split = tex.split("Textures"); |
---|
| 8079 | +// if (split.length > 1) |
---|
| 8080 | +// texname = "/Users/nbriere/Textures" + split[split.length-1]; |
---|
| 8081 | +// else |
---|
| 8082 | +// if (!texname.startsWith("/")) |
---|
| 8083 | +// texname = "/Users/nbriere/Textures/" + texname; |
---|
| 8084 | + if (!new File(tex).exists()) |
---|
| 8085 | + { |
---|
| 8086 | + texname = javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory() + "/Textures/" + texname; |
---|
| 8087 | + } |
---|
7416 | 8088 | |
---|
7417 | 8089 | if (CACHETEXTURE) |
---|
7418 | 8090 | texture = textures.get(texname); // TEXTURE CACHE |
---|
.. | .. |
---|
7652 | 8324 | return texture!=null?texture.texture:null; |
---|
7653 | 8325 | } |
---|
7654 | 8326 | |
---|
7655 | | - com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution) |
---|
| 8327 | + public com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution) |
---|
7656 | 8328 | { |
---|
7657 | 8329 | CacheTexture texture = GetCacheTexture(tex, bump, resolution); |
---|
7658 | 8330 | |
---|
.. | .. |
---|
8725 | 9397 | //gl.glFlush(); |
---|
8726 | 9398 | gl.glAccum(gl.GL_ACCUM, 1.0f / ACSIZE); |
---|
8727 | 9399 | |
---|
8728 | | - if (ANIMATION && ABORTED) |
---|
| 9400 | + if (Globals.ANIMATION && ABORTED) |
---|
8729 | 9401 | { |
---|
8730 | 9402 | System.err.println(" ABORTED FRAME"); |
---|
8731 | 9403 | break; |
---|
.. | .. |
---|
8755 | 9427 | setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); |
---|
8756 | 9428 | |
---|
8757 | 9429 | // save image |
---|
8758 | | - if (ANIMATION && !ABORTED) |
---|
| 9430 | + if (Globals.ANIMATION && !ABORTED) |
---|
8759 | 9431 | { |
---|
8760 | 9432 | VPwidth = viewport[2]; |
---|
8761 | 9433 | VPheight = viewport[3]; |
---|
.. | .. |
---|
8866 | 9538 | |
---|
8867 | 9539 | // imagecount++; |
---|
8868 | 9540 | |
---|
8869 | | - String fullname = filename + (i%100000)/10000 + "" + (i%10000)/1000 + "" + (i%1000)/100 + "" + (i%100)/10 + "" + (i%10) + "." + ext; |
---|
| 9541 | + String fullname = Globals.filename + (i%100000)/10000 + "" + (i%10000)/1000 + "" + (i%1000)/100 + "" + (i%100)/10 + "" + (i%10) + "." + ext; |
---|
8870 | 9542 | |
---|
8871 | 9543 | if (!BOXMODE) |
---|
8872 | 9544 | { |
---|
8873 | | - System.out.println("image: " + fullname + " (wav cursor=" + (GrafreeD.wav.cursor / 735 / 4) + ")"); |
---|
| 9545 | + System.out.println("image: " + fullname + " (wav cursor=" + (Grafreed.wav.cursor / 735 / 4) + ")"); |
---|
8874 | 9546 | } |
---|
8875 | 9547 | |
---|
8876 | 9548 | if (!BOXMODE) |
---|
.. | .. |
---|
8908 | 9580 | ABORTED = false; |
---|
8909 | 9581 | } |
---|
8910 | 9582 | else |
---|
8911 | | - GrafreeD.wav.cursor += 735 * ACSIZE; |
---|
| 9583 | + Grafreed.wav.cursor += 735 * ACSIZE; |
---|
8912 | 9584 | |
---|
8913 | 9585 | if (false) |
---|
8914 | 9586 | { |
---|
.. | .. |
---|
9571 | 10243 | |
---|
9572 | 10244 | public void display(GLAutoDrawable drawable) |
---|
9573 | 10245 | { |
---|
9574 | | - if (GrafreeD.savesound && GrafreeD.hassound) |
---|
| 10246 | + if (Grafreed.savesound && Grafreed.hassound) |
---|
9575 | 10247 | { |
---|
9576 | | - GrafreeD.wav.save(); |
---|
9577 | | - GrafreeD.savesound = false; |
---|
9578 | | - GrafreeD.hassound = false; |
---|
| 10248 | + Grafreed.wav.save(); |
---|
| 10249 | + Grafreed.savesound = false; |
---|
| 10250 | + Grafreed.hassound = false; |
---|
9579 | 10251 | } |
---|
9580 | 10252 | // if (DEBUG_SELECTION) |
---|
9581 | 10253 | // { |
---|
.. | .. |
---|
9705 | 10377 | Object3D theobject = object; |
---|
9706 | 10378 | Object3D theparent = object.parent; |
---|
9707 | 10379 | object.parent = null; |
---|
9708 | | - object = (Object3D)GrafreeD.clone(object); |
---|
| 10380 | + object = (Object3D)Grafreed.clone(object); |
---|
9709 | 10381 | object.Stripify(); |
---|
9710 | 10382 | if (theobject.selection == null || theobject.selection.Size() == 0) |
---|
9711 | 10383 | theobject.PreprocessOcclusion(this); |
---|
.. | .. |
---|
10340 | 11012 | fragmentMode |= (lightslot - 64) << 2; // 1; // first bit is available for aniso |
---|
10341 | 11013 | //System.out.println("fragmentMode = " + fragmentMode); |
---|
10342 | 11014 | |
---|
10343 | | - if (DrawMode() == DEFAULT || DrawMode() == SELECTION || DEBUG_SELECTION) |
---|
| 11015 | + if (DrawMode() == DEFAULT || DrawMode() == SELECTION || IsDebugSelection()) |
---|
10344 | 11016 | { |
---|
10345 | 11017 | /* |
---|
10346 | 11018 | if (CULLFACE || (ambientOcclusion && OCCLUSION_CULLING)) |
---|
.. | .. |
---|
10590 | 11262 | { |
---|
10591 | 11263 | renderpass++; |
---|
10592 | 11264 | // System.out.println("Draw object... "); |
---|
| 11265 | + STEP = 1; |
---|
10593 | 11266 | if (FAST) // in case there is no script |
---|
10594 | | - STEP = 16; |
---|
| 11267 | + STEP = 8; |
---|
| 11268 | + |
---|
| 11269 | + if (CURRENTANTIALIAS == 0 || ACSIZE == 1) |
---|
| 11270 | + { |
---|
| 11271 | + STEP *= 4; |
---|
| 11272 | + } |
---|
10595 | 11273 | |
---|
10596 | 11274 | //object.FullInvariants(); |
---|
10597 | 11275 | |
---|
.. | .. |
---|
10605 | 11283 | e.printStackTrace(); |
---|
10606 | 11284 | } |
---|
10607 | 11285 | |
---|
10608 | | - if (GrafreeD.RENDERME > 0) |
---|
10609 | | - GrafreeD.RENDERME--; // mechante magouille |
---|
| 11286 | + if (Grafreed.RENDERME > 0) |
---|
| 11287 | + Grafreed.RENDERME--; // mechante magouille |
---|
10610 | 11288 | |
---|
10611 | 11289 | Globals.ONESTEP = false; |
---|
10612 | 11290 | } |
---|
.. | .. |
---|
10641 | 11319 | callist = gl.glGenLists(1); |
---|
10642 | 11320 | } |
---|
10643 | 11321 | |
---|
10644 | | - boolean selectmode = DrawMode() == SELECTION || CameraPane.DEBUG_SELECTION; |
---|
| 11322 | + boolean selectmode = DrawMode() == SELECTION || IsDebugSelection(); |
---|
10645 | 11323 | |
---|
10646 | 11324 | boolean active = !selectmode; // DrawMode() != SELECTION; // mouseDown; |
---|
10647 | 11325 | |
---|
.. | .. |
---|
11929 | 12607 | "MAX ndotl.x, ndotl.x, -ndotl.x;" + |
---|
11930 | 12608 | |
---|
11931 | 12609 | "SUB temp.x, one.x, ndotl.x;" + |
---|
11932 | | - "ADD temp.x, temp.x, options2.z;" + // lightsheen |
---|
11933 | | - "ADD temp.y, one.y, options2.y;" + // sursurface |
---|
| 12610 | + // Tuning for default skin |
---|
| 12611 | + //"ADD temp.x, temp.x, options2.z;" + // lightsheen |
---|
| 12612 | + "MAD temp.x, options2.z, half.y, temp.x;" + // lightsheen |
---|
| 12613 | + "ADD temp.y, one.y, options2.y;" + // subsurface |
---|
11934 | 12614 | "MUL temp.x, temp.x, temp.y;" + |
---|
11935 | 12615 | |
---|
11936 | 12616 | "MUL saturation, saturation, temp.xxxx;" + |
---|
.. | .. |
---|
12839 | 13519 | public void mousePressed(MouseEvent e) |
---|
12840 | 13520 | { |
---|
12841 | 13521 | //System.out.println("mousePressed: " + e); |
---|
12842 | | - clickStart(e.getX(), e.getY(), e.getModifiersEx()); |
---|
| 13522 | + clickStart(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx()); |
---|
12843 | 13523 | } |
---|
12844 | 13524 | |
---|
12845 | 13525 | static long prevtime = 0; |
---|
.. | .. |
---|
12866 | 13546 | |
---|
12867 | 13547 | //System.err.println("Dtime = " + Dtime + "; units = " + e.getUnitsToScroll() + "; ratio (units/ms) = " + ratio); |
---|
12868 | 13548 | |
---|
| 13549 | + if (BUTTONLESSWHEEL) |
---|
12869 | 13550 | if (Math.abs(ratio) < 0.1 || Math.abs(Dtime) == 0) // < 30) |
---|
12870 | 13551 | { |
---|
12871 | 13552 | return; |
---|
.. | .. |
---|
12874 | 13555 | boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK); |
---|
12875 | 13556 | |
---|
12876 | 13557 | // TIMER |
---|
12877 | | - if (!wheeltimer.isRunning() && e.getModifiersEx() == 0 && !capsLocked) // VR |
---|
| 13558 | + if (ZOOMBOXMODE && !wheeltimer.isRunning() && e.getModifiersEx() == 0 && !capsLocked) // VR |
---|
12878 | 13559 | { |
---|
12879 | 13560 | keepboxmode = BOXMODE; |
---|
12880 | 13561 | keepsupport = SUPPORT; |
---|
.. | .. |
---|
12914 | 13595 | // mode |= META; |
---|
12915 | 13596 | //} |
---|
12916 | 13597 | |
---|
12917 | | - SetMouseMode(WHEEL | e.getModifiersEx()); |
---|
12918 | | - drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0); |
---|
| 13598 | + SetMouseMode(e.getModifiers(), WHEEL | e.getModifiersEx()); |
---|
| 13599 | + drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0, 0); |
---|
12919 | 13600 | anchorX = ax; |
---|
12920 | 13601 | anchorY = ay; |
---|
12921 | 13602 | prevX = px; |
---|
.. | .. |
---|
12975 | 13656 | // wasliveok = true; |
---|
12976 | 13657 | // waslive = false; |
---|
12977 | 13658 | |
---|
| 13659 | + // May 2019 Forget it: |
---|
| 13660 | + if (true) |
---|
| 13661 | + return; |
---|
| 13662 | + |
---|
12978 | 13663 | // source == timer |
---|
12979 | 13664 | if (mouseDown) |
---|
12980 | 13665 | { |
---|
.. | .. |
---|
13013 | 13698 | |
---|
13014 | 13699 | javax.swing.Timer timer = new javax.swing.Timer(350, this); |
---|
13015 | 13700 | |
---|
13016 | | - void clickStart(int x, int y, int modifiers) |
---|
| 13701 | + void clickStart(int x, int y, int modifiers, int modifiersex) |
---|
13017 | 13702 | { |
---|
13018 | 13703 | if (!wasliveok) |
---|
13019 | 13704 | return; |
---|
.. | .. |
---|
13030 | 13715 | // touched = true; // main DL |
---|
13031 | 13716 | if (isRenderer) |
---|
13032 | 13717 | { |
---|
13033 | | - SetMouseMode(modifiers); |
---|
| 13718 | + SetMouseMode(modifiers, modifiersex); |
---|
13034 | 13719 | } |
---|
13035 | 13720 | |
---|
13036 | 13721 | selectX = anchorX = x; |
---|
.. | .. |
---|
13043 | 13728 | clicked = true; |
---|
13044 | 13729 | hold = false; |
---|
13045 | 13730 | |
---|
13046 | | - if (((modifiers & ~1024) & ~0) == 0) // Single or multiple selection |
---|
| 13731 | + if (((modifiersex & ~1024) & ~0) == 0) // Single or multiple selection |
---|
13047 | 13732 | // june 2013 means CTRL_CLICK: if (((modifiers & ~1024) & ~128) == 0) // Single or multiple selection |
---|
13048 | 13733 | { |
---|
13049 | 13734 | // System.out.println("RESTART II " + modifiers); |
---|
.. | .. |
---|
13074 | 13759 | info.camera = renderCamera; |
---|
13075 | 13760 | info.x = x; |
---|
13076 | 13761 | info.y = y; |
---|
13077 | | - info.modifiers = modifiers; |
---|
| 13762 | + info.modifiers = modifiersex; |
---|
13078 | 13763 | editObj = object.doEditClick(info, 0); |
---|
13079 | 13764 | if (!editObj) |
---|
13080 | 13765 | { |
---|
.. | .. |
---|
13091 | 13776 | |
---|
13092 | 13777 | public void mouseDragged(MouseEvent e) |
---|
13093 | 13778 | { |
---|
| 13779 | + //System.out.println("mouseDragged: " + e); |
---|
13094 | 13780 | if (isRenderer) |
---|
13095 | 13781 | movingcamera = true; |
---|
13096 | 13782 | //if (drawing) |
---|
13097 | 13783 | //return; |
---|
13098 | | - //System.out.println("mouseDragged: " + e); |
---|
13099 | 13784 | if ((e.getModifiersEx() & CTRL) != 0 |
---|
13100 | 13785 | || (e.getModifiersEx() & COMMAND) != 0) // || IsFrozen()) |
---|
13101 | 13786 | { |
---|
.. | .. |
---|
13103 | 13788 | clickEnd(e.getX(), e.getY(), e.getModifiersEx()); |
---|
13104 | 13789 | } |
---|
13105 | 13790 | else |
---|
13106 | | - drag(e.getX(), e.getY(), e.getModifiersEx()); |
---|
| 13791 | + drag(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx()); |
---|
13107 | 13792 | |
---|
13108 | 13793 | //try { Thread.sleep(1); } catch (Exception ex) {} |
---|
13109 | 13794 | } |
---|
.. | .. |
---|
13115 | 13800 | cVector tmp = new cVector(); |
---|
13116 | 13801 | cVector tmp2 = new cVector(); |
---|
13117 | 13802 | boolean isMoving; |
---|
| 13803 | + |
---|
| 13804 | + public cVector TargetLookAt() |
---|
| 13805 | + { |
---|
| 13806 | + return targetLookAt; |
---|
| 13807 | + } |
---|
13118 | 13808 | |
---|
13119 | 13809 | class PingThread extends Thread |
---|
13120 | 13810 | { |
---|
.. | .. |
---|
13271 | 13961 | |
---|
13272 | 13962 | public void run() |
---|
13273 | 13963 | { |
---|
| 13964 | + new Exception().printStackTrace(); |
---|
13274 | 13965 | System.exit(0); |
---|
13275 | 13966 | for (;;) |
---|
13276 | 13967 | { |
---|
.. | .. |
---|
13334 | 14025 | { |
---|
13335 | 14026 | Globals.lighttouched = true; |
---|
13336 | 14027 | } |
---|
13337 | | - drag(X, (mouseMode != 0) ? Y : anchorY, MODIFIERS); |
---|
| 14028 | + drag(X, (mouseMode != 0) ? Y : anchorY, 0, MODIFIERS); |
---|
13338 | 14029 | } |
---|
13339 | 14030 | //else |
---|
13340 | 14031 | } |
---|
.. | .. |
---|
13434 | 14125 | int X, Y; |
---|
13435 | 14126 | boolean SX, SY; |
---|
13436 | 14127 | |
---|
13437 | | - void drag(int x, int y, int modifiers) |
---|
| 14128 | + void drag(int x, int y, int modifiers, int modifiersex) |
---|
13438 | 14129 | { |
---|
13439 | 14130 | if (IsFrozen()) |
---|
13440 | 14131 | { |
---|
.. | .. |
---|
13443 | 14134 | |
---|
13444 | 14135 | drag = true; // NEW |
---|
13445 | 14136 | |
---|
13446 | | - boolean continuous = (modifiers & COMMAND) == COMMAND; |
---|
| 14137 | + boolean continuous = (modifiersex & COMMAND) == COMMAND; |
---|
13447 | 14138 | |
---|
13448 | 14139 | X = x; |
---|
13449 | 14140 | Y = y; |
---|
13450 | 14141 | // floating state for animation |
---|
13451 | | - MODIFIERS = modifiers; |
---|
13452 | | - modifiers &= ~1024; |
---|
| 14142 | + MODIFIERS = modifiersex; |
---|
| 14143 | + modifiersex &= ~1024; |
---|
13453 | 14144 | if (false) // modifiers != 0) |
---|
13454 | 14145 | { |
---|
13455 | 14146 | //new Exception().printStackTrace(); |
---|
13456 | | - System.out.println("mouseDragged: " + modifiers); |
---|
| 14147 | + System.out.println("mouseDragged: " + modifiersex); |
---|
13457 | 14148 | System.out.println("SHIFT = " + SHIFT); |
---|
13458 | 14149 | System.out.println("CONTROL = " + COMMAND); |
---|
13459 | 14150 | System.out.println("META = " + META); |
---|
.. | .. |
---|
13473 | 14164 | info.camera = renderCamera; |
---|
13474 | 14165 | info.x = x; |
---|
13475 | 14166 | info.y = y; |
---|
13476 | | - object.editWindow.copy.doEditDrag(info); |
---|
| 14167 | + object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0); |
---|
13477 | 14168 | } else |
---|
13478 | 14169 | { |
---|
13479 | 14170 | if (x < startX) |
---|
.. | .. |
---|
13625 | 14316 | public void mouseMoved(MouseEvent e) |
---|
13626 | 14317 | { |
---|
13627 | 14318 | //System.out.println("mouseMoved: " + e); |
---|
13628 | | - |
---|
13629 | 14319 | if (isRenderer) |
---|
13630 | 14320 | return; |
---|
13631 | 14321 | |
---|
.. | .. |
---|
13673 | 14363 | boolean control = ((modifiers & CTRL) != 0); // june 2013: for point selection |
---|
13674 | 14364 | boolean command = ((modifiers & COMMAND) != 0); // june 2013: for multiple selection |
---|
13675 | 14365 | |
---|
13676 | | - if (control || command || IsFrozen()) |
---|
| 14366 | +// No delay if (control || command || IsFrozen()) |
---|
13677 | 14367 | timeout = true; |
---|
13678 | | - else |
---|
| 14368 | +// ?? May 2019 else |
---|
13679 | 14369 | // timer.setDelay((modifiers & 128) != 0?0:350); |
---|
13680 | 14370 | mouseDown = false; |
---|
13681 | 14371 | if (!control && !command) // june 2013 |
---|
.. | .. |
---|
13785 | 14475 | System.out.println("keyReleased: " + e); |
---|
13786 | 14476 | } |
---|
13787 | 14477 | |
---|
13788 | | - void SetMouseMode(int modifiers) |
---|
| 14478 | + void SetMouseMode(int modifiers, int modifiersex) |
---|
13789 | 14479 | { |
---|
13790 | 14480 | //System.out.println("SetMouseMode = " + modifiers); |
---|
13791 | 14481 | //modifiers &= ~1024; |
---|
.. | .. |
---|
13797 | 14487 | //if (modifiers == 0) // || (modifiers == (1024 | CONTROL))) |
---|
13798 | 14488 | // return; |
---|
13799 | 14489 | //System.out.println("SetMode = " + modifiers); |
---|
13800 | | - if ((modifiers & WHEEL) == WHEEL) |
---|
| 14490 | + if ((modifiersex & WHEEL) == WHEEL) |
---|
13801 | 14491 | { |
---|
13802 | 14492 | mouseMode |= ZOOM; |
---|
13803 | 14493 | } |
---|
13804 | 14494 | |
---|
13805 | 14495 | boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK); |
---|
13806 | | - if (capsLocked || (modifiers & META) == META) |
---|
| 14496 | + if (capsLocked) // || (modifiers & META) == META) |
---|
13807 | 14497 | { |
---|
13808 | 14498 | mouseMode |= VR; // BACKFORTH; |
---|
13809 | 14499 | } |
---|
13810 | | - if ((modifiers & CTRLCLICK) == CTRLCLICK) |
---|
| 14500 | + if ((modifiersex & CTRLCLICK) == CTRLCLICK) |
---|
13811 | 14501 | { |
---|
13812 | 14502 | mouseMode |= SELECT; |
---|
13813 | 14503 | } |
---|
13814 | | - if ((modifiers & COMMAND) == COMMAND) |
---|
| 14504 | + if ((modifiersex & COMMAND) == COMMAND) |
---|
13815 | 14505 | { |
---|
13816 | 14506 | mouseMode |= SELECT; |
---|
13817 | 14507 | } |
---|
13818 | | - if ((modifiers & SHIFT) == SHIFT || forcetranslate) |
---|
| 14508 | + if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0) |
---|
13819 | 14509 | { |
---|
13820 | 14510 | mouseMode &= ~VR; |
---|
13821 | 14511 | mouseMode |= TRANSLATE; |
---|
.. | .. |
---|
13844 | 14534 | |
---|
13845 | 14535 | if (isRenderer) // |
---|
13846 | 14536 | { |
---|
13847 | | - SetMouseMode(modifiers); |
---|
| 14537 | + SetMouseMode(0, modifiers); |
---|
13848 | 14538 | } |
---|
13849 | 14539 | |
---|
13850 | | - theRenderer.keyPressed(key); |
---|
| 14540 | + Globals.theRenderer.keyPressed(key); |
---|
13851 | 14541 | } |
---|
13852 | 14542 | |
---|
13853 | 14543 | int kompactbit = 4; // power bit |
---|
.. | .. |
---|
13859 | 14549 | float SATPOW = 1; // 2; // 0.5f; |
---|
13860 | 14550 | float BRIPOW = 1; // 0.5f; // 0.5f; |
---|
13861 | 14551 | |
---|
13862 | | - void keyPressed(int key) |
---|
| 14552 | + public void keyPressed(int key) |
---|
13863 | 14553 | { |
---|
13864 | 14554 | if (key >= '0' && key <= '5') |
---|
13865 | 14555 | clampbit = (key-'0'); |
---|
.. | .. |
---|
14296 | 14986 | } |
---|
14297 | 14987 | //System.out.println("shaper_fovy = " + manipCamera.shaper_fovy); |
---|
14298 | 14988 | } |
---|
| 14989 | + |
---|
14299 | 14990 | static double OCCLUSIONBOOST = 1; // 0.5; |
---|
14300 | 14991 | |
---|
14301 | 14992 | void keyReleased(int key, int modifiers) |
---|
.. | .. |
---|
14303 | 14994 | //mode = ROTATE; |
---|
14304 | 14995 | if ((MODIFIERS & COMMAND) == 0) // VR?? |
---|
14305 | 14996 | { |
---|
14306 | | - SetMouseMode(modifiers); |
---|
| 14997 | + SetMouseMode(0, modifiers); |
---|
14307 | 14998 | } |
---|
14308 | 14999 | } |
---|
14309 | 15000 | |
---|
14310 | | - protected void processKeyEvent(KeyEvent e) |
---|
| 15001 | + public void processKeyEvent(KeyEvent e) |
---|
14311 | 15002 | { |
---|
14312 | 15003 | switch (e.getID()) |
---|
14313 | 15004 | { |
---|
.. | .. |
---|
14437 | 15128 | |
---|
14438 | 15129 | protected void processMouseMotionEvent(MouseEvent e) |
---|
14439 | 15130 | { |
---|
14440 | | - //System.out.println("processMouseMotionEvent: " + mouseMode); |
---|
14441 | | - if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0) |
---|
| 15131 | + //System.out.println("processMouseMotionEvent: " + mouseMode + " " + e.getModifiers() + " " + e.getModifiersEx() + " " + e.getButton()); |
---|
| 15132 | + //if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0) |
---|
| 15133 | + if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) == 0 && (e.getModifiers() & MouseEvent.BUTTON3_MASK) == 0 && (mouseMode & SELECT) == 0) |
---|
14442 | 15134 | { |
---|
14443 | 15135 | mouseMoved(e); |
---|
14444 | 15136 | } else |
---|
.. | .. |
---|
14468 | 15160 | |
---|
14469 | 15161 | void SelectParent() |
---|
14470 | 15162 | { |
---|
| 15163 | + new Exception().printStackTrace(); |
---|
14471 | 15164 | System.exit(0); |
---|
14472 | 15165 | Composite group = (Composite) object; |
---|
14473 | 15166 | java.util.Vector selectees = new java.util.Vector(group.selection); |
---|
.. | .. |
---|
14491 | 15184 | |
---|
14492 | 15185 | void SelectChildren() |
---|
14493 | 15186 | { |
---|
| 15187 | + new Exception().printStackTrace(); |
---|
14494 | 15188 | System.exit(0); |
---|
14495 | 15189 | /* |
---|
14496 | 15190 | Composite group = (Composite) object; |
---|
.. | .. |
---|
14873 | 15567 | public boolean mouseDown(Event evt, int x, int y) |
---|
14874 | 15568 | { |
---|
14875 | 15569 | System.out.println("mouseDown: " + evt); |
---|
| 15570 | + System.exit(0); |
---|
14876 | 15571 | /* |
---|
14877 | 15572 | locked = true; |
---|
14878 | 15573 | drag = false; |
---|
.. | .. |
---|
14916 | 15611 | { |
---|
14917 | 15612 | keyPressed(0, modifiers); |
---|
14918 | 15613 | } |
---|
14919 | | - clickStart(x, y, modifiers); |
---|
| 15614 | + // clickStart(x, y, modifiers); |
---|
14920 | 15615 | return true; |
---|
14921 | 15616 | } |
---|
14922 | 15617 | |
---|
.. | .. |
---|
15034 | 15729 | { |
---|
15035 | 15730 | keyReleased(0, 0); |
---|
15036 | 15731 | } |
---|
15037 | | - drag(x, y, modifiers); |
---|
| 15732 | + drag(x, y, 0, modifiers); |
---|
15038 | 15733 | return true; |
---|
15039 | 15734 | } |
---|
15040 | 15735 | |
---|
.. | .. |
---|
15604 | 16299 | { |
---|
15605 | 16300 | if (!selection) |
---|
15606 | 16301 | { |
---|
| 16302 | + new Exception().printStackTrace(); |
---|
15607 | 16303 | System.exit(0); |
---|
15608 | 16304 | return; |
---|
15609 | 16305 | } |
---|
.. | .. |
---|
15731 | 16427 | System.out.println("; fromto " + sel + " " + Trunk(previousselectedpoint.toParent[3][0]) + " " + Trunk(previousselectedpoint.toParent[3][2]) + " " + Trunk(selectedpoint.toParent[3][0]) + " " + Trunk(selectedpoint.toParent[3][2])); |
---|
15732 | 16428 | } |
---|
15733 | 16429 | |
---|
15734 | | - previousselectedpoint = (Sphere) GrafreeD.clone(selectedpoint); |
---|
| 16430 | + previousselectedpoint = (Sphere) Grafreed.clone(selectedpoint); |
---|
15735 | 16431 | } |
---|
15736 | 16432 | } |
---|
15737 | 16433 | |
---|
15738 | 16434 | if (!movingcamera && !PAINTMODE) |
---|
15739 | 16435 | object.editWindow.ScreenFitPoint(); // fev 2014 |
---|
15740 | 16436 | |
---|
15741 | | - if (PAINTMODE && GrafreeD.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0) |
---|
| 16437 | + if (PAINTMODE && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0) |
---|
15742 | 16438 | { |
---|
15743 | | - Object3D paintobj = GrafreeD.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0); |
---|
| 16439 | + Object3D paintobj = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0); |
---|
15744 | 16440 | |
---|
15745 | 16441 | Object3D group = new Object3D("inst" + paintcount++); |
---|
15746 | 16442 | |
---|
.. | .. |
---|
15966 | 16662 | |
---|
15967 | 16663 | class AntialiasBuffer implements GLEventListener |
---|
15968 | 16664 | { |
---|
15969 | | - |
---|
15970 | 16665 | CameraPane parent = null; |
---|
15971 | 16666 | |
---|
15972 | 16667 | AntialiasBuffer(CameraPane p) |
---|
.. | .. |
---|
16359 | 17054 | } |
---|
16360 | 17055 | } |
---|
16361 | 17056 | |
---|
16362 | | - static void DrawPoints(CameraPane cpane) |
---|
| 17057 | + static void DrawPoints(iCameraPane cpane) |
---|
16363 | 17058 | { |
---|
16364 | 17059 | for (int i=0; i<8; i++) // first and last are red |
---|
16365 | 17060 | { |
---|
.. | .. |
---|
16391 | 17086 | static IntBuffer textbuffer = null; // IntBuffer.allocate(TEXT_WIDTH*8*8 * TEXT_HEIGHT); |
---|
16392 | 17087 | // Depth buffer format |
---|
16393 | 17088 | //private int depth_format; |
---|
16394 | | - static public void NextIndex(Object3D o, GL gl) |
---|
| 17089 | + |
---|
| 17090 | + public void NextIndex() |
---|
16395 | 17091 | { |
---|
16396 | 17092 | indexcount+=16; |
---|
16397 | | - gl.glColor3d(((indexcount >>> 16) & 255) / 255.0, ((indexcount >>> 8) & 255) / 255.0, ((indexcount) & 255) / 255.0); |
---|
| 17093 | + GetGL().glColor3d(((indexcount >>> 16) & 255) / 255.0, ((indexcount >>> 8) & 255) / 255.0, ((indexcount) & 255) / 255.0); |
---|
16398 | 17094 | //objects[indexcount] = o; |
---|
16399 | 17095 | //System.out.println("indexcount = " + indexcount); |
---|
16400 | 17096 | } |
---|