Normand Briere
2019-07-22 c570e1e38f2ff8622a71f81436654bad01cfdd5b
Object3D.java
....@@ -24,6 +24,14 @@
2424
2525 private UUID uuid = UUID.randomUUID();
2626
27
+ // TEMPORARY for mocap undo. No need to be transient.
28
+ mocap.reader.BVHReader.BVHResult savebvh;
29
+ Object3D saveskeleton;
30
+ //
31
+
32
+ byte[] versions[];
33
+ int versionindex = -1;
34
+
2735 ScriptNode scriptnode;
2836
2937 void InitOthers()
....@@ -104,125 +112,178 @@
104112
105113 // transient boolean reduced; // for morph reduction
106114
107
-transient com.bulletphysics.linearmath.Transform cache; // for fast merge
108
-transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge
115
+ transient com.bulletphysics.linearmath.Transform cache; // for fast merge
116
+ transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge
109117
110
-transient Object3D transientsupport; // for cloning
111
-transient boolean transientlink2master;
118
+ transient Object3D transientsupport; // for cloning
119
+ transient boolean transientlink2master;
112120
113
-void SaveSupports()
114
-{
115
- if (blockloop)
116
- return;
117
-
118
- transientsupport = support;
119
- transientlink2master = link2master;
120
-
121
- support = null;
122
- link2master = false;
123
-
124
- if (bRep != null)
121
+ void SaveSupports()
125122 {
126
- bRep.SaveSupports();
123
+ if (blockloop)
124
+ return;
125
+
126
+ transientsupport = support;
127
+ transientlink2master = link2master;
128
+
129
+ support = null;
130
+ link2master = false;
131
+
132
+ if (bRep != null)
133
+ {
134
+ bRep.SaveSupports();
135
+ }
136
+
137
+ for (int i = 0; i < Size(); i++)
138
+ {
139
+ Object3D child = (Object3D) get(i);
140
+ if (child == null)
141
+ continue;
142
+ blockloop = true;
143
+ child.SaveSupports();
144
+ blockloop = false;
145
+ }
127146 }
128
-
129
- for (int i = 0; i < Size(); i++)
130
- {
131
- Object3D child = (Object3D) get(i);
132
- if (child == null)
133
- continue;
134
- blockloop = true;
135
- child.SaveSupports();
136
- blockloop = false;
137
- }
138
-}
139147
140
-void RestoreSupports()
141
-{
142
- if (blockloop)
143
- return;
148
+ void RestoreSupports()
149
+ {
150
+ if (blockloop)
151
+ return;
144152
145
- support = transientsupport;
146
- link2master = transientlink2master;
147
- transientsupport = null;
148
- transientlink2master = false;
149
-
150
- if (bRep != null)
151
- {
152
- bRep.RestoreSupports();
153
- }
154
-
155
- for (int i = 0; i < Size(); i++)
156
- {
157
- Object3D child = (Object3D) get(i);
158
- if (child == null)
159
- continue;
160
- blockloop = true;
161
- child.RestoreSupports();
162
- blockloop = false;
163
- }
164
-}
153
+ support = transientsupport;
154
+ link2master = transientlink2master;
155
+ transientsupport = null;
156
+ transientlink2master = false;
165157
166
-void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
167
-{
168
- if (hashtable.containsKey(GetUUID()))
158
+ if (bRep != null)
159
+ {
160
+ bRep.RestoreSupports();
161
+ }
162
+
163
+ for (int i = 0; i < Size(); i++)
164
+ {
165
+ Object3D child = (Object3D) get(i);
166
+ if (child == null)
167
+ continue;
168
+ blockloop = true;
169
+ child.RestoreSupports();
170
+ blockloop = false;
171
+ }
172
+ }
173
+
174
+ void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
169175 {
176
+ Object3D o;
177
+
178
+ if (hashtable.containsKey(GetUUID()))
179
+ {
180
+ o = hashtable.get(GetUUID());
181
+
182
+ Grafreed.Assert(this.bRep == o.bRep);
183
+ //if (this.bRep != null)
184
+ // assert(this.bRep.support == o.transientrep);
185
+ if (this.support != null)
186
+ assert(this.support.bRep == o.transientrep);
187
+ }
188
+ else
189
+ {
190
+ o = new Object3D("copy of " + this.name);
191
+
192
+ hashtable.put(GetUUID(), o);
193
+ }
194
+
195
+ if (!blockloop)
196
+ {
197
+ blockloop = true;
198
+
199
+ for (int i=0; i<Size(); i++)
200
+ {
201
+ get(i).ExtractBigData(hashtable);
202
+ }
203
+
204
+ blockloop = false;
205
+ }
206
+
207
+ ExtractBigData(o);
208
+ }
209
+
210
+ void ExtractBigData(Object3D o)
211
+ {
212
+ if (o.bRep != null)
213
+ Grafreed.Assert(o.bRep == this.bRep);
214
+
215
+ o.bRep = this.bRep;
216
+// July 2019 if (this.bRep != null)
217
+// {
218
+// o.transientrep = this.bRep.support;
219
+// o.bRep.support = null;
220
+// }
221
+ o.selection = this.selection;
222
+ o.versions = this.versions;
223
+ o.versionindex = this.versionindex;
224
+
225
+ if (this.support != null)
226
+ {
227
+ if (o.transientrep != null)
228
+ Grafreed.Assert(o.transientrep == this.support.bRep);
229
+
230
+ o.transientrep = this.support.bRep;
231
+ this.support.bRep = null;
232
+ }
233
+
234
+ // o.support = this.support;
235
+ // o.fileparent = this.fileparent;
236
+ // if (this.bRep != null)
237
+ // o.bRep = this.bRep.support;
238
+
239
+ this.bRep = null;
240
+ // if (this.bRep != null)
241
+ // this.bRep.support = null;
242
+ // this.support = null;
243
+ // this.fileparent = null;
244
+ }
245
+
246
+ void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
247
+ {
248
+ if (!hashtable.containsKey(GetUUID()))
249
+ return;
250
+
170251 Object3D o = hashtable.get(GetUUID());
171252
172
- assert(this.bRep == o.bRep);
173
- if (this.bRep != null)
174
- assert(this.bRep.support == o.transientrep);
175
-
176
- return;
177
- }
178
-
179
- Object3D o = new Object3D();
180
- o.bRep = this.bRep;
181
- if (this.bRep != null)
182
- {
183
- o.transientrep = this.bRep.support;
184
- o.bRep.support = null;
185
- }
186
-
187
-// o.support = this.support;
188
-// o.fileparent = this.fileparent;
189
-// if (this.bRep != null)
190
-// o.bRep = this.bRep.support;
191
-
192
- hashtable.put(GetUUID(), o);
193
-
194
- this.bRep = null;
195
-// if (this.bRep != null)
196
-// this.bRep.support = null;
197
-// this.support = null;
198
-// this.fileparent = null;
199
-
200
- for (int i=0; i<Size(); i++)
201
- {
202
- get(i).ExtractBigData(hashtable);
203
- }
204
-}
253
+ RestoreBigData(o);
205254
206
-void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
207
-{
208
- if (!hashtable.containsKey(GetUUID()))
209
- return;
210
-
211
- Object3D o = hashtable.get(GetUUID());
212
-
213
- this.bRep = o.bRep;
214
- if (this.bRep != null)
215
- this.bRep.support = o.transientrep;
216
-// this.support = o.support;
217
-// this.fileparent = o.fileparent;
218
-
219
- hashtable.remove(GetUUID());
220
-
221
- for (int i=0; i<Size(); i++)
222
- {
223
- get(i).RestoreBigData(hashtable);
255
+ if (blockloop)
256
+ return;
257
+
258
+ blockloop = true;
259
+
260
+ //hashtable.remove(GetUUID());
261
+
262
+ for (int i=0; i<Size(); i++)
263
+ {
264
+ get(i).RestoreBigData(hashtable);
265
+ }
266
+
267
+ blockloop = false;
224268 }
225
-}
269
+
270
+ void RestoreBigData(Object3D o)
271
+ {
272
+ this.bRep = o.bRep;
273
+ if (this.support != null && o.transientrep != null)
274
+ {
275
+ this.support.bRep = o.transientrep;
276
+ }
277
+
278
+ this.selection = o.selection;
279
+
280
+ this.versions = o.versions;
281
+ this.versionindex = o.versionindex;
282
+// July 2019 if (this.bRep != null)
283
+// this.bRep.support = o.transientrep;
284
+ // this.support = o.support;
285
+ // this.fileparent = o.fileparent;
286
+ }
226287
227288 // MOCAP SUPPORT
228289 double tx,ty,tz,rx,ry,rz;
....@@ -365,6 +426,7 @@
365426 }
366427
367428 boolean live = false;
429
+ transient boolean keepdontselect;
368430 boolean dontselect = false;
369431 boolean hide = false;
370432 boolean link2master = false; // performs reset support/master at each frame
....@@ -547,12 +609,14 @@
547609 toParent = LA.newMatrix();
548610 fromParent = LA.newMatrix();
549611 }
612
+
550613 if (toParentMarked == null)
551614 {
552615 if (maxcount != 1)
553616 {
554617 new Exception().printStackTrace();
555618 }
619
+
556620 toParentMarked = LA.newMatrix();
557621 fromParentMarked = LA.newMatrix();
558622 }
....@@ -863,7 +927,7 @@
863927
864928 if (marked && Globals.isLIVE() && live &&
865929 //TEMP21aug2018
866
- (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) &&
930
+ (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) &&
867931 currentframe != Globals.framecount)
868932 {
869933 currentframe = Globals.framecount;
....@@ -875,7 +939,8 @@
875939
876940 boolean changedir = random && Math.random() < 0.01; // && !link2master;
877941
878
- if (transformcount*factor > maxcount || (step == 1 && changedir))
942
+ if (transformcount*factor >= maxcount && (rewind || random) ||
943
+ (step == 1 && changedir))
879944 {
880945 countdown = 1;
881946 delay = speedup?8:1;
....@@ -947,6 +1012,7 @@
9471012 if (material == null || material.multiply)
9481013 return true;
9491014
1015
+ // Transparent objects are dynamic because we have to sort the triangles.
9501016 return material.opacity > 0.99;
9511017 }
9521018
....@@ -1347,6 +1413,7 @@
13471413 toParent = LA.newMatrix();
13481414 fromParent = LA.newMatrix();
13491415 }
1416
+
13501417 LA.matCopy(other.toParent, toParent);
13511418 LA.matCopy(other.fromParent, fromParent);
13521419
....@@ -2368,6 +2435,10 @@
23682435 }
23692436 */
23702437 }
2438
+ else
2439
+ {
2440
+ //((ObjEditor)editWindow).SetupUI2(null);
2441
+ }
23712442 }
23722443
23732444 void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root)
....@@ -2409,6 +2480,14 @@
24092480 {
24102481 editWindow.refreshContents();
24112482 }
2483
+ else
2484
+ {
2485
+ if (manipWindow != null)
2486
+ {
2487
+ manipWindow.refreshContents();
2488
+ }
2489
+ }
2490
+
24122491 //if (parent != null)
24132492 //parent.refreshEditWindow();
24142493 }
....@@ -2693,6 +2772,18 @@
26932772 //Touch();
26942773 }
26952774
2775
+ void GenNormalsMeshS()
2776
+ {
2777
+ selection.GenNormalsMesh();
2778
+// for (int i=0; i<selection.size(); i++)
2779
+// {
2780
+// Object3D selectee = (Object3D) selection.elementAt(i);
2781
+// selectee.GenNormals(crease);
2782
+// }
2783
+
2784
+ //Touch();
2785
+ }
2786
+
26962787 void ClearColorsS()
26972788 {
26982789 selection.ClearColors();
....@@ -2824,6 +2915,24 @@
28242915 if (child == null)
28252916 continue;
28262917 child.GenNormals(crease);
2918
+// Children().release(i);
2919
+ }
2920
+ blockloop = false;
2921
+ }
2922
+
2923
+ void GenNormalsMesh()
2924
+ {
2925
+ if (blockloop)
2926
+ return;
2927
+
2928
+ blockloop = true;
2929
+ GenNormalsMesh0();
2930
+ for (int i = 0; i < Children().Size(); i++)
2931
+ {
2932
+ Object3D child = (Object3D) Children().get(i); // reserve(i);
2933
+ if (child == null)
2934
+ continue;
2935
+ child.GenNormalsMesh();
28272936 // Children().release(i);
28282937 }
28292938 blockloop = false;
....@@ -2996,11 +3105,20 @@
29963105 }
29973106 }
29983107
3108
+ void GenNormalsMesh0()
3109
+ {
3110
+ if (bRep != null)
3111
+ {
3112
+ bRep.GenerateNormalsMesh();
3113
+ Touch();
3114
+ }
3115
+ }
3116
+
29993117 void GenNormalsMINE0()
30003118 {
30013119 if (bRep != null)
30023120 {
3003
- bRep.GenerateNormalsMINE();
3121
+ bRep.MergeNormals(); //.GenerateNormalsMINE();
30043122 Touch();
30053123 }
30063124 }
....@@ -3446,7 +3564,8 @@
34463564 if (blockloop)
34473565 return;
34483566
3449
- if (marked || (bRep != null && material != null)) // borderline...
3567
+ if (//marked || // does not make sense
3568
+ (bRep != null || material != null)) // borderline...
34503569 live = h;
34513570
34523571 for (int i = 0; i < Size(); i++)
....@@ -3467,7 +3586,8 @@
34673586 return;
34683587
34693588 //if (bRep != null)
3470
- if (marked || (bRep != null && material != null)) // borderline...
3589
+ if (//marked || // does not make sense
3590
+ (bRep != null || material != null)) // borderline...
34713591 link2master = h;
34723592
34733593 for (int i = 0; i < Size(); i++)
....@@ -3487,7 +3607,8 @@
34873607 if (blockloop)
34883608 return;
34893609
3490
- if (marked || (bRep != null && material != null)) // borderline...
3610
+ if (//marked || // does not make sense
3611
+ (bRep != null || material != null)) // borderline...
34913612 hide = h;
34923613
34933614 for (int i = 0; i < Size(); i++)
....@@ -3507,7 +3628,7 @@
35073628 if (blockloop)
35083629 return;
35093630
3510
- if (bRep != null && material != null) // borderline...
3631
+ if (bRep != null || material != null) // borderline...
35113632 marked = h;
35123633
35133634 for (int i = 0; i < Size(); i++)
....@@ -3517,6 +3638,46 @@
35173638 continue;
35183639 blockloop = true;
35193640 child.MarkLeaves(h);
3641
+ blockloop = false;
3642
+ // release(i);
3643
+ }
3644
+ }
3645
+
3646
+ void RewindLeaves(boolean h)
3647
+ {
3648
+ if (blockloop)
3649
+ return;
3650
+
3651
+ if (bRep != null || material != null) // borderline...
3652
+ rewind = h;
3653
+
3654
+ for (int i = 0; i < Size(); i++)
3655
+ {
3656
+ Object3D child = (Object3D) get(i); // reserve(i);
3657
+ if (child == null)
3658
+ continue;
3659
+ blockloop = true;
3660
+ child.RewindLeaves(h);
3661
+ blockloop = false;
3662
+ // release(i);
3663
+ }
3664
+ }
3665
+
3666
+ void RandomLeaves(boolean h)
3667
+ {
3668
+ if (blockloop)
3669
+ return;
3670
+
3671
+ if (bRep != null || material != null) // borderline...
3672
+ random = h;
3673
+
3674
+ for (int i = 0; i < Size(); i++)
3675
+ {
3676
+ Object3D child = (Object3D) get(i); // reserve(i);
3677
+ if (child == null)
3678
+ continue;
3679
+ blockloop = true;
3680
+ child.RandomLeaves(h);
35203681 blockloop = false;
35213682 // release(i);
35223683 }
....@@ -4294,6 +4455,55 @@
42944455 }
42954456 }
42964457
4458
+ void RepairSOV()
4459
+ {
4460
+ if (blockloop)
4461
+ return;
4462
+
4463
+ String texname = this.GetPigmentTexture();
4464
+
4465
+ if (texname.startsWith("sov"))
4466
+ {
4467
+ String[] s = texname.split("/");
4468
+
4469
+ String[] sname = s[1].split("Color.pn");
4470
+
4471
+ texname = sname[0];
4472
+
4473
+ if (sname.length > 1)
4474
+ {
4475
+ texname += "Color.jpg";
4476
+ }
4477
+
4478
+ this.SetPigmentTexture("sov/" + texname);
4479
+ }
4480
+
4481
+ texname = this.GetBumpTexture();
4482
+
4483
+ if (texname.startsWith("sov"))
4484
+ {
4485
+ String[] s = texname.split("/");
4486
+
4487
+ String[] sname = s[1].split("Bump.pn");
4488
+
4489
+ texname = sname[0];
4490
+
4491
+ if (sname.length > 1)
4492
+ {
4493
+ texname += "Bump.jpg";
4494
+ }
4495
+
4496
+ this.SetBumpTexture("sov/" + texname);
4497
+ }
4498
+
4499
+ for (int i=0; i<Size(); i++)
4500
+ {
4501
+ blockloop = true;
4502
+ get(i).RepairSOV();
4503
+ blockloop = false;
4504
+ }
4505
+ }
4506
+
42974507 void RepairTexture()
42984508 {
42994509 if (this instanceof FileObject || blockloop)
....@@ -4808,6 +5018,14 @@
48085018 }
48095019 }
48105020
5021
+ ObjEditor GetWindow()
5022
+ {
5023
+ if (editWindow != null)
5024
+ return editWindow;
5025
+
5026
+ return manipWindow;
5027
+ }
5028
+
48115029 cTreePath Select(int indexcount, boolean deselect)
48125030 {
48135031 if (hide || dontselect)
....@@ -4844,10 +5062,11 @@
48445062 if (leaf != null)
48455063 {
48465064 cTreePath tp = new cTreePath(this, leaf);
4847
- if (editWindow != null)
5065
+ ObjEditor window = GetWindow();
5066
+ if (window != null)
48485067 {
48495068 //System.out.println("editWindow = " + editWindow + " vs " + this);
4850
- editWindow.Select(tp, deselect, true);
5069
+ window.Select(tp, deselect, true);
48515070 }
48525071
48535072 return tp;
....@@ -4864,6 +5083,7 @@
48645083
48655084 if (child == null)
48665085 continue;
5086
+
48675087 if (child.HasTransparency() && child.size() != 0)
48685088 {
48695089 cTreePath leaf = child.Select(indexcount, deselect);
....@@ -4873,9 +5093,10 @@
48735093 if (leaf != null)
48745094 {
48755095 cTreePath tp = new cTreePath(this, leaf);
4876
- if (editWindow != null)
5096
+ ObjEditor window = GetWindow();
5097
+ if (window != null)
48775098 {
4878
- editWindow.Select(tp, deselect, true);
5099
+ window.Select(tp, deselect, true);
48795100 }
48805101
48815102 return tp;
....@@ -5200,6 +5421,51 @@
52005421 blockloop = false;
52015422 }
52025423
5424
+ void ResetSelectable()
5425
+ {
5426
+ if (blockloop)
5427
+ return;
5428
+
5429
+ blockloop = true;
5430
+
5431
+ keepdontselect = dontselect;
5432
+ dontselect = true;
5433
+
5434
+ Object3D child;
5435
+ int nb = Size();
5436
+ for (int i = 0; i < nb; i++)
5437
+ {
5438
+ child = (Object3D) get(i);
5439
+ if (child == null)
5440
+ continue;
5441
+ child.ResetSelectable();
5442
+ }
5443
+
5444
+ blockloop = false;
5445
+ }
5446
+
5447
+ void RestoreSelectable()
5448
+ {
5449
+ if (blockloop)
5450
+ return;
5451
+
5452
+ blockloop = true;
5453
+
5454
+ dontselect = keepdontselect;
5455
+
5456
+ Object3D child;
5457
+ int nb = Size();
5458
+ for (int i = 0; i < nb; i++)
5459
+ {
5460
+ child = (Object3D) get(i);
5461
+ if (child == null)
5462
+ continue;
5463
+ child.RestoreSelectable();
5464
+ }
5465
+
5466
+ blockloop = false;
5467
+ }
5468
+
52035469 boolean IsSelected()
52045470 {
52055471 if (parent == null)
....@@ -5509,6 +5775,38 @@
55095775 }
55105776 }
55115777
5778
+ void EmbedTextures(boolean embed)
5779
+ {
5780
+ if (blockloop)
5781
+ return;
5782
+
5783
+ //if (GetTextures() != null)
5784
+ if (embed)
5785
+ CameraPane.EmbedTextures(GetTextures());
5786
+ else
5787
+ {
5788
+ GetTextures().pigmentdata = null;
5789
+ GetTextures().bumpdata = null;
5790
+ GetTextures().pw = 0;
5791
+ GetTextures().ph = 0;
5792
+ GetTextures().bw = 0;
5793
+ GetTextures().bh = 0;
5794
+ }
5795
+
5796
+ int nb = Size();
5797
+ for (int i = 0; i < nb; i++)
5798
+ {
5799
+ Object3D child = (Object3D) get(i);
5800
+
5801
+ if (child == null)
5802
+ continue;
5803
+
5804
+ blockloop = true;
5805
+ child.EmbedTextures(embed);
5806
+ blockloop = false;
5807
+ }
5808
+ }
5809
+
55125810 void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
55135811 {
55145812 Draw(display, root, selected, blocked);
....@@ -5517,12 +5815,23 @@
55175815 boolean NeedSupport()
55185816 {
55195817 return
5520
- CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null
5818
+ CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null
55215819 // PROBLEM with CROWD!!
55225820 && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD);
55235821 }
55245822
55255823 static boolean DEBUG_SELECTION = false;
5824
+
5825
+ boolean IsLive()
5826
+ {
5827
+ if (live)
5828
+ return true;
5829
+
5830
+ if (parent == null)
5831
+ return false;
5832
+
5833
+ return parent.IsLive();
5834
+ }
55265835
55275836 void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
55285837 {
....@@ -5585,7 +5894,7 @@
55855894 support = support;
55865895
55875896 //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5588
- boolean usecalllists = false; // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5897
+ boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
55895898
55905899 if (!usecalllists && bRep != null && bRep.displaylist > 0)
55915900 {
....@@ -5605,10 +5914,12 @@
56055914 boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
56065915
56075916 if (!selectmode && //display.DrawMode() != display.SELECTION &&
5608
- (touched || (bRep != null && bRep.displaylist <= 0)))
5917
+ //(touched || (bRep != null && bRep.displaylist <= 0)))
5918
+ (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0)))
56095919 {
56105920 Globals.lighttouched = true;
56115921 } // all panes...
5922
+
56125923 //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW &&
56135924 if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW &&
56145925 (touched || (bRep != null && bRep.displaylist <= 0)))
....@@ -5736,6 +6047,7 @@
57366047 if (GetBRep() != null)
57376048 {
57386049 display.NextIndex();
6050
+
57396051 // vertex color conflict : gl.glCallList(list);
57406052 DrawNode(display, root, selected);
57416053 if (this instanceof BezierPatch)
....@@ -5776,16 +6088,27 @@
57766088 tex = GetTextures();
57776089 }
57786090
5779
- boolean failed = false;
6091
+ boolean failedPigment = false;
6092
+ boolean failedBump = false;
57806093
57816094 try
57826095 {
5783
- display.BindTextures(tex, texres);
6096
+ display.BindPigmentTexture(tex, texres);
57846097 }
57856098 catch (Exception e)
57866099 {
57876100 System.err.println("FAILED: " + this);
5788
- failed = true;
6101
+ failedPigment = true;
6102
+ }
6103
+
6104
+ try
6105
+ {
6106
+ display.BindBumpTexture(tex, texres);
6107
+ }
6108
+ catch (Exception e)
6109
+ {
6110
+ //System.err.println("FAILED: " + this);
6111
+ failedBump = true;
57896112 }
57906113
57916114 if (!compiled)
....@@ -5808,8 +6131,11 @@
58086131 }
58096132 }
58106133
5811
- if (!failed)
5812
- display.ReleaseTextures(tex);
6134
+ if (!failedBump)
6135
+ display.ReleaseBumpTexture(tex);
6136
+
6137
+ if (!failedPigment)
6138
+ display.ReleasePigmentTexture(tex);
58136139
58146140 display.PopMaterial(this, selected);
58156141 }
....@@ -6182,6 +6508,11 @@
61826508 // dec 2012
61836509 new Exception().printStackTrace();
61846510 return;
6511
+ }
6512
+
6513
+ if (dontselect)
6514
+ {
6515
+ //bRep.GenerateNormalsMINE();
61856516 }
61866517
61876518 display.DrawGeometry(bRep, flipV, selectmode);
....@@ -7034,7 +7365,7 @@
70347365 spot.translate(32, 32);
70357366 spotw = spot.x + spot.width;
70367367 spoth = spot.y + spot.height;
7037
- info.g.setColor(Color.blue);
7368
+ info.g.setColor(Color.cyan);
70387369 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
70397370 // if (CameraPane.Xmin > spot.x)
70407371 // {
....@@ -7052,11 +7383,12 @@
70527383 // {
70537384 // CameraPane.Ymax = spoth;
70547385 // }
7055
- // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - 15);
7056
- //info.g.drawLine(spotw, spoth, spotw - 15, spoth);
7386
+ // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
7387
+ //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
70577388 spot.translate(0, -32);
7058
- info.g.setColor(Color.green);
7389
+ info.g.setColor(Color.yellow);
70597390 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7391
+ info.g.setColor(Color.green);
70607392 // if (CameraPane.Xmin > spot.x)
70617393 // {
70627394 // CameraPane.Xmin = spot.x;
....@@ -7073,8 +7405,8 @@
70737405 // {
70747406 // CameraPane.Ymax = spoth;
70757407 // }
7076
- info.g.drawArc(boundary.x, boundary.y,
7077
- boundary.width, boundary.height, 0, 360);
7408
+ info.g.drawArc(boundary.x + info.DX, boundary.y + info.DY,
7409
+ (int)(boundary.width * info.W), (int)(boundary.height * info.W), 0, 360);
70787410 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
70797411 // if (CameraPane.Xmin > boundary.x)
70807412 // {
....@@ -7374,19 +7706,20 @@
73747706 switch (info.pane.RenderCamera().viewCode)
73757707 {
73767708 case 3: // '\001'
7377
- if (modified)
7709
+ if (modified || opposite)
73787710 {
73797711 //LA.matScale(toParent, 1, hScale, vScale);
73807712 LA.matScale(toParent, totalScale, 1, 1);
73817713 } // vScale, 1);
73827714 else
73837715 {
7716
+ // EXCEPTION!
73847717 LA.matScale(toParent, totalScale, totalScale, totalScale);
73857718 } // vScale, 1);
73867719 break;
73877720
73887721 case 2: // '\002'
7389
- if (modified)
7722
+ if (modified || opposite)
73907723 {
73917724 //LA.matScale(toParent, hScale, 1, vScale);
73927725 LA.matScale(toParent, 1, totalScale, 1);
....@@ -7397,7 +7730,7 @@
73977730 break;
73987731
73997732 case 1: // '\003'
7400
- if (modified)
7733
+ if (modified || opposite)
74017734 {
74027735 //LA.matScale(toParent, hScale, vScale, 1);
74037736 LA.matScale(toParent, 1, 1, totalScale);
....@@ -7617,6 +7950,10 @@
76177950 editWindow = null;
76187951 } // ?
76197952 }
7953
+ else
7954
+ {
7955
+ //editWindow.closeUI();
7956
+ }
76207957 }
76217958
76227959 boolean root; // patch for edit windows
....@@ -7774,6 +8111,10 @@
77748111 }
77758112
77768113 transient ObjEditor editWindow;
8114
+ transient ObjEditor manipWindow;
8115
+
8116
+ transient boolean pinned;
8117
+
77778118 transient ObjectUI objectUI;
77788119 public static int povDepth = 0;
77798120 private static cVector tbMin = new cVector();