Normand Briere
2019-05-13 f924d3e00db476c06f55f3d5aaef307e17575340
Object3D.java
....@@ -797,7 +797,7 @@
797797
798798 if (marked && Globals.isLIVE() && live &&
799799 //TEMP21aug2018
800
- Globals.DrawMode() == iCameraPane.SHADOW &&
800
+ (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) &&
801801 currentframe != Globals.framecount)
802802 {
803803 currentframe = Globals.framecount;
....@@ -912,6 +912,11 @@
912912 fromParent = null; // LA.newMatrix();
913913 bRep = null; // new BoundaryRep();
914914
915
+ if (oname != null && oname.equals("LeftHand"))
916
+ {
917
+ name = oname;
918
+ }
919
+
915920 /*
916921 float hue = (float)Math.random();
917922 Color col;
....@@ -954,7 +959,7 @@
954959
955960 public Object clone()
956961 {
957
- return GrafreeD.clone(this);
962
+ return Grafreed.clone(this);
958963 }
959964
960965 Object3D copyExpand()
....@@ -1470,7 +1475,7 @@
14701475 BoundaryRep.SEUIL = other.material.cameralight;
14711476
14721477 // Set default to 0.1
1473
- BoundaryRep.SEUIL /= 2;
1478
+ BoundaryRep.SEUIL /= 4; // 2;
14741479 System.out.println("SEUIL = " + BoundaryRep.SEUIL);
14751480 }
14761481
....@@ -1729,7 +1734,7 @@
17291734 Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name);
17301735 o.bRep = transientrep;
17311736 if (clone)
1732
- o.bRep = (BoundaryRep) GrafreeD.clone(transientrep);
1737
+ o.bRep = (BoundaryRep) Grafreed.clone(transientrep);
17331738 o.CreateMaterial();
17341739 o.SetAttributes(this, -1);
17351740 //parent
....@@ -1742,7 +1747,7 @@
17421747 Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name);
17431748 o.bRep = bRep;
17441749 if (clone)
1745
- o.bRep = (BoundaryRep) GrafreeD.clone(bRep);
1750
+ o.bRep = (BoundaryRep) Grafreed.clone(bRep);
17461751 o.CreateMaterial();
17471752 //o.overwriteThis(this, -1);
17481753 o.SetAttributes(this, -1);
....@@ -2300,6 +2305,7 @@
23002305 {
23012306 if (newWindow)
23022307 {
2308
+ new Exception().printStackTrace();
23032309 System.exit(0);
23042310 if (parent != null)
23052311 {
....@@ -2476,13 +2482,13 @@
24762482 return retval;
24772483 }
24782484
2479
- void doEditDrag(ClickInfo info)
2485
+ void doEditDrag(ClickInfo info, boolean opposite)
24802486 {
24812487 switch (doSomething)
24822488 {
24832489 case 1: // '\001'
24842490 //super.
2485
- doEditDrag0(info);
2491
+ doEditDrag0(info, opposite);
24862492 break;
24872493
24882494 case 2: // '\002'
....@@ -2495,11 +2501,11 @@
24952501 {
24962502 //sel.hitSomething = childToDrag.hitSomething;
24972503 //childToDrag.doEditDrag(info);
2498
- sel.doEditDrag(info);
2504
+ sel.doEditDrag(info, opposite);
24992505 } else
25002506 {
25012507 //super.
2502
- doEditDrag0(info);
2508
+ doEditDrag0(info, opposite);
25032509 }
25042510 }
25052511 break;
....@@ -2906,7 +2912,8 @@
29062912 {
29072913 if (bRep != null)
29082914 {
2909
- bRep.GenUV();
2915
+ bRep.GenUV(); //1);
2916
+ //bRep.UnfoldUV();
29102917 Touch();
29112918 }
29122919 }
....@@ -2981,6 +2988,31 @@
29812988 blockloop = false;
29822989 }
29832990
2991
+ void TransformChildren()
2992
+ {
2993
+ if (toParent != null)
2994
+ {
2995
+ for (int i=Size(); --i>=0;)
2996
+ {
2997
+ Object3D v = get(i);
2998
+
2999
+ if (v.toParent == null)
3000
+ {
3001
+ v.toParent = LA.newMatrix();
3002
+ v.fromParent = LA.newMatrix();
3003
+ }
3004
+
3005
+ LA.matConcat(v.toParent, toParent, v.toParent);
3006
+ LA.matConcat(fromParent, v.fromParent, v.fromParent);
3007
+ }
3008
+
3009
+ toParent = null; // LA.matIdentity(toParent);
3010
+ fromParent = null; // LA.matIdentity(fromParent);
3011
+
3012
+ Touch();
3013
+ }
3014
+ }
3015
+
29843016 void TransformGeometry()
29853017 {
29863018 Object3D obj = this;
....@@ -3202,7 +3234,7 @@
32023234
32033235 BoundaryRep sup = bRep.support;
32043236 bRep.support = null;
3205
- BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep);
3237
+ BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep);
32063238 // bRep.SplitInTwo(onlyone); // thread...
32073239 temprep.SplitInTwo(reduction34, onlyone);
32083240 bRep = temprep;
....@@ -3726,7 +3758,7 @@
37263758 if (child == null)
37273759 continue;
37283760
3729
- if (GrafreeD.RENDERME > 0)
3761
+ if (Grafreed.RENDERME > 0)
37303762 {
37313763 if (child instanceof Merge)
37323764 ((Merge)child).renderme();
....@@ -3877,7 +3909,7 @@
38773909 if (child == null)
38783910 continue;
38793911
3880
- if (GrafreeD.RENDERME > 0)
3912
+ if (Grafreed.RENDERME > 0)
38813913 {
38823914 if (child instanceof Merge)
38833915 ((Merge)child).renderme();
....@@ -4072,7 +4104,7 @@
40724104 if (child == null)
40734105 continue;
40744106
4075
- if (GrafreeD.RENDERME > 0)
4107
+ if (Grafreed.RENDERME > 0)
40764108 {
40774109 if (child instanceof Merge)
40784110 ((Merge)child).renderme();
....@@ -5157,10 +5189,34 @@
51575189
51585190 // System.out.println("Fullname = " + fullname);
51595191
5160
- if (fullname.name.indexOf(":") == -1)
5161
- return fullname.name;
5192
+ // Does not work on Windows due to C:
5193
+// if (fullname.name.indexOf(":") == -1)
5194
+// return fullname.name;
5195
+//
5196
+// return fullname.name.substring(0,fullname.name.indexOf(":"));
51625197
5163
- return fullname.name.substring(0,fullname.name.indexOf(":"));
5198
+ String[] split = fullname.name.split(":");
5199
+
5200
+ if (split.length == 0)
5201
+ {
5202
+ return "";
5203
+ }
5204
+
5205
+ if (split.length <= 2)
5206
+ {
5207
+ if (fullname.name.endsWith(":"))
5208
+ {
5209
+ // Windows
5210
+ return fullname.name.substring(0, fullname.name.length()-1);
5211
+ }
5212
+
5213
+ return split[0];
5214
+ }
5215
+
5216
+ // Windows
5217
+ assert(split.length == 4);
5218
+
5219
+ return split[0] + ":" + split[1];
51645220 }
51655221
51665222 static String GetBump(cTexture fullname)
....@@ -5169,10 +5225,38 @@
51695225 return "";
51705226
51715227 // System.out.println("Fullname = " + fullname);
5172
- if (fullname.name.indexOf(":") == -1)
5173
- return "";
5174
-
5175
- return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length());
5228
+ // Does not work on Windows due to C:
5229
+// if (fullname.name.indexOf(":") == -1)
5230
+// return "";
5231
+//
5232
+// return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length());
5233
+ String[] split = fullname.name.split(":");
5234
+
5235
+ if (split.length == 0)
5236
+ {
5237
+ return "";
5238
+ }
5239
+
5240
+ if (split.length == 1)
5241
+ {
5242
+ return "";
5243
+ }
5244
+
5245
+ if (split.length == 2)
5246
+ {
5247
+ if (fullname.name.endsWith(":"))
5248
+ {
5249
+ // Windows
5250
+ return "";
5251
+ }
5252
+
5253
+ return split[1];
5254
+ }
5255
+
5256
+ // Windows
5257
+ assert(split.length == 4);
5258
+
5259
+ return split[2] + ":" + split[3];
51765260 }
51775261
51785262 String GetPigmentTexture()
....@@ -5246,7 +5330,7 @@
52465330 System.out.print("; textures = " + textures);
52475331 System.out.println("; usedtextures = " + usedtextures);
52485332
5249
- if (GetTextures() == null)
5333
+ if (GetTextures() == null) // What is that??
52505334 GetTextures().name = ":";
52515335
52525336 String texname = tex;
....@@ -5325,7 +5409,7 @@
53255409 return
53265410 CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null
53275411 // PROBLEM with CROWD!!
5328
- && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD);
5412
+ && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD);
53295413 }
53305414
53315415 static boolean DEBUG_SELECTION = false;
....@@ -5898,6 +5982,7 @@
58985982 return;
58995983 }
59005984
5985
+ //bRep.GenUV(1/material.diffuseness);
59015986 // bRep.lock = true;
59025987
59035988 //javax.media.opengl.GL gl = display.GetGL();
....@@ -6929,7 +7014,7 @@
69297014 }
69307015
69317016 //System.out.println("info.modifiers = " + info.modifiers);
6932
- modified = (info.modifiers & CameraPane.META) != 0;
7017
+ modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META
69337018 //System.out.println("modified = " + modified);
69347019 //new Exception().printStackTrace();
69357020 //viewCode = info.pane.renderCamera.viewCode;
....@@ -6957,7 +7042,7 @@
69577042 return true;
69587043 }
69597044
6960
- void doEditDrag0(ClickInfo info)
7045
+ void doEditDrag0(ClickInfo info, boolean opposite)
69617046 {
69627047 if (hitSomething == 0)
69637048 {
....@@ -6984,7 +7069,7 @@
69847069
69857070 scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance();
69867071
6987
- if (modified)
7072
+ if (modified || opposite)
69887073 {
69897074 //assert(false);
69907075 /*
....@@ -7078,6 +7163,7 @@
70787163
70797164 if (modified)
70807165 {
7166
+ // Rotate 90 degrees
70817167 angle /= (Math.PI / 4);
70827168 angle = Math.floor(angle + 0.5);
70837169 angle *= (Math.PI / 4);
....@@ -7312,14 +7398,22 @@
73127398 //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")";
73137399 //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString();
73147400 //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString();
7401
+
7402
+ String objname;
7403
+
73157404 if (false) //parent != null)
73167405 {
7317
- return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")";
7406
+ objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")";
73187407 } else
73197408 {
7320
- return GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ") ")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ +System.identityHashCode(this);
7409
+ objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ "";
73217410 } // + super.toString();
73227411 //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName();
7412
+
7413
+ if (!Globals.ADVANCED)
7414
+ return objname;
7415
+
7416
+ return objname + " " + System.identityHashCode(this);
73237417 }
73247418
73257419 public int hashCode()
....@@ -7375,6 +7469,7 @@
73757469 objectUI.closeUI();
73767470 if (editWindow != null)
73777471 {
7472
+ editWindow.ctrlPanel.FlushUI();
73787473 editWindow.refreshContents();
73797474 } // ? new
73807475 objectUI = null;
....@@ -7510,7 +7605,7 @@
75107605 {
75117606 assert(bRep != null);
75127607 if (!(support instanceof GenericJoint)) // support.bRep != null)
7513
- GrafreeD.Assert(support.bRep == bRep.support);
7608
+ Grafreed.Assert(support.bRep == bRep.support);
75147609 }
75157610 else
75167611 {