Normand Briere
2019-07-14 bc829f47837b5a001f911542140b0b8e63c2bb0c
CameraPane.java
....@@ -37,7 +37,6 @@
3737 static boolean[] selectedstack = new boolean[65536];
3838 static int materialdepth = 0;
3939
40
- static boolean DEBUG = false;
4140 static boolean FRUSTUM = false; // still bogus true; // frustum culling
4241
4342 // camera change fix
....@@ -327,7 +326,7 @@
327326 cStatic.objectstack[materialdepth++] = obj;
328327 //System.out.println("material " + material);
329328 //Applet3D.tracein(this, selected);
330
- display.vector2buffer = obj.projectedVertices;
329
+ //display.vector2buffer = obj.projectedVertices;
331330 if (obj instanceof Camera)
332331 {
333332 display.options1[0] = material.shift;
....@@ -336,14 +335,28 @@
336335 display.options1[2] = material.shadowbias;
337336 display.options1[3] = material.aniso;
338337 display.options1[4] = material.anisoV;
338
+// System.out.println("display.options1[0] " + display.options1[0]);
339
+// System.out.println("display.options1[1] " + display.options1[1]);
340
+// System.out.println("display.options1[2] " + display.options1[2]);
341
+// System.out.println("display.options1[3] " + display.options1[3]);
342
+// System.out.println("display.options1[4] " + display.options1[4]);
339343 display.options2[0] = material.opacity;
340344 display.options2[1] = material.diffuse;
341345 display.options2[2] = material.factor;
346
+// System.out.println("display.options2[0] " + display.options2[0]);
347
+// System.out.println("display.options2[1] " + display.options2[1]);
348
+// System.out.println("display.options2[2] " + display.options2[2]);
342349
343350 cColor.HSBtoRGB(material.color, material.modulation, 1, display.options3);
351
+// System.out.println("display.options3[0] " + display.options3[0]);
352
+// System.out.println("display.options3[1] " + display.options3[1]);
353
+// System.out.println("display.options3[2] " + display.options3[2]);
344354 display.options4[0] = material.cameralight/0.2f;
345355 display.options4[1] = material.subsurface;
346356 display.options4[2] = material.sheen;
357
+// System.out.println("display.options4[0] " + display.options4[0]);
358
+// System.out.println("display.options4[1] " + display.options4[1]);
359
+// System.out.println("display.options4[2] " + display.options4[2]);
347360
348361 // if (display.CURRENTANTIALIAS > 0)
349362 // display.options3[3] /= 4;
....@@ -359,7 +372,7 @@
359372 /**/
360373 } else
361374 {
362
- DrawMaterial(material, selected);
375
+ DrawMaterial(material, selected, obj.projectedVertices);
363376 }
364377 } else
365378 {
....@@ -383,8 +396,8 @@
383396 cStatic.objectstack[materialdepth++] = obj;
384397 //System.out.println("material " + material);
385398 //Applet3D.tracein("selected ", selected);
386
- display.vector2buffer = obj.projectedVertices;
387
- display.DrawMaterial(material, selected);
399
+ //display.vector2buffer = obj.projectedVertices;
400
+ display.DrawMaterial(material, selected, obj.projectedVertices);
388401 }
389402 }
390403
....@@ -401,8 +414,8 @@
401414 materialdepth -= 1;
402415 if (materialdepth > 0)
403416 {
404
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
405
- display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
417
+ //display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
418
+ display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
406419 }
407420 //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
408421 } else if (selected && CameraPane.flash && obj.GetMaterial() != null)
....@@ -422,8 +435,8 @@
422435 materialdepth -= 1;
423436 if (materialdepth > 0)
424437 {
425
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
426
- display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
438
+ //display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
439
+ display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
427440 }
428441 //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
429442 //else
....@@ -1611,7 +1624,7 @@
16111624 // gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0);
16121625 }
16131626
1614
- void DrawMaterial(cMaterial material, boolean selected)
1627
+ void DrawMaterial(cMaterial material, boolean selected, Object3D.cVector2[] others)
16151628 {
16161629 CameraPane display = this;
16171630 //new Exception().printStackTrace();
....@@ -1646,7 +1659,7 @@
16461659 colorV[0] = display.modelParams0[0] * material.diffuse;
16471660 colorV[1] = display.modelParams0[1] * material.diffuse;
16481661 colorV[2] = display.modelParams0[2] * material.diffuse;
1649
- colorV[3] = material.opacity;
1662
+ colorV[3] = 1; // material.opacity;
16501663
16511664 gl.glColor4f(colorV[0], colorV[1], colorV[2], material.opacity);
16521665 //System.out.println("Opacity = " + opacity);
....@@ -1754,9 +1767,9 @@
17541767 display.modelParams7[2] = 0;
17551768 display.modelParams7[3] = 0;
17561769
1757
- display.modelParams6[0] = 100; // criss de bug de bump
1770
+ //display.modelParams6[0] = 100; // criss de bug de bump
17581771
1759
- Object3D.cVector2[] extparams = display.vector2buffer;
1772
+ Object3D.cVector2[] extparams = others; // display.vector2buffer;
17601773 if (extparams != null && extparams.length > 0 && extparams[0] != null)
17611774 {
17621775 display.modelParams6[0] = extparams[0].x / 1000.0f; // bump
....@@ -2052,7 +2065,7 @@
20522065 //System.err.println("Oeil on");
20532066 OEIL = true;
20542067 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
2055
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
2068
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
20562069 //pingthread.StepToTarget(true);
20572070 }
20582071
....@@ -2267,7 +2280,7 @@
22672280
22682281 void ToggleDebug()
22692282 {
2270
- DEBUG ^= true;
2283
+ Globals.DEBUG ^= true;
22712284 }
22722285
22732286 void ToggleLookAt()
....@@ -9367,11 +9380,35 @@
93679380 jy8[3] = 0.5f;
93689381 }
93699382
9370
- float[] options1 = new float[]{1000, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV
9383
+ float[] options1 = new float[]{100, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV
93719384 float[] options2 = new float[]{0, 1, 0, 0}; // fog density, intensity, elevation
93729385 float[] options3 = new float[]{1, 1, 1, 0}; // fog color
93739386 float[] options4 = new float[]{1, 0, 1, 0}; // image intensity, subsurface, lightsheen
93749387
9388
+ void ResetOptions()
9389
+ {
9390
+ options1[0] = 100;
9391
+ options1[1] = 0.025f;
9392
+ options1[2] = 0.01f;
9393
+ options1[3] = 0;
9394
+ options1[4] = 0;
9395
+
9396
+ options2[0] = 0;
9397
+ options2[1] = 0.75f;
9398
+ options2[2] = 0;
9399
+ options2[3] = 0;
9400
+
9401
+ options3[0] = 1;
9402
+ options3[1] = 1;
9403
+ options3[2] = 1;
9404
+ options3[3] = 0;
9405
+
9406
+ options4[0] = 1;
9407
+ options4[1] = 0;
9408
+ options4[2] = 1;
9409
+ options4[3] = 0;
9410
+ }
9411
+
93759412 static int imagecount = 0; // movie generation
93769413
93779414 static int jitter = 0;
....@@ -10482,6 +10519,7 @@
1048210519 ANTIALIAS = 0;
1048310520 //System.out.println("RESTART");
1048410521 AAtimer.restart();
10522
+ Globals.TIMERRUNNING = true;
1048510523 }
1048610524 }
1048710525 }
....@@ -10549,7 +10587,8 @@
1054910587 ambientOcclusion = false;
1055010588 }
1055110589
10552
- if (Globals.lighttouched && DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN)
10590
+ if (//Globals.lighttouched &&
10591
+ DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN)
1055310592 {
1055410593 //if (RENDERSHADOW) // ?
1055510594 if (!IsFrozen())
....@@ -10989,9 +11028,9 @@
1098911028
1099011029 gl.glMatrixMode(GL.GL_MODELVIEW);
1099111030
10992
-//gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST);
10993
-//gl.glEnable(gl.GL_POLYGON_SMOOTH);
10994
-//gl.glEnable(gl.GL_MULTISAMPLE);
11031
+gl.glEnable(gl.GL_POLYGON_SMOOTH);
11032
+gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST);
11033
+gl.glEnable(gl.GL_MULTISAMPLE);
1099511034 } else
1099611035 {
1099711036 //gl.glDisable(GL.GL_TEXTURE_2D);
....@@ -11002,7 +11041,7 @@
1100211041 //System.out.println("BLENDING ON");
1100311042 gl.glEnable(GL.GL_BLEND);
1100411043 gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
11005
-
11044
+// gl.glBlendFunc(GL.GL_SRC_ALPHA_SATURATE, GL.GL_ONE);
1100611045 gl.glMatrixMode(gl.GL_PROJECTION);
1100711046 gl.glLoadIdentity();
1100811047
....@@ -11459,15 +11498,36 @@
1145911498
1146011499 static boolean zoomonce = false;
1146111500
11501
+ static void CreateSelectedPoint()
11502
+ {
11503
+ if (selectedpoint == null)
11504
+ {
11505
+ debugpointG = new Sphere();
11506
+ debugpointP = new Sphere();
11507
+ debugpointC = new Sphere();
11508
+ debugpointR = new Sphere();
11509
+
11510
+ selectedpoint = new Superellipsoid();
11511
+
11512
+ for (int i=0; i<8; i++)
11513
+ {
11514
+ debugpoints[i] = new Sphere();
11515
+ }
11516
+ }
11517
+ }
11518
+
1146211519 void DrawObject(GL gl, boolean draw)
1146311520 {
11521
+ // To clear camera values
11522
+ ResetOptions();
11523
+
1146411524 //System.out.println("DRAW OBJECT " + mouseDown);
1146511525 // DrawMode() = SELECTION;
1146611526 //GL gl = getGL();
1146711527 if ((TRACK || SHADOWTRACK) || zoomonce)
1146811528 {
1146911529 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
11470
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
11530
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1147111531 pingthread.StepToTarget(true); // true);
1147211532 // zoomonce = false;
1147311533 }
....@@ -11539,8 +11599,9 @@
1153911599
1154011600 if (DrawMode() == DEFAULT)
1154111601 {
11542
- if (DEBUG)
11602
+ if (Globals.DEBUG)
1154311603 {
11604
+ CreateSelectedPoint();
1154411605 float radius = 0.05f;
1154511606 if (selectedpoint.radius != radius)
1154611607 {
....@@ -12027,7 +12088,7 @@
1202712088 for (int i = tp.size(); --i >= 0;)
1202812089 {
1202912090 //for (int count = tp.get(i).GetTransformCount(); --count>=0;)
12030
- LA.xformPos(light, tp.get(i).GlobalTransform(), light);
12091
+ LA.xformPos(light, tp.get(i).GlobalTransformInv(), light);
1203112092 }
1203212093
1203312094
....@@ -13297,7 +13358,8 @@
1329713358 /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias
1329813359 /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough
1329913360 /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power
13300
- Object3D.cVector2[] vector2buffer;
13361
+
13362
+ //Object3D.cVector2[] vector2buffer;
1330113363
1330213364 // IN : ndotl, ndoth, xxx, NdotL //, snininess, lightarea
1330313365 // OUT : diff, spec
....@@ -13313,9 +13375,10 @@
1331313375 "DP3 " + dest + ".z," + "normals," + "eye;" +
1331413376 "MAX " + dest + ".w," + dest + ".z," + "eps.x;" +
1331513377 //"MOV " + dest + ".w," + "normal.z;" +
13316
- "MUL " + dest + ".z," + "params2.w," + dest + ".x;" +
13317
- "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" +
13318
- //"MOV " + dest + ".z," + "params2.w;" +
13378
+// "MUL " + dest + ".z," + "params2.w," + dest + ".x;" + // PRETTY HEURISTIC FOR VELVET
13379
+// "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" +
13380
+
13381
+ "MOV " + dest + ".z," + "params2.w;" + // EXACT
1331913382 "POW " + dest + ".w," + dest + ".w," + dest + ".z;" +
1332013383 "RCP " + dest + ".w," + dest + ".w;" +
1332113384 //"RSQ " + dest + ".w," + dest + ".w;" +
....@@ -13820,6 +13883,7 @@
1382013883 else
1382113884 if (evt.getSource() == AAtimer)
1382213885 {
13886
+ Globals.TIMERRUNNING = false;
1382313887 if (mouseDown)
1382413888 {
1382513889 //new Exception().printStackTrace();
....@@ -13879,7 +13943,7 @@
1387913943
1388013944 // fev 2014???
1388113945 if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode)
13882
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
13946
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1388313947 pingthread.StepToTarget(true); // true);
1388413948 }
1388513949 // if (!LIVE)
....@@ -13894,6 +13958,7 @@
1389413958 return;
1389513959
1389613960 AAtimer.restart(); //
13961
+ Globals.TIMERRUNNING = true;
1389713962
1389813963 // waslive = LIVE;
1389913964 // LIVE = false;
....@@ -14232,12 +14297,12 @@
1423214297 void GoDown(int mod)
1423314298 {
1423414299 MODIFIERS |= COMMAND;
14235
- /*
14300
+ /**/
1423614301 if((mod&SHIFT) == SHIFT)
1423714302 manipCamera.RotatePosition(0, -speed);
1423814303 else
14239
- manipCamera.BackForth(0, -speed*delta, getWidth());
14240
- */
14304
+ manipCamera.BackForth(0, -speed*delta, 0); // getWidth());
14305
+ /**/
1424114306 if ((mod & SHIFT) == SHIFT)
1424214307 {
1424314308 mouseMode = mouseMode; // VR??
....@@ -14253,12 +14318,12 @@
1425314318 void GoUp(int mod)
1425414319 {
1425514320 MODIFIERS |= COMMAND;
14256
- /*
14321
+ /**/
1425714322 if((mod&SHIFT) == SHIFT)
1425814323 manipCamera.RotatePosition(0, speed);
1425914324 else
14260
- manipCamera.BackForth(0, speed*delta, getWidth());
14261
- */
14325
+ manipCamera.BackForth(0, speed*delta, 0); // getWidth());
14326
+ /**/
1426214327 if ((mod & SHIFT) == SHIFT)
1426314328 {
1426414329 mouseMode = mouseMode;
....@@ -14274,12 +14339,12 @@
1427414339 void GoLeft(int mod)
1427514340 {
1427614341 MODIFIERS |= COMMAND;
14277
- /*
14342
+ /**/
1427814343 if((mod&SHIFT) == SHIFT)
14279
- manipCamera.RotatePosition(speed, 0);
14280
- else
1428114344 manipCamera.Translate(speed*delta, 0, getWidth());
14282
- */
14345
+ else
14346
+ manipCamera.RotatePosition(speed, 0);
14347
+ /**/
1428314348 if ((mod & SHIFT) == SHIFT)
1428414349 {
1428514350 mouseMode = mouseMode;
....@@ -14295,12 +14360,12 @@
1429514360 void GoRight(int mod)
1429614361 {
1429714362 MODIFIERS |= COMMAND;
14298
- /*
14363
+ /**/
1429914364 if((mod&SHIFT) == SHIFT)
14300
- manipCamera.RotatePosition(-speed, 0);
14301
- else
1430214365 manipCamera.Translate(-speed*delta, 0, getWidth());
14303
- */
14366
+ else
14367
+ manipCamera.RotatePosition(-speed, 0);
14368
+ /**/
1430414369 if ((mod & SHIFT) == SHIFT)
1430514370 {
1430614371 mouseMode = mouseMode;
....@@ -14357,7 +14422,8 @@
1435714422 info.camera = renderCamera;
1435814423 info.x = x;
1435914424 info.y = y;
14360
- object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
14425
+ object.GetWindow().copy
14426
+ .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1436114427 } else
1436214428 {
1436314429 if (x < startX)
....@@ -14521,7 +14587,9 @@
1452114587 ci.camera = renderCamera;
1452214588 if (!isRenderer)
1452314589 {
14524
- if (object.editWindow.copy.doEditClick(ci, 0))
14590
+ //ObjEditor editWindow = object.editWindow;
14591
+ //Object3D copy = editWindow.copy;
14592
+ if (object.doEditClick(ci, 0))
1452514593 {
1452614594 setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
1452714595 } else
....@@ -14536,7 +14604,8 @@
1453614604 Globals.MOUSEDRAGGED = false;
1453714605
1453814606 movingcamera = false;
14539
- X = Y = 0;
14607
+ X = 0; // getBounds().width/2;
14608
+ Y = 0; // getBounds().height/2;
1454014609 //System.out.println("mouseReleased: " + e);
1454114610 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1454214611 }
....@@ -14877,7 +14946,9 @@
1487714946 case 'E' : COMPACT ^= true;
1487814947 repaint();
1487914948 break;
14880
- case 'W' : DEBUGHSB ^= true;
14949
+ case 'W' : // Wide Window (fullscreen)
14950
+ //DEBUGHSB ^= true;
14951
+ ObjEditor.theFrame.ToggleFullScreen();
1488114952 repaint();
1488214953 break;
1488314954 case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break;
....@@ -14902,8 +14973,8 @@
1490214973 RevertCamera();
1490314974 repaint();
1490414975 break;
14905
- case 'L':
1490614976 case 'l':
14977
+ //case 'L':
1490714978 if (lightMode)
1490814979 {
1490914980 lightMode = false;
....@@ -15046,9 +15117,9 @@
1504615117 case '_':
1504715118 kompactbit = 5;
1504815119 break;
15049
- case '+':
15050
- kompactbit = 6;
15051
- break;
15120
+// case '+':
15121
+// kompactbit = 6;
15122
+// break;
1505215123 case ' ':
1505315124 lightMode ^= true;
1505415125 Globals.lighttouched = true;
....@@ -15060,6 +15131,7 @@
1506015131 case ESC:
1506115132 RENDERPROGRAM += 1;
1506215133 RENDERPROGRAM %= 3;
15134
+
1506315135 repaint();
1506415136 break;
1506515137 case 'Z':
....@@ -15099,8 +15171,9 @@
1509915171 case DELETE:
1510015172 ClearSelection();
1510115173 break;
15102
- /*
1510315174 case '+':
15175
+
15176
+ /*
1510415177 //fontsize += 1;
1510515178 bbzoom *= 2;
1510615179 repaint();
....@@ -15117,17 +15190,17 @@
1511715190 case '=':
1511815191 IncDepth();
1511915192 //fontsize += 1;
15120
- object.editWindow.refreshContents(true);
15193
+ object.GetWindow().refreshContents(true);
1512115194 maskbit = 6;
1512215195 break;
1512315196 case '-': //if (PixelThreshold>1) PixelThreshold /= 2;
1512415197 DecDepth();
1512515198 maskbit = 5;
1512615199 //if(fontsize > 1) fontsize -= 1;
15127
- if (object.editWindow == null)
15128
- new Exception().printStackTrace();
15129
- else
15130
- object.editWindow.refreshContents(true);
15200
+// if (object.editWindow == null)
15201
+// new Exception().printStackTrace();
15202
+// else
15203
+ object.GetWindow().refreshContents(true);
1513115204 break;
1513215205 case '{':
1513315206 manipCamera.shaper_fovy /= 1.1;
....@@ -15351,7 +15424,7 @@
1535115424 }
1535215425 */
1535315426
15354
- object.editWindow.EditSelection();
15427
+ object.GetWindow().EditSelection(false);
1535515428 }
1535615429
1535715430 void SelectParent()
....@@ -15368,10 +15441,10 @@
1536815441 {
1536915442 //selectees.remove(i);
1537015443 System.out.println("select parent of " + elem);
15371
- group.editWindow.Select(elem.parent.GetTreePath(), first, true);
15444
+ group.GetWindow().Select(elem.parent.GetTreePath(), first, true);
1537215445 } else
1537315446 {
15374
- group.editWindow.Select(elem.GetTreePath(), first, true);
15447
+ group.GetWindow().Select(elem.GetTreePath(), first, true);
1537515448 }
1537615449
1537715450 first = false;
....@@ -15413,12 +15486,12 @@
1541315486 for (int j = 0; j < group.children.size(); j++)
1541415487 {
1541515488 elem = (Object3D) group.children.elementAt(j);
15416
- object.editWindow.Select(elem.GetTreePath(), first, true);
15489
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1541715490 first = false;
1541815491 }
1541915492 } else
1542015493 {
15421
- object.editWindow.Select(elem.GetTreePath(), first, true);
15494
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1542215495 }
1542315496
1542415497 first = false;
....@@ -15429,21 +15502,21 @@
1542915502 {
1543015503 //Composite group = (Composite) object;
1543115504 Object3D group = object;
15432
- group.editWindow.loadClipboard(true); // ClearSelection(false);
15505
+ group.GetWindow().loadClipboard(true); // ClearSelection(false);
1543315506 }
1543415507
1543515508 void ResetTransform(int mask)
1543615509 {
1543715510 //Composite group = (Composite) object;
1543815511 Object3D group = object;
15439
- group.editWindow.ResetTransform(mask);
15512
+ group.GetWindow().ResetTransform(mask);
1544015513 }
1544115514
1544215515 void FlipTransform()
1544315516 {
1544415517 //Composite group = (Composite) object;
1544515518 Object3D group = object;
15446
- group.editWindow.FlipTransform();
15519
+ group.GetWindow().FlipTransform();
1544715520 // group.editWindow.ReduceMesh(true);
1544815521 }
1544915522
....@@ -15451,7 +15524,7 @@
1545115524 {
1545215525 //Composite group = (Composite) object;
1545315526 Object3D group = object;
15454
- group.editWindow.PrintMemory();
15527
+ group.GetWindow().PrintMemory();
1545515528 // group.editWindow.ReduceMesh(true);
1545615529 }
1545715530
....@@ -15459,7 +15532,7 @@
1545915532 {
1546015533 //Composite group = (Composite) object;
1546115534 Object3D group = object;
15462
- group.editWindow.ResetCentroid();
15535
+ group.GetWindow().ResetCentroid();
1546315536 }
1546415537
1546515538 void IncDepth()
....@@ -15644,23 +15717,42 @@
1564415717 */
1564515718 if (!isRenderer)
1564615719 {
15647
- object.drawEditHandles(info, 0);
15648
-
15649
- if (drag && (X != 0 || Y != 0) && object.selection.Size() > 0)
15720
+ if (object.selection.Size() > 0)
1565015721 {
15651
- switch (object.selection.get(0).hitSomething)
15722
+ int hitSomething = object.selection.get(0).hitSomething;
15723
+
15724
+ info.DX = 0;
15725
+ info.DY = 0;
15726
+ info.W = 1;
15727
+ if (hitSomething == Object3D.hitCenter)
1565215728 {
15653
- case Object3D.hitCenter: gr.setColor(Color.pink);
15654
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15655
- break;
15656
- case Object3D.hitRotate: gr.setColor(Color.yellow);
15657
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15658
- break;
15659
- case Object3D.hitScale: gr.setColor(Color.cyan);
15660
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15661
- break;
15729
+ info.DX = X;
15730
+ if (X != 0)
15731
+ info.DX -= info.bounds.width/2;
15732
+
15733
+ info.DY = Y;
15734
+ if (Y != 0)
15735
+ info.DY -= info.bounds.height/2;
1566215736 }
15663
-
15737
+
15738
+ object.drawEditHandles(info, 0);
15739
+
15740
+ if (drag && (X != 0 || Y != 0))
15741
+ {
15742
+ switch (hitSomething)
15743
+ {
15744
+ case Object3D.hitCenter: gr.setColor(Color.pink);
15745
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15746
+ break;
15747
+ case Object3D.hitRotate: gr.setColor(Color.yellow);
15748
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15749
+ break;
15750
+ case Object3D.hitScale: gr.setColor(Color.cyan);
15751
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15752
+ break;
15753
+ }
15754
+
15755
+ }
1566415756 }
1566515757 }
1566615758 }
....@@ -16363,16 +16455,16 @@
1636316455 cStatic.objectstack[materialdepth++] = checker;
1636416456 //System.out.println("material " + material);
1636516457 //Applet3D.tracein(this, selected);
16366
- vector2buffer = checker.projectedVertices;
16458
+ //vector2buffer = checker.projectedVertices;
1636716459
1636816460 //checker.GetMaterial().Draw(this, false); // true);
16369
- DrawMaterial(checker.GetMaterial(), false); // true);
16461
+ DrawMaterial(checker.GetMaterial(), false, checker.projectedVertices); // true);
1637016462
1637116463 materialdepth -= 1;
1637216464 if (materialdepth > 0)
1637316465 {
16374
- vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
16375
- DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
16466
+ //vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
16467
+ DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
1637616468 }
1637716469 //checker.GetMaterial().opacity = 1f;
1637816470 ////checker.GetMaterial().ambient = 1f;
....@@ -16596,6 +16688,8 @@
1659616688 // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]);
1659716689 // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]);
1659816690
16691
+ CreateSelectedPoint();
16692
+
1659916693 // Will fit the mesh !!!
1660016694 selectedpoint.toParent[0][0] = 0.0001;
1660116695 selectedpoint.toParent[1][1] = 0.0001;
....@@ -16649,7 +16743,7 @@
1664916743 }
1665016744
1665116745 if (!movingcamera && !PAINTMODE)
16652
- object.editWindow.ScreenFitPoint(); // fev 2014
16746
+ object.GetWindow().ScreenFitPoint(); // fev 2014
1665316747
1665416748 if (PAINTMODE && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
1665516749 {
....@@ -16661,17 +16755,17 @@
1666116755
1666216756 group.add(paintobj); // link
1666316757
16664
- object.editWindow.SnapObject(group);
16758
+ object.GetWindow().SnapObject(group);
1666516759
16666
- Object3D folder = object.editWindow.copy;
16760
+ Object3D folder = object.GetWindow().copy;
1666716761
16668
- if (object.editWindow.copy.selection.Size() > 0)
16669
- folder = object.editWindow.copy.selection.elementAt(0);
16762
+ if (object.GetWindow().copy.selection.Size() > 0)
16763
+ folder = object.GetWindow().copy.selection.elementAt(0);
1667016764
1667116765 folder.add(group);
1667216766
16673
- object.editWindow.ResetModel();
16674
- object.editWindow.refreshContents();
16767
+ object.GetWindow().ResetModel();
16768
+ object.GetWindow().refreshContents();
1667516769 }
1667616770 else
1667716771 paintcount = 0;
....@@ -16710,6 +16804,11 @@
1671016804 //System.out.println("objects[color] = " + objects[color]);
1671116805 //objects[color].Select();
1671216806 indexcount = 0;
16807
+ ObjEditor window = object.GetWindow();
16808
+ if (window != null && deselect)
16809
+ {
16810
+ window.Select(null, deselect, true);
16811
+ }
1671316812 object.Select(color, deselect);
1671416813 }
1671516814
....@@ -17235,23 +17334,15 @@
1723517334 int AAbuffersize = 0;
1723617335
1723717336 //double[] selectedpoint = new double[3];
17238
- static Superellipsoid selectedpoint = new Superellipsoid();
17337
+ static Superellipsoid selectedpoint;
1723917338 static Sphere previousselectedpoint = null;
17240
- static Sphere debugpointG = new Sphere();
17241
- static Sphere debugpointP = new Sphere();
17242
- static Sphere debugpointC = new Sphere();
17243
- static Sphere debugpointR = new Sphere();
17339
+ static Sphere debugpointG;
17340
+ static Sphere debugpointP;
17341
+ static Sphere debugpointC;
17342
+ static Sphere debugpointR;
1724417343
1724517344 static Sphere debugpoints[] = new Sphere[8];
1724617345
17247
- static
17248
- {
17249
- for (int i=0; i<8; i++)
17250
- {
17251
- debugpoints[i] = new Sphere();
17252
- }
17253
- }
17254
-
1725517346 static void InitPoints(float radius)
1725617347 {
1725717348 for (int i=0; i<8; i++)