.. | .. |
---|
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; |
---|
.. | .. |
---|
150 | 152 | defaultcaps.setAccumAlphaBits(16); |
---|
151 | 153 | } |
---|
152 | 154 | |
---|
153 | | - static CameraPane theRenderer; |
---|
154 | | - |
---|
155 | 155 | void SetAsGLRenderer(boolean b) |
---|
156 | 156 | { |
---|
157 | 157 | isRenderer = b; |
---|
158 | | - theRenderer = this; |
---|
| 158 | + Globals.theRenderer = this; |
---|
159 | 159 | } |
---|
160 | 160 | |
---|
161 | 161 | CameraPane(Object3D o, Camera cam, boolean withcontext) |
---|
.. | .. |
---|
193 | 193 | |
---|
194 | 194 | /// INTERFACE |
---|
195 | 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 | + |
---|
196 | 225 | public boolean IsBoxMode() |
---|
197 | 226 | { |
---|
198 | 227 | return BOXMODE; |
---|
| 228 | + } |
---|
| 229 | + |
---|
| 230 | + public boolean IsZoomBoxMode() |
---|
| 231 | + { |
---|
| 232 | + return ZOOMBOXMODE; |
---|
199 | 233 | } |
---|
200 | 234 | |
---|
201 | 235 | public void ClearDepth() |
---|
.. | .. |
---|
816 | 850 | |
---|
817 | 851 | if ((i % 100) == 0 && i != 0) |
---|
818 | 852 | { |
---|
819 | | - CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR)); |
---|
| 853 | + Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR)); |
---|
820 | 854 | //System.out.println("Color = " + cp.vertexOcclusion.r + ", " + cp.vertexOcclusion.g + ", " + cp.vertexOcclusion.b + "; " + (int)(100.0*i/(positions.length/3)) + "% done"); |
---|
821 | 855 | System.out.println((int) (100.0 * i / (br.positions.length / 3)) + "% (" + i + " of " + (br.positions.length / 3) + ")"); |
---|
822 | 856 | } |
---|
.. | .. |
---|
848 | 882 | |
---|
849 | 883 | if ((i % 100) == 0 && i != 0) |
---|
850 | 884 | { |
---|
851 | | - CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR)); |
---|
| 885 | + Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR)); |
---|
852 | 886 | //System.out.println("Color = " + cp.vertexOcclusion.r + ", " + cp.vertexOcclusion.g + ", " + cp.vertexOcclusion.b + "; " + (int)(100.0*i/(positions.length/3)) + "% done"); |
---|
853 | 887 | System.out.println((int) (100.0 * i / br.VertexCount()) + "% (" + i + " of " + br.VertexCount() + ")"); |
---|
854 | 888 | } |
---|
.. | .. |
---|
1061 | 1095 | gl.glMatrixMode(gl.GL_MODELVIEW); |
---|
1062 | 1096 | } |
---|
1063 | 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 | + |
---|
1064 | 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 | + } |
---|
1065 | 1428 | |
---|
1066 | 1429 | void SetColor(Object3D obj, Vertex p0) |
---|
1067 | 1430 | { |
---|
.. | .. |
---|
1256 | 1619 | //col.getColorComponents(ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB), CameraPane.modelParams0); |
---|
1257 | 1620 | if (!material.multiply) |
---|
1258 | 1621 | { |
---|
1259 | | - display.color = color; |
---|
| 1622 | + display.color = material.color; |
---|
1260 | 1623 | display.saturation = material.modulation; |
---|
1261 | 1624 | } |
---|
1262 | 1625 | else |
---|
1263 | 1626 | { |
---|
1264 | | - display.color *= color*2; |
---|
| 1627 | + display.color *= material.color*2; |
---|
1265 | 1628 | display.saturation *= material.modulation*2; |
---|
1266 | 1629 | } |
---|
1267 | 1630 | |
---|
.. | .. |
---|
1624 | 1987 | |
---|
1625 | 1988 | static int camerachangeframe; |
---|
1626 | 1989 | |
---|
1627 | | - boolean SetCamera(Camera cam) |
---|
| 1990 | + public boolean SetCamera(Camera cam) |
---|
1628 | 1991 | { |
---|
1629 | 1992 | // may 2014 if (cam == cameras[0] || cam == cameras[1]) |
---|
1630 | 1993 | // return false; |
---|
.. | .. |
---|
1752 | 2115 | mainDL ^= true; |
---|
1753 | 2116 | } |
---|
1754 | 2117 | |
---|
1755 | | - 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() |
---|
1756 | 2134 | { |
---|
1757 | 2135 | textureon ^= true; |
---|
1758 | 2136 | } |
---|
1759 | 2137 | |
---|
1760 | | - void ToggleLive() |
---|
| 2138 | + public void ToggleLive() |
---|
1761 | 2139 | { |
---|
1762 | 2140 | Globals.setLIVE(Globals.isLIVE() ^ true); |
---|
1763 | 2141 | |
---|
.. | .. |
---|
1769 | 2147 | repaint(); // start loop // may 2013 |
---|
1770 | 2148 | } |
---|
1771 | 2149 | |
---|
1772 | | - void ToggleSupport() |
---|
| 2150 | + public void ToggleSupport() |
---|
1773 | 2151 | { |
---|
1774 | 2152 | SUPPORT ^= true; |
---|
1775 | 2153 | } |
---|
1776 | 2154 | |
---|
1777 | | - void ToggleAbort() |
---|
| 2155 | + public void ToggleAbort() |
---|
1778 | 2156 | { |
---|
1779 | 2157 | ABORTMODE ^= true; |
---|
1780 | 2158 | } |
---|
1781 | 2159 | |
---|
1782 | | - void ToggleFullScreen() |
---|
1783 | | - { |
---|
1784 | | - FULLSCREEN ^= true; |
---|
1785 | | - } |
---|
1786 | | - |
---|
1787 | | - void ToggleCrowd() |
---|
1788 | | - { |
---|
1789 | | - Globals.CROWD ^= true; |
---|
1790 | | - } |
---|
1791 | | - |
---|
1792 | | - void ToggleInertia() |
---|
| 2160 | + public void ToggleInertia() |
---|
1793 | 2161 | { |
---|
1794 | 2162 | INERTIA ^= true; |
---|
1795 | 2163 | } |
---|
1796 | 2164 | |
---|
1797 | | - void ToggleLocal() |
---|
1798 | | - { |
---|
1799 | | - LOCALTRANSFORM ^= true; |
---|
1800 | | - } |
---|
1801 | | - |
---|
1802 | | - void ToggleFast() |
---|
| 2165 | + public void ToggleFast() |
---|
1803 | 2166 | { |
---|
1804 | 2167 | FAST ^= true; |
---|
1805 | 2168 | } |
---|
1806 | 2169 | |
---|
1807 | | - void ToggleSlowPose() |
---|
| 2170 | + public void ToggleSlowPose() |
---|
1808 | 2171 | { |
---|
1809 | 2172 | SLOWPOSE ^= true; |
---|
1810 | 2173 | } |
---|
1811 | 2174 | |
---|
1812 | | - void ToggleFootContact() |
---|
1813 | | - { |
---|
1814 | | - FOOTCONTACT ^= true; |
---|
1815 | | - } |
---|
1816 | | - |
---|
1817 | | - void ToggleBoxMode() |
---|
| 2175 | + public void ToggleBoxMode() |
---|
1818 | 2176 | { |
---|
1819 | 2177 | BOXMODE ^= true; |
---|
1820 | 2178 | } |
---|
1821 | 2179 | |
---|
1822 | | - void ToggleSmoothFocus() |
---|
| 2180 | + public void ToggleZoomBoxMode() |
---|
| 2181 | + { |
---|
| 2182 | + ZOOMBOXMODE ^= true; |
---|
| 2183 | + } |
---|
| 2184 | + |
---|
| 2185 | + public void ToggleSmoothFocus() |
---|
1823 | 2186 | { |
---|
1824 | 2187 | SMOOTHFOCUS ^= true; |
---|
1825 | 2188 | } |
---|
1826 | 2189 | |
---|
1827 | | - void ToggleImageFlip() |
---|
| 2190 | + public void ToggleImageFlip() |
---|
1828 | 2191 | { |
---|
1829 | 2192 | IMAGEFLIP ^= true; |
---|
1830 | 2193 | } |
---|
1831 | 2194 | |
---|
1832 | | - void ToggleSpeakerMocap() |
---|
| 2195 | + public void ToggleSpeakerMocap() |
---|
1833 | 2196 | { |
---|
1834 | 2197 | SPEAKERMOCAP ^= true; |
---|
1835 | 2198 | } |
---|
1836 | 2199 | |
---|
1837 | | - void ToggleSpeakerCamera() |
---|
| 2200 | + public void ToggleSpeakerCamera() |
---|
1838 | 2201 | { |
---|
1839 | 2202 | SPEAKERCAMERA ^= true; |
---|
1840 | 2203 | } |
---|
1841 | 2204 | |
---|
1842 | | - void ToggleSpeakerFocus() |
---|
| 2205 | + public void ToggleSpeakerFocus() |
---|
1843 | 2206 | { |
---|
1844 | 2207 | SPEAKERFOCUS ^= true; |
---|
1845 | 2208 | } |
---|
1846 | 2209 | |
---|
1847 | | - void ToggleDebug() |
---|
1848 | | - { |
---|
1849 | | - DEBUG ^= true; |
---|
1850 | | - } |
---|
1851 | | - |
---|
1852 | | - void ToggleFrustum() |
---|
| 2210 | + public void ToggleFrustum() |
---|
1853 | 2211 | { |
---|
1854 | 2212 | FRUSTUM ^= true; |
---|
1855 | 2213 | } |
---|
1856 | 2214 | |
---|
1857 | | - void ToggleTrack() |
---|
| 2215 | + public void ToggleTrack() |
---|
1858 | 2216 | { |
---|
1859 | 2217 | TRACK ^= true; |
---|
1860 | 2218 | if (TRACK) |
---|
.. | .. |
---|
1873 | 2231 | repaint(); |
---|
1874 | 2232 | } |
---|
1875 | 2233 | |
---|
1876 | | - void ToggleTrackOnce() |
---|
| 2234 | + public void ToggleTrackOnce() |
---|
1877 | 2235 | { |
---|
1878 | 2236 | TRACKONCE ^= true; |
---|
1879 | 2237 | } |
---|
1880 | 2238 | |
---|
1881 | | - void ToggleShadowTrack() |
---|
| 2239 | + public void ToggleShadowTrack() |
---|
1882 | 2240 | { |
---|
1883 | 2241 | SHADOWTRACK ^= true; |
---|
1884 | 2242 | repaint(); |
---|
1885 | 2243 | } |
---|
1886 | 2244 | |
---|
1887 | | - void ToggleOeil() |
---|
| 2245 | + public void ToggleOeil() |
---|
1888 | 2246 | { |
---|
1889 | 2247 | OEIL ^= true; |
---|
1890 | 2248 | } |
---|
1891 | 2249 | |
---|
1892 | | - void ToggleOeilOnce() |
---|
| 2250 | + public void ToggleOeilOnce() |
---|
1893 | 2251 | { |
---|
1894 | 2252 | OEILONCE ^= true; |
---|
| 2253 | + } |
---|
| 2254 | + |
---|
| 2255 | + void ToggleFootContact() |
---|
| 2256 | + { |
---|
| 2257 | + FOOTCONTACT ^= true; |
---|
| 2258 | + } |
---|
| 2259 | + |
---|
| 2260 | + void ToggleDebug() |
---|
| 2261 | + { |
---|
| 2262 | + DEBUG ^= true; |
---|
1895 | 2263 | } |
---|
1896 | 2264 | |
---|
1897 | 2265 | void ToggleLookAt() |
---|
.. | .. |
---|
3840 | 4208 | |
---|
3841 | 4209 | com.sun.opengl.util.texture.Texture CompressTexture2(String name) |
---|
3842 | 4210 | { |
---|
| 4211 | + new Exception().printStackTrace(); |
---|
3843 | 4212 | System.exit(0); |
---|
3844 | 4213 | com.sun.opengl.util.texture.Texture texture = null; |
---|
3845 | 4214 | |
---|
.. | .. |
---|
7953 | 8322 | return texture!=null?texture.texture:null; |
---|
7954 | 8323 | } |
---|
7955 | 8324 | |
---|
7956 | | - com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution) |
---|
| 8325 | + public com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution) |
---|
7957 | 8326 | { |
---|
7958 | 8327 | CacheTexture texture = GetCacheTexture(tex, bump, resolution); |
---|
7959 | 8328 | |
---|
.. | .. |
---|
12379 | 12748 | "MUL final.y, fragment.texcoord[0].x, c256;" + |
---|
12380 | 12749 | "FLR final.x, final.y;" + |
---|
12381 | 12750 | "SUB final.y, final.y, final.x;" + |
---|
12382 | | - "MUL final.x, final.x, c256i;" + |
---|
| 12751 | + //"MUL final.x, final.x, c256i;" + |
---|
12383 | 12752 | "MOV final.z, zero.x;" + |
---|
12384 | 12753 | "MOV final.a, one.w;":"" |
---|
12385 | 12754 | ) + |
---|
.. | .. |
---|
12387 | 12756 | "MUL final.y, fragment.texcoord[0].y, c256;" + |
---|
12388 | 12757 | "FLR final.x, final.y;" + |
---|
12389 | 12758 | "SUB final.y, final.y, final.x;" + |
---|
12390 | | - "MUL final.x, final.x, c256i;" + |
---|
| 12759 | + //"MUL final.x, final.x, c256i;" + |
---|
12391 | 12760 | "MOV final.z, zero.x;" + |
---|
12392 | 12761 | "MOV final.a, one.w;":"" |
---|
12393 | 12762 | ) + |
---|
.. | .. |
---|
13167 | 13536 | |
---|
13168 | 13537 | //System.err.println("Dtime = " + Dtime + "; units = " + e.getUnitsToScroll() + "; ratio (units/ms) = " + ratio); |
---|
13169 | 13538 | |
---|
| 13539 | + if (BUTTONLESSWHEEL) |
---|
13170 | 13540 | if (Math.abs(ratio) < 0.1 || Math.abs(Dtime) == 0) // < 30) |
---|
13171 | 13541 | { |
---|
13172 | 13542 | return; |
---|
.. | .. |
---|
13175 | 13545 | boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK); |
---|
13176 | 13546 | |
---|
13177 | 13547 | // TIMER |
---|
13178 | | - if (!wheeltimer.isRunning() && e.getModifiersEx() == 0 && !capsLocked) // VR |
---|
| 13548 | + if (ZOOMBOXMODE && !wheeltimer.isRunning() && e.getModifiersEx() == 0 && !capsLocked) // VR |
---|
13179 | 13549 | { |
---|
13180 | 13550 | keepboxmode = BOXMODE; |
---|
13181 | 13551 | keepsupport = SUPPORT; |
---|
.. | .. |
---|
13392 | 13762 | |
---|
13393 | 13763 | public void mouseDragged(MouseEvent e) |
---|
13394 | 13764 | { |
---|
| 13765 | + //System.out.println("mouseDragged: " + e); |
---|
13395 | 13766 | if (isRenderer) |
---|
13396 | 13767 | movingcamera = true; |
---|
13397 | 13768 | //if (drawing) |
---|
13398 | 13769 | //return; |
---|
13399 | | - //System.out.println("mouseDragged: " + e); |
---|
13400 | 13770 | if ((e.getModifiersEx() & CTRL) != 0 |
---|
13401 | 13771 | || (e.getModifiersEx() & COMMAND) != 0) // || IsFrozen()) |
---|
13402 | 13772 | { |
---|
.. | .. |
---|
13577 | 13947 | |
---|
13578 | 13948 | public void run() |
---|
13579 | 13949 | { |
---|
| 13950 | + new Exception().printStackTrace(); |
---|
13580 | 13951 | System.exit(0); |
---|
13581 | 13952 | for (;;) |
---|
13582 | 13953 | { |
---|
.. | .. |
---|
13931 | 14302 | public void mouseMoved(MouseEvent e) |
---|
13932 | 14303 | { |
---|
13933 | 14304 | //System.out.println("mouseMoved: " + e); |
---|
13934 | | - |
---|
13935 | 14305 | if (isRenderer) |
---|
13936 | 14306 | return; |
---|
13937 | 14307 | |
---|
.. | .. |
---|
14153 | 14523 | SetMouseMode(modifiers); |
---|
14154 | 14524 | } |
---|
14155 | 14525 | |
---|
14156 | | - theRenderer.keyPressed(key); |
---|
| 14526 | + Globals.theRenderer.keyPressed(key); |
---|
14157 | 14527 | } |
---|
14158 | 14528 | |
---|
14159 | 14529 | int kompactbit = 4; // power bit |
---|
.. | .. |
---|
14165 | 14535 | float SATPOW = 1; // 2; // 0.5f; |
---|
14166 | 14536 | float BRIPOW = 1; // 0.5f; // 0.5f; |
---|
14167 | 14537 | |
---|
14168 | | - void keyPressed(int key) |
---|
| 14538 | + public void keyPressed(int key) |
---|
14169 | 14539 | { |
---|
14170 | 14540 | if (key >= '0' && key <= '5') |
---|
14171 | 14541 | clampbit = (key-'0'); |
---|
.. | .. |
---|
14602 | 14972 | } |
---|
14603 | 14973 | //System.out.println("shaper_fovy = " + manipCamera.shaper_fovy); |
---|
14604 | 14974 | } |
---|
| 14975 | + |
---|
14605 | 14976 | static double OCCLUSIONBOOST = 1; // 0.5; |
---|
14606 | 14977 | |
---|
14607 | 14978 | void keyReleased(int key, int modifiers) |
---|
.. | .. |
---|
14613 | 14984 | } |
---|
14614 | 14985 | } |
---|
14615 | 14986 | |
---|
14616 | | - protected void processKeyEvent(KeyEvent e) |
---|
| 14987 | + public void processKeyEvent(KeyEvent e) |
---|
14617 | 14988 | { |
---|
14618 | 14989 | switch (e.getID()) |
---|
14619 | 14990 | { |
---|
.. | .. |
---|
14743 | 15114 | |
---|
14744 | 15115 | protected void processMouseMotionEvent(MouseEvent e) |
---|
14745 | 15116 | { |
---|
14746 | | - //System.out.println("processMouseMotionEvent: " + mouseMode); |
---|
14747 | | - if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0) |
---|
| 15117 | + //System.out.println("processMouseMotionEvent: " + mouseMode + " " + e.getModifiers() + " " + e.getModifiersEx() + " " + e.getButton()); |
---|
| 15118 | + //if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0) |
---|
| 15119 | + if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) == 0 && (mouseMode & SELECT) == 0) |
---|
14748 | 15120 | { |
---|
14749 | 15121 | mouseMoved(e); |
---|
14750 | 15122 | } else |
---|
.. | .. |
---|
14774 | 15146 | |
---|
14775 | 15147 | void SelectParent() |
---|
14776 | 15148 | { |
---|
| 15149 | + new Exception().printStackTrace(); |
---|
14777 | 15150 | System.exit(0); |
---|
14778 | 15151 | Composite group = (Composite) object; |
---|
14779 | 15152 | java.util.Vector selectees = new java.util.Vector(group.selection); |
---|
.. | .. |
---|
14797 | 15170 | |
---|
14798 | 15171 | void SelectChildren() |
---|
14799 | 15172 | { |
---|
| 15173 | + new Exception().printStackTrace(); |
---|
14800 | 15174 | System.exit(0); |
---|
14801 | 15175 | /* |
---|
14802 | 15176 | Composite group = (Composite) object; |
---|
.. | .. |
---|
15910 | 16284 | { |
---|
15911 | 16285 | if (!selection) |
---|
15912 | 16286 | { |
---|
| 16287 | + new Exception().printStackTrace(); |
---|
15913 | 16288 | System.exit(0); |
---|
15914 | 16289 | return; |
---|
15915 | 16290 | } |
---|
.. | .. |
---|
16696 | 17071 | static IntBuffer textbuffer = null; // IntBuffer.allocate(TEXT_WIDTH*8*8 * TEXT_HEIGHT); |
---|
16697 | 17072 | // Depth buffer format |
---|
16698 | 17073 | //private int depth_format; |
---|
16699 | | - static public void NextIndex(Object3D o, GL gl) |
---|
| 17074 | + |
---|
| 17075 | + public void NextIndex() |
---|
16700 | 17076 | { |
---|
16701 | 17077 | indexcount+=16; |
---|
16702 | | - gl.glColor3d(((indexcount >>> 16) & 255) / 255.0, ((indexcount >>> 8) & 255) / 255.0, ((indexcount) & 255) / 255.0); |
---|
| 17078 | + GetGL().glColor3d(((indexcount >>> 16) & 255) / 255.0, ((indexcount >>> 8) & 255) / 255.0, ((indexcount) & 255) / 255.0); |
---|
16703 | 17079 | //objects[indexcount] = o; |
---|
16704 | 17080 | //System.out.println("indexcount = " + indexcount); |
---|
16705 | 17081 | } |
---|