Normand Briere
2019-07-21 5a546232b84ce65d8779d29e9171e7e2df013614
CameraPane.java
....@@ -326,7 +326,7 @@
326326 cStatic.objectstack[materialdepth++] = obj;
327327 //System.out.println("material " + material);
328328 //Applet3D.tracein(this, selected);
329
- display.vector2buffer = obj.projectedVertices;
329
+ //display.vector2buffer = obj.projectedVertices;
330330 if (obj instanceof Camera)
331331 {
332332 display.options1[0] = material.shift;
....@@ -335,14 +335,28 @@
335335 display.options1[2] = material.shadowbias;
336336 display.options1[3] = material.aniso;
337337 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]);
338343 display.options2[0] = material.opacity;
339344 display.options2[1] = material.diffuse;
340345 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]);
341349
342350 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]);
343354 display.options4[0] = material.cameralight/0.2f;
344355 display.options4[1] = material.subsurface;
345356 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]);
346360
347361 // if (display.CURRENTANTIALIAS > 0)
348362 // display.options3[3] /= 4;
....@@ -358,7 +372,7 @@
358372 /**/
359373 } else
360374 {
361
- DrawMaterial(material, selected);
375
+ DrawMaterial(material, selected, obj.projectedVertices);
362376 }
363377 } else
364378 {
....@@ -382,8 +396,8 @@
382396 cStatic.objectstack[materialdepth++] = obj;
383397 //System.out.println("material " + material);
384398 //Applet3D.tracein("selected ", selected);
385
- display.vector2buffer = obj.projectedVertices;
386
- display.DrawMaterial(material, selected);
399
+ //display.vector2buffer = obj.projectedVertices;
400
+ display.DrawMaterial(material, selected, obj.projectedVertices);
387401 }
388402 }
389403
....@@ -400,8 +414,8 @@
400414 materialdepth -= 1;
401415 if (materialdepth > 0)
402416 {
403
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
404
- 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);
405419 }
406420 //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
407421 } else if (selected && CameraPane.flash && obj.GetMaterial() != null)
....@@ -421,8 +435,8 @@
421435 materialdepth -= 1;
422436 if (materialdepth > 0)
423437 {
424
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
425
- 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);
426440 }
427441 //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
428442 //else
....@@ -1610,7 +1624,7 @@
16101624 // gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0);
16111625 }
16121626
1613
- void DrawMaterial(cMaterial material, boolean selected)
1627
+ void DrawMaterial(cMaterial material, boolean selected, Object3D.cVector2[] others)
16141628 {
16151629 CameraPane display = this;
16161630 //new Exception().printStackTrace();
....@@ -1645,7 +1659,7 @@
16451659 colorV[0] = display.modelParams0[0] * material.diffuse;
16461660 colorV[1] = display.modelParams0[1] * material.diffuse;
16471661 colorV[2] = display.modelParams0[2] * material.diffuse;
1648
- colorV[3] = material.opacity;
1662
+ colorV[3] = 1; // material.opacity;
16491663
16501664 gl.glColor4f(colorV[0], colorV[1], colorV[2], material.opacity);
16511665 //System.out.println("Opacity = " + opacity);
....@@ -1753,9 +1767,9 @@
17531767 display.modelParams7[2] = 0;
17541768 display.modelParams7[3] = 0;
17551769
1756
- display.modelParams6[0] = 100; // criss de bug de bump
1770
+ //display.modelParams6[0] = 100; // criss de bug de bump
17571771
1758
- Object3D.cVector2[] extparams = display.vector2buffer;
1772
+ Object3D.cVector2[] extparams = others; // display.vector2buffer;
17591773 if (extparams != null && extparams.length > 0 && extparams[0] != null)
17601774 {
17611775 display.modelParams6[0] = extparams[0].x / 1000.0f; // bump
....@@ -2051,7 +2065,7 @@
20512065 //System.err.println("Oeil on");
20522066 OEIL = true;
20532067 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
2054
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
2068
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
20552069 //pingthread.StepToTarget(true);
20562070 }
20572071
....@@ -2284,10 +2298,17 @@
22842298 HANDLES ^= true;
22852299 }
22862300
2301
+ Object3D paintFolder;
2302
+
22872303 void TogglePaint()
22882304 {
22892305 PAINTMODE ^= true;
22902306 paintcount = 0;
2307
+
2308
+ if (PAINTMODE)
2309
+ {
2310
+ paintFolder = GetFolder();
2311
+ }
22912312 }
22922313
22932314 void SwapCamera(int a, int b)
....@@ -7909,7 +7930,7 @@
79097930 String pigment = Object3D.GetPigment(tex);
79107931 String bump = Object3D.GetBump(tex);
79117932
7912
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
7933
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
79137934 {
79147935 // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
79157936 // System.out.println("; bump = " + bump);
....@@ -7943,7 +7964,7 @@
79437964
79447965 String pigment = Object3D.GetPigment(tex);
79457966
7946
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
7967
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
79477968 {
79487969 // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
79497970 // System.out.println("; bump = " + bump);
....@@ -7972,7 +7993,7 @@
79727993
79737994 String bump = Object3D.GetBump(tex);
79747995
7975
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
7996
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
79767997 {
79777998 // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
79787999 // System.out.println("; bump = " + bump);
....@@ -8110,7 +8131,7 @@
81108131 usedtextures.put(pigment, pigment);
81118132 usedtextures.put(bump, bump);
81128133
8113
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8134
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
81148135 {
81158136 // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
81168137 // System.out.println("; bump = " + bump);
....@@ -8152,7 +8173,7 @@
81528173
81538174 usedtextures.put(pigment, pigment);
81548175
8155
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8176
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
81568177 {
81578178 // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
81588179 // System.out.println("; bump = " + bump);
....@@ -8185,7 +8206,7 @@
81858206
81868207 usedtextures.put(bump, bump);
81878208
8188
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8209
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
81898210 {
81908211 // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
81918212 // System.out.println("; bump = " + bump);
....@@ -8496,7 +8517,7 @@
84968517 return false;
84978518 }
84988519
8499
- boolean newtex = false;
8520
+ //boolean newtex = false;
85008521
85018522 com.sun.opengl.util.texture.Texture texture = GetTexture(tex, bump, resolution);
85028523
....@@ -8528,7 +8549,7 @@
85288549 texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_S, GetGL().GL_REPEAT);
85298550 texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_T, GetGL().GL_REPEAT);
85308551
8531
- return newtex;
8552
+ return true; // Warning: not used.
85328553 }
85338554
85348555 ShadowBuffer shadowPBuf;
....@@ -9366,11 +9387,35 @@
93669387 jy8[3] = 0.5f;
93679388 }
93689389
9369
- float[] options1 = new float[]{1000, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV
9390
+ float[] options1 = new float[]{100, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV
93709391 float[] options2 = new float[]{0, 1, 0, 0}; // fog density, intensity, elevation
93719392 float[] options3 = new float[]{1, 1, 1, 0}; // fog color
93729393 float[] options4 = new float[]{1, 0, 1, 0}; // image intensity, subsurface, lightsheen
93739394
9395
+ void ResetOptions()
9396
+ {
9397
+ options1[0] = 100;
9398
+ options1[1] = 0.025f;
9399
+ options1[2] = 0.01f;
9400
+ options1[3] = 0;
9401
+ options1[4] = 0;
9402
+
9403
+ options2[0] = 0;
9404
+ options2[1] = 0.75f;
9405
+ options2[2] = 0;
9406
+ options2[3] = 0;
9407
+
9408
+ options3[0] = 1;
9409
+ options3[1] = 1;
9410
+ options3[2] = 1;
9411
+ options3[3] = 0;
9412
+
9413
+ options4[0] = 1;
9414
+ options4[1] = 0;
9415
+ options4[2] = 1;
9416
+ options4[3] = 0;
9417
+ }
9418
+
93749419 static int imagecount = 0; // movie generation
93759420
93769421 static int jitter = 0;
....@@ -10481,6 +10526,7 @@
1048110526 ANTIALIAS = 0;
1048210527 //System.out.println("RESTART");
1048310528 AAtimer.restart();
10529
+ Globals.TIMERRUNNING = true;
1048410530 }
1048510531 }
1048610532 }
....@@ -10548,7 +10594,8 @@
1054810594 ambientOcclusion = false;
1054910595 }
1055010596
10551
- if (Globals.lighttouched && DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN)
10597
+ if (//Globals.lighttouched &&
10598
+ DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN)
1055210599 {
1055310600 //if (RENDERSHADOW) // ?
1055410601 if (!IsFrozen())
....@@ -10988,9 +11035,9 @@
1098811035
1098911036 gl.glMatrixMode(GL.GL_MODELVIEW);
1099011037
10991
-//gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST);
10992
-//gl.glEnable(gl.GL_POLYGON_SMOOTH);
10993
-//gl.glEnable(gl.GL_MULTISAMPLE);
11038
+gl.glEnable(gl.GL_POLYGON_SMOOTH);
11039
+gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST);
11040
+gl.glEnable(gl.GL_MULTISAMPLE);
1099411041 } else
1099511042 {
1099611043 //gl.glDisable(GL.GL_TEXTURE_2D);
....@@ -11001,7 +11048,7 @@
1100111048 //System.out.println("BLENDING ON");
1100211049 gl.glEnable(GL.GL_BLEND);
1100311050 gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
11004
-
11051
+// gl.glBlendFunc(GL.GL_SRC_ALPHA_SATURATE, GL.GL_ONE);
1100511052 gl.glMatrixMode(gl.GL_PROJECTION);
1100611053 gl.glLoadIdentity();
1100711054
....@@ -11458,7 +11505,7 @@
1145811505
1145911506 static boolean zoomonce = false;
1146011507
11461
- void CreateSelectedPoint()
11508
+ static void CreateSelectedPoint()
1146211509 {
1146311510 if (selectedpoint == null)
1146411511 {
....@@ -11478,13 +11525,16 @@
1147811525
1147911526 void DrawObject(GL gl, boolean draw)
1148011527 {
11528
+ // To clear camera values
11529
+ ResetOptions();
11530
+
1148111531 //System.out.println("DRAW OBJECT " + mouseDown);
1148211532 // DrawMode() = SELECTION;
1148311533 //GL gl = getGL();
1148411534 if ((TRACK || SHADOWTRACK) || zoomonce)
1148511535 {
1148611536 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
11487
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
11537
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1148811538 pingthread.StepToTarget(true); // true);
1148911539 // zoomonce = false;
1149011540 }
....@@ -12045,7 +12095,7 @@
1204512095 for (int i = tp.size(); --i >= 0;)
1204612096 {
1204712097 //for (int count = tp.get(i).GetTransformCount(); --count>=0;)
12048
- LA.xformPos(light, tp.get(i).GlobalTransform(), light);
12098
+ LA.xformPos(light, tp.get(i).GlobalTransformInv(), light);
1204912099 }
1205012100
1205112101
....@@ -13315,7 +13365,8 @@
1331513365 /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias
1331613366 /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough
1331713367 /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power
13318
- Object3D.cVector2[] vector2buffer;
13368
+
13369
+ //Object3D.cVector2[] vector2buffer;
1331913370
1332013371 // IN : ndotl, ndoth, xxx, NdotL //, snininess, lightarea
1332113372 // OUT : diff, spec
....@@ -13331,9 +13382,10 @@
1333113382 "DP3 " + dest + ".z," + "normals," + "eye;" +
1333213383 "MAX " + dest + ".w," + dest + ".z," + "eps.x;" +
1333313384 //"MOV " + dest + ".w," + "normal.z;" +
13334
- "MUL " + dest + ".z," + "params2.w," + dest + ".x;" +
13335
- "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" +
13336
- //"MOV " + dest + ".z," + "params2.w;" +
13385
+// "MUL " + dest + ".z," + "params2.w," + dest + ".x;" + // PRETTY HEURISTIC FOR VELVET
13386
+// "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" +
13387
+
13388
+ "MOV " + dest + ".z," + "params2.w;" + // EXACT
1333713389 "POW " + dest + ".w," + dest + ".w," + dest + ".z;" +
1333813390 "RCP " + dest + ".w," + dest + ".w;" +
1333913391 //"RSQ " + dest + ".w," + dest + ".w;" +
....@@ -13838,6 +13890,7 @@
1383813890 else
1383913891 if (evt.getSource() == AAtimer)
1384013892 {
13893
+ Globals.TIMERRUNNING = false;
1384113894 if (mouseDown)
1384213895 {
1384313896 //new Exception().printStackTrace();
....@@ -13897,7 +13950,7 @@
1389713950
1389813951 // fev 2014???
1389913952 if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode)
13900
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
13953
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1390113954 pingthread.StepToTarget(true); // true);
1390213955 }
1390313956 // if (!LIVE)
....@@ -13912,6 +13965,7 @@
1391213965 return;
1391313966
1391413967 AAtimer.restart(); //
13968
+ Globals.TIMERRUNNING = true;
1391513969
1391613970 // waslive = LIVE;
1391713971 // LIVE = false;
....@@ -14250,12 +14304,12 @@
1425014304 void GoDown(int mod)
1425114305 {
1425214306 MODIFIERS |= COMMAND;
14253
- /*
14307
+ /**/
1425414308 if((mod&SHIFT) == SHIFT)
1425514309 manipCamera.RotatePosition(0, -speed);
1425614310 else
14257
- manipCamera.BackForth(0, -speed*delta, getWidth());
14258
- */
14311
+ manipCamera.BackForth(0, -speed*delta, 0); // getWidth());
14312
+ /**/
1425914313 if ((mod & SHIFT) == SHIFT)
1426014314 {
1426114315 mouseMode = mouseMode; // VR??
....@@ -14271,12 +14325,12 @@
1427114325 void GoUp(int mod)
1427214326 {
1427314327 MODIFIERS |= COMMAND;
14274
- /*
14328
+ /**/
1427514329 if((mod&SHIFT) == SHIFT)
1427614330 manipCamera.RotatePosition(0, speed);
1427714331 else
14278
- manipCamera.BackForth(0, speed*delta, getWidth());
14279
- */
14332
+ manipCamera.BackForth(0, speed*delta, 0); // getWidth());
14333
+ /**/
1428014334 if ((mod & SHIFT) == SHIFT)
1428114335 {
1428214336 mouseMode = mouseMode;
....@@ -14292,12 +14346,12 @@
1429214346 void GoLeft(int mod)
1429314347 {
1429414348 MODIFIERS |= COMMAND;
14295
- /*
14349
+ /**/
1429614350 if((mod&SHIFT) == SHIFT)
14297
- manipCamera.RotatePosition(speed, 0);
14298
- else
1429914351 manipCamera.Translate(speed*delta, 0, getWidth());
14300
- */
14352
+ else
14353
+ manipCamera.RotatePosition(speed, 0);
14354
+ /**/
1430114355 if ((mod & SHIFT) == SHIFT)
1430214356 {
1430314357 mouseMode = mouseMode;
....@@ -14313,12 +14367,12 @@
1431314367 void GoRight(int mod)
1431414368 {
1431514369 MODIFIERS |= COMMAND;
14316
- /*
14370
+ /**/
1431714371 if((mod&SHIFT) == SHIFT)
14318
- manipCamera.RotatePosition(-speed, 0);
14319
- else
1432014372 manipCamera.Translate(-speed*delta, 0, getWidth());
14321
- */
14373
+ else
14374
+ manipCamera.RotatePosition(-speed, 0);
14375
+ /**/
1432214376 if ((mod & SHIFT) == SHIFT)
1432314377 {
1432414378 mouseMode = mouseMode;
....@@ -14375,7 +14429,8 @@
1437514429 info.camera = renderCamera;
1437614430 info.x = x;
1437714431 info.y = y;
14378
- object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
14432
+ object.GetWindow().copy
14433
+ .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1437914434 } else
1438014435 {
1438114436 if (x < startX)
....@@ -14539,7 +14594,9 @@
1453914594 ci.camera = renderCamera;
1454014595 if (!isRenderer)
1454114596 {
14542
- if (object.editWindow.copy.doEditClick(ci, 0))
14597
+ //ObjEditor editWindow = object.editWindow;
14598
+ //Object3D copy = editWindow.copy;
14599
+ if (object.doEditClick(ci, 0))
1454314600 {
1454414601 setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
1454514602 } else
....@@ -14554,7 +14611,8 @@
1455414611 Globals.MOUSEDRAGGED = false;
1455514612
1455614613 movingcamera = false;
14557
- X = Y = 0;
14614
+ X = 0; // getBounds().width/2;
14615
+ Y = 0; // getBounds().height/2;
1455814616 //System.out.println("mouseReleased: " + e);
1455914617 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1456014618 }
....@@ -14895,7 +14953,9 @@
1489514953 case 'E' : COMPACT ^= true;
1489614954 repaint();
1489714955 break;
14898
- case 'W' : DEBUGHSB ^= true;
14956
+ case 'W' : // Wide Window (fullscreen)
14957
+ //DEBUGHSB ^= true;
14958
+ ObjEditor.theFrame.ToggleFullScreen();
1489914959 repaint();
1490014960 break;
1490114961 case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break;
....@@ -14921,13 +14981,7 @@
1492114981 repaint();
1492214982 break;
1492314983 case 'l':
14924
- lightMode ^= true;
14925
- Globals.lighttouched = true;
14926
- manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
14927
- targetLookAt.set(manipCamera.lookAt);
14928
- repaint();
14929
- break;
14930
- case 'L':
14984
+ //case 'L':
1493114985 if (lightMode)
1493214986 {
1493314987 lightMode = false;
....@@ -15070,11 +15124,14 @@
1507015124 case '_':
1507115125 kompactbit = 5;
1507215126 break;
15073
- case '+':
15074
- kompactbit = 6;
15075
- break;
15127
+// case '+':
15128
+// kompactbit = 6;
15129
+// break;
1507615130 case ' ':
15077
- ObjEditor.theFrame.ToggleFullScreen();
15131
+ lightMode ^= true;
15132
+ Globals.lighttouched = true;
15133
+ manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
15134
+ targetLookAt.set(manipCamera.lookAt);
1507815135 repaint();
1507915136 break;
1508015137 //case '`' :
....@@ -15121,8 +15178,9 @@
1512115178 case DELETE:
1512215179 ClearSelection();
1512315180 break;
15124
- /*
1512515181 case '+':
15182
+
15183
+ /*
1512615184 //fontsize += 1;
1512715185 bbzoom *= 2;
1512815186 repaint();
....@@ -15139,17 +15197,17 @@
1513915197 case '=':
1514015198 IncDepth();
1514115199 //fontsize += 1;
15142
- object.editWindow.refreshContents(true);
15200
+ object.GetWindow().refreshContents(true);
1514315201 maskbit = 6;
1514415202 break;
1514515203 case '-': //if (PixelThreshold>1) PixelThreshold /= 2;
1514615204 DecDepth();
1514715205 maskbit = 5;
1514815206 //if(fontsize > 1) fontsize -= 1;
15149
- if (object.editWindow == null)
15150
- new Exception().printStackTrace();
15151
- else
15152
- object.editWindow.refreshContents(true);
15207
+// if (object.editWindow == null)
15208
+// new Exception().printStackTrace();
15209
+// else
15210
+ object.GetWindow().refreshContents(true);
1515315211 break;
1515415212 case '{':
1515515213 manipCamera.shaper_fovy /= 1.1;
....@@ -15373,7 +15431,7 @@
1537315431 }
1537415432 */
1537515433
15376
- object.editWindow.EditSelection();
15434
+ object.GetWindow().EditSelection(false);
1537715435 }
1537815436
1537915437 void SelectParent()
....@@ -15390,10 +15448,10 @@
1539015448 {
1539115449 //selectees.remove(i);
1539215450 System.out.println("select parent of " + elem);
15393
- group.editWindow.Select(elem.parent.GetTreePath(), first, true);
15451
+ group.GetWindow().Select(elem.parent.GetTreePath(), first, true);
1539415452 } else
1539515453 {
15396
- group.editWindow.Select(elem.GetTreePath(), first, true);
15454
+ group.GetWindow().Select(elem.GetTreePath(), first, true);
1539715455 }
1539815456
1539915457 first = false;
....@@ -15435,12 +15493,12 @@
1543515493 for (int j = 0; j < group.children.size(); j++)
1543615494 {
1543715495 elem = (Object3D) group.children.elementAt(j);
15438
- object.editWindow.Select(elem.GetTreePath(), first, true);
15496
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1543915497 first = false;
1544015498 }
1544115499 } else
1544215500 {
15443
- object.editWindow.Select(elem.GetTreePath(), first, true);
15501
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1544415502 }
1544515503
1544615504 first = false;
....@@ -15451,21 +15509,21 @@
1545115509 {
1545215510 //Composite group = (Composite) object;
1545315511 Object3D group = object;
15454
- group.editWindow.loadClipboard(true); // ClearSelection(false);
15512
+ group.GetWindow().loadClipboard(true); // ClearSelection(false);
1545515513 }
1545615514
1545715515 void ResetTransform(int mask)
1545815516 {
1545915517 //Composite group = (Composite) object;
1546015518 Object3D group = object;
15461
- group.editWindow.ResetTransform(mask);
15519
+ group.GetWindow().ResetTransform(mask);
1546215520 }
1546315521
1546415522 void FlipTransform()
1546515523 {
1546615524 //Composite group = (Composite) object;
1546715525 Object3D group = object;
15468
- group.editWindow.FlipTransform();
15526
+ group.GetWindow().FlipTransform();
1546915527 // group.editWindow.ReduceMesh(true);
1547015528 }
1547115529
....@@ -15473,7 +15531,7 @@
1547315531 {
1547415532 //Composite group = (Composite) object;
1547515533 Object3D group = object;
15476
- group.editWindow.PrintMemory();
15534
+ group.GetWindow().PrintMemory();
1547715535 // group.editWindow.ReduceMesh(true);
1547815536 }
1547915537
....@@ -15481,7 +15539,7 @@
1548115539 {
1548215540 //Composite group = (Composite) object;
1548315541 Object3D group = object;
15484
- group.editWindow.ResetCentroid();
15542
+ group.GetWindow().ResetCentroid();
1548515543 }
1548615544
1548715545 void IncDepth()
....@@ -15657,6 +15715,7 @@
1565715715 info.bounds.y += (height - desired) / 2;
1565815716 }
1565915717 }
15718
+
1566015719 info.g = gr;
1566115720 info.camera = renderCamera;
1566215721 /*
....@@ -15666,23 +15725,44 @@
1566615725 */
1566715726 if (!isRenderer)
1566815727 {
15669
- object.drawEditHandles(info, 0);
15670
-
15671
- if (drag && (X != 0 || Y != 0) && object.selection.Size() > 0)
15728
+ Grafreed.Assert(object != null);
15729
+ Grafreed.Assert(object.selection != null);
15730
+ if (object.selection.Size() > 0)
1567215731 {
15673
- switch (object.selection.get(0).hitSomething)
15732
+ int hitSomething = object.selection.get(0).hitSomething;
15733
+
15734
+ info.DX = 0;
15735
+ info.DY = 0;
15736
+ info.W = 1;
15737
+ if (hitSomething == Object3D.hitCenter)
1567415738 {
15675
- case Object3D.hitCenter: gr.setColor(Color.pink);
15676
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15677
- break;
15678
- case Object3D.hitRotate: gr.setColor(Color.yellow);
15679
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15680
- break;
15681
- case Object3D.hitScale: gr.setColor(Color.cyan);
15682
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15683
- break;
15739
+ info.DX = X;
15740
+ if (X != 0)
15741
+ info.DX -= info.bounds.width/2;
15742
+
15743
+ info.DY = Y;
15744
+ if (Y != 0)
15745
+ info.DY -= info.bounds.height/2;
1568415746 }
15685
-
15747
+
15748
+ object.drawEditHandles(info, 0);
15749
+
15750
+ if (drag && (X != 0 || Y != 0))
15751
+ {
15752
+ switch (hitSomething)
15753
+ {
15754
+ case Object3D.hitCenter: gr.setColor(Color.pink);
15755
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15756
+ break;
15757
+ case Object3D.hitRotate: gr.setColor(Color.yellow);
15758
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15759
+ break;
15760
+ case Object3D.hitScale: gr.setColor(Color.cyan);
15761
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15762
+ break;
15763
+ }
15764
+
15765
+ }
1568615766 }
1568715767 }
1568815768 }
....@@ -16385,16 +16465,16 @@
1638516465 cStatic.objectstack[materialdepth++] = checker;
1638616466 //System.out.println("material " + material);
1638716467 //Applet3D.tracein(this, selected);
16388
- vector2buffer = checker.projectedVertices;
16468
+ //vector2buffer = checker.projectedVertices;
1638916469
1639016470 //checker.GetMaterial().Draw(this, false); // true);
16391
- DrawMaterial(checker.GetMaterial(), false); // true);
16471
+ DrawMaterial(checker.GetMaterial(), false, checker.projectedVertices); // true);
1639216472
1639316473 materialdepth -= 1;
1639416474 if (materialdepth > 0)
1639516475 {
16396
- vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
16397
- DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
16476
+ //vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
16477
+ DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
1639816478 }
1639916479 //checker.GetMaterial().opacity = 1f;
1640016480 ////checker.GetMaterial().ambient = 1f;
....@@ -16480,6 +16560,14 @@
1648016560 }
1648116561 }
1648216562
16563
+ private Object3D GetFolder()
16564
+ {
16565
+ Object3D folder = object.GetWindow().copy;
16566
+ if (object.GetWindow().copy.selection.Size() > 0)
16567
+ folder = object.GetWindow().copy.selection.elementAt(0);
16568
+ return folder;
16569
+ }
16570
+
1648316571 class SelectBuffer implements GLEventListener
1648416572 {
1648516573
....@@ -16559,6 +16647,17 @@
1655916647
1656016648 //gl.glDisable(GL.GL_POLYGON_OFFSET_FILL);
1656116649
16650
+ if (PAINTMODE)
16651
+ {
16652
+ if (object.GetWindow().copy.selection.Size() > 0)
16653
+ {
16654
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
16655
+
16656
+ // Make what you paint not selectable.
16657
+ paintobj.ResetSelectable();
16658
+ }
16659
+ }
16660
+
1656216661 //int tmp = selection_view;
1656316662 //selection_view = -1;
1656416663 int temp = DrawMode();
....@@ -16570,6 +16669,17 @@
1657016669 // temp = DEFAULT; // patch for selection debug
1657116670 Globals.drawMode = temp; // WARNING
1657216671
16672
+ if (PAINTMODE)
16673
+ {
16674
+ if (object.GetWindow().copy.selection.Size() > 0)
16675
+ {
16676
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
16677
+
16678
+ // Revert.
16679
+ paintobj.RestoreSelectable();
16680
+ }
16681
+ }
16682
+
1657316683 //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view);
1657416684
1657516685 // trying different ways of getting the depth info over
....@@ -16617,6 +16727,8 @@
1661716727 // System.err.println("view = " + view[4] + " " + view[5] + " " + view[6] + " " + view[7]);
1661816728 // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]);
1661916729 // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]);
16730
+
16731
+ CreateSelectedPoint();
1662016732
1662116733 // Will fit the mesh !!!
1662216734 selectedpoint.toParent[0][0] = 0.0001;
....@@ -16671,29 +16783,31 @@
1667116783 }
1667216784
1667316785 if (!movingcamera && !PAINTMODE)
16674
- object.editWindow.ScreenFitPoint(); // fev 2014
16786
+ object.GetWindow().ScreenFitPoint(); // fev 2014
1667516787
16676
- if (PAINTMODE && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
16788
+ if (PAINTMODE) // && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
1667716789 {
16678
- Object3D paintobj = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
16790
+ //Object3D paintobj; // = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
1667916791
16680
- Object3D group = new Object3D("inst" + paintcount++);
16792
+ if (object.GetWindow().copy.selection.Size() > 0)
16793
+ {
16794
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
1668116795
16682
- group.CreateMaterial(); // use a void leaf to select instances
16683
-
16684
- group.add(paintobj); // link
16685
-
16686
- object.editWindow.SnapObject(group);
16687
-
16688
- Object3D folder = object.editWindow.copy;
16689
-
16690
- if (object.editWindow.copy.selection.Size() > 0)
16691
- folder = object.editWindow.copy.selection.elementAt(0);
16692
-
16693
- folder.add(group);
16694
-
16695
- object.editWindow.ResetModel();
16696
- object.editWindow.refreshContents();
16796
+ Object3D inst = new Object3D("inst" + paintcount++);
16797
+
16798
+ inst.CreateMaterial(); // use a void leaf to select instances
16799
+
16800
+ inst.add(paintobj); // link
16801
+
16802
+ object.GetWindow().SnapObject(inst);
16803
+
16804
+ Object3D folder = paintFolder; // GetFolder();
16805
+
16806
+ folder.add(inst);
16807
+
16808
+ object.GetWindow().ResetModel();
16809
+ object.GetWindow().refreshContents();
16810
+ }
1669716811 }
1669816812 else
1669916813 paintcount = 0;
....@@ -16732,6 +16846,11 @@
1673216846 //System.out.println("objects[color] = " + objects[color]);
1673316847 //objects[color].Select();
1673416848 indexcount = 0;
16849
+ ObjEditor window = object.GetWindow();
16850
+ if (window != null && deselect)
16851
+ {
16852
+ window.Select(null, deselect, true);
16853
+ }
1673516854 object.Select(color, deselect);
1673616855 }
1673716856