Normand Briere
2019-08-06 b3ae4e889872ca0b9ca76f1d17b2f0b961226729
Object3D.java
....@@ -22,13 +22,20 @@
2222 //static final long serialVersionUID = -607422624994562685L;
2323 static final long serialVersionUID = 5022536242724664900L;
2424
25
+ // Use GetUUID for backward compatibility with null.
2526 private UUID uuid = UUID.randomUUID();
2627
27
- // TEMPORARY for mocap undo
28
- mocap.reader.BVHReader.BVHResult bvh;
29
- Object3D skeleton;
28
+ // TEMPORARY for mocap undo. No need to be transient.
29
+ mocap.reader.BVHReader.BVHResult savebvh;
30
+ Object3D saveskeleton;
3031 //
3132
33
+ String skyboxname;
34
+ String skyboxext;
35
+
36
+ Object3D versionlist[];
37
+ int versionindex = -1;
38
+
3239 ScriptNode scriptnode;
3340
3441 void InitOthers()
....@@ -170,24 +177,35 @@
170177
171178 void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
172179 {
180
+ Object3D o;
181
+
173182 if (hashtable.containsKey(GetUUID()))
174183 {
175
- Object3D o = hashtable.get(GetUUID());
184
+ o = hashtable.get(GetUUID());
176185
177186 Grafreed.Assert(this.bRep == o.bRep);
178
- if (this.bRep != null)
179
- assert(this.bRep.support == o.transientrep);
187
+ //if (this.bRep != null)
188
+ // assert(this.bRep.support == o.transientrep);
189
+ if (this.support != null)
190
+ assert(this.support.bRep == o.transientrep);
191
+ }
192
+ else
193
+ {
194
+ o = new Object3D("copy of " + this.name);
180195
181
- return;
196
+ hashtable.put(GetUUID(), o);
182197 }
183198
184
- Object3D o = new Object3D("copy of " + this.name);
185
-
186
- hashtable.put(GetUUID(), o);
187
-
188
- for (int i=0; i<Size(); i++)
199
+ if (!blockloop)
189200 {
190
- get(i).ExtractBigData(hashtable);
201
+ blockloop = true;
202
+
203
+ for (int i=0; i<Size(); i++)
204
+ {
205
+ get(i).ExtractBigData(hashtable);
206
+ }
207
+
208
+ blockloop = false;
191209 }
192210
193211 ExtractBigData(o);
....@@ -195,11 +213,26 @@
195213
196214 void ExtractBigData(Object3D o)
197215 {
216
+ if (o.bRep != null)
217
+ Grafreed.Assert(o.bRep == this.bRep);
218
+
198219 o.bRep = this.bRep;
199
- if (this.bRep != null)
220
+// July 2019 if (this.bRep != null)
221
+// {
222
+// o.transientrep = this.bRep.support;
223
+// o.bRep.support = null;
224
+// }
225
+ o.selection = this.selection;
226
+ o.versionlist = this.versionlist;
227
+ o.versionindex = this.versionindex;
228
+
229
+ if (this.support != null)
200230 {
201
- o.transientrep = this.bRep.support;
202
- o.bRep.support = null;
231
+ if (o.transientrep != null)
232
+ Grafreed.Assert(o.transientrep == this.support.bRep);
233
+
234
+ o.transientrep = this.support.bRep;
235
+ this.support.bRep = null;
203236 }
204237
205238 // o.support = this.support;
....@@ -214,19 +247,42 @@
214247 // this.fileparent = null;
215248 }
216249
250
+// Object3D GetObject(java.util.UUID uuid)
251
+// {
252
+// if (this.uuid.equals(uuid))
253
+// return this;
254
+//
255
+// if (blockloop)
256
+// return null;
257
+//
258
+// blockloop = true;
259
+//
260
+// for (int i=0; i<Size(); i++)
261
+// {
262
+// Object3D o = get(i).GetObject(uuid);
263
+//
264
+// if (o != null)
265
+// return o;
266
+// }
267
+//
268
+// blockloop = false;
269
+//
270
+// return null;
271
+// }
272
+
217273 void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
218274 {
219275 if (!hashtable.containsKey(GetUUID()))
220276 return;
221277
278
+ Object3D o = hashtable.get(GetUUID());
279
+
280
+ RestoreBigData(o);
281
+
222282 if (blockloop)
223283 return;
224284
225285 blockloop = true;
226
-
227
- Object3D o = hashtable.get(GetUUID());
228
-
229
- RestoreBigData(o);
230286
231287 //hashtable.remove(GetUUID());
232288
....@@ -241,8 +297,17 @@
241297 void RestoreBigData(Object3D o)
242298 {
243299 this.bRep = o.bRep;
244
- if (this.bRep != null)
245
- this.bRep.support = o.transientrep;
300
+ if (this.support != null && o.transientrep != null)
301
+ {
302
+ this.support.bRep = o.transientrep;
303
+ }
304
+
305
+ this.selection = o.selection;
306
+
307
+ this.versionlist = o.versionlist;
308
+ this.versionindex = o.versionindex;
309
+// July 2019 if (this.bRep != null)
310
+// this.bRep.support = o.transientrep;
246311 // this.support = o.support;
247312 // this.fileparent = o.fileparent;
248313 }
....@@ -388,6 +453,7 @@
388453 }
389454
390455 boolean live = false;
456
+ transient boolean keepdontselect;
391457 boolean dontselect = false;
392458 boolean hide = false;
393459 boolean link2master = false; // performs reset support/master at each frame
....@@ -973,6 +1039,9 @@
9731039 if (material == null || material.multiply)
9741040 return true;
9751041
1042
+ if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
1043
+ return false;
1044
+
9761045 // Transparent objects are dynamic because we have to sort the triangles.
9771046 return material.opacity > 0.99;
9781047 }
....@@ -1374,6 +1443,7 @@
13741443 toParent = LA.newMatrix();
13751444 fromParent = LA.newMatrix();
13761445 }
1446
+
13771447 LA.matCopy(other.toParent, toParent);
13781448 LA.matCopy(other.fromParent, fromParent);
13791449
....@@ -2527,7 +2597,8 @@
25272597 private static final int editSelf = 1;
25282598 private static final int editChild = 2;
25292599
2530
- void drawEditHandles(ClickInfo info, int level)
2600
+ void drawEditHandles(//ClickInfo info,
2601
+ int level)
25312602 {
25322603 if (level == 0)
25332604 {
....@@ -2535,7 +2606,8 @@
25352606 return;
25362607
25372608 Object3D selectee;
2538
- for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(info, level + 1))
2609
+ for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(//info,
2610
+ level + 1))
25392611 {
25402612 selectee = (Object3D) e.nextElement();
25412613 }
....@@ -2543,19 +2615,22 @@
25432615 } else
25442616 {
25452617 //super.
2546
- drawEditHandles0(info, level + 1);
2618
+ drawEditHandles0(//info,
2619
+ level + 1);
25472620 }
25482621 }
25492622
2550
- boolean doEditClick(ClickInfo info, int level)
2623
+ boolean doEditClick(//ClickInfo info,
2624
+ int level)
25512625 {
25522626 doSomething = 0;
25532627 if (level == 0)
25542628 {
2555
- return doParentClick(info);
2629
+ return doParentClick(); //info);
25562630 }
25572631 if (//super.
2558
- doEditClick0(info, level))
2632
+ doEditClick0(//info,
2633
+ level))
25592634 {
25602635 doSomething = 1;
25612636 return true;
....@@ -2565,7 +2640,7 @@
25652640 }
25662641 }
25672642
2568
- boolean doParentClick(ClickInfo info)
2643
+ boolean doParentClick() //ClickInfo info)
25692644 {
25702645 if (selection == null)
25712646 {
....@@ -2578,7 +2653,8 @@
25782653 for (java.util.Enumeration e = selection.elements(); e.hasMoreElements();)
25792654 {
25802655 Object3D selectee = (Object3D) e.nextElement();
2581
- if (selectee.doEditClick(info, 1))
2656
+ if (selectee.doEditClick(//info,
2657
+ 1))
25822658 {
25832659 childToDrag = selectee;
25842660 doSomething = 2;
....@@ -2590,13 +2666,15 @@
25902666 return retval;
25912667 }
25922668
2593
- void doEditDrag(ClickInfo info, boolean opposite)
2669
+ void doEditDrag(//ClickInfo clickInfo,
2670
+ boolean opposite)
25942671 {
25952672 switch (doSomething)
25962673 {
25972674 case 1: // '\001'
25982675 //super.
2599
- doEditDrag0(info, opposite);
2676
+ doEditDrag0(//clickInfo,
2677
+ opposite);
26002678 break;
26012679
26022680 case 2: // '\002'
....@@ -2609,11 +2687,13 @@
26092687 {
26102688 //sel.hitSomething = childToDrag.hitSomething;
26112689 //childToDrag.doEditDrag(info);
2612
- sel.doEditDrag(info, opposite);
2690
+ sel.doEditDrag(//clickInfo,
2691
+ opposite);
26132692 } else
26142693 {
26152694 //super.
2616
- doEditDrag0(info, opposite);
2695
+ doEditDrag0(//clickInfo,
2696
+ opposite);
26172697 }
26182698 }
26192699 break;
....@@ -2631,6 +2711,9 @@
26312711 {
26322712 deselectAll();
26332713 }
2714
+
2715
+ new Exception().printStackTrace();
2716
+
26342717 ClickInfo newInfo = new ClickInfo();
26352718 newInfo.flags = info.flags;
26362719 newInfo.bounds = info.bounds;
....@@ -3078,7 +3161,7 @@
30783161 {
30793162 if (bRep != null)
30803163 {
3081
- bRep.GenerateNormalsMINE();
3164
+ bRep.MergeNormals(); //.GenerateNormalsMINE();
30823165 Touch();
30833166 }
30843167 }
....@@ -5381,6 +5464,51 @@
53815464 blockloop = false;
53825465 }
53835466
5467
+ void ResetSelectable()
5468
+ {
5469
+ if (blockloop)
5470
+ return;
5471
+
5472
+ blockloop = true;
5473
+
5474
+ keepdontselect = dontselect;
5475
+ dontselect = true;
5476
+
5477
+ Object3D child;
5478
+ int nb = Size();
5479
+ for (int i = 0; i < nb; i++)
5480
+ {
5481
+ child = (Object3D) get(i);
5482
+ if (child == null)
5483
+ continue;
5484
+ child.ResetSelectable();
5485
+ }
5486
+
5487
+ blockloop = false;
5488
+ }
5489
+
5490
+ void RestoreSelectable()
5491
+ {
5492
+ if (blockloop)
5493
+ return;
5494
+
5495
+ blockloop = true;
5496
+
5497
+ dontselect = keepdontselect;
5498
+
5499
+ Object3D child;
5500
+ int nb = Size();
5501
+ for (int i = 0; i < nb; i++)
5502
+ {
5503
+ child = (Object3D) get(i);
5504
+ if (child == null)
5505
+ continue;
5506
+ child.RestoreSelectable();
5507
+ }
5508
+
5509
+ blockloop = false;
5510
+ }
5511
+
53845512 boolean IsSelected()
53855513 {
53865514 if (parent == null)
....@@ -5690,6 +5818,38 @@
56905818 }
56915819 }
56925820
5821
+ void EmbedTextures(boolean embed)
5822
+ {
5823
+ if (blockloop)
5824
+ return;
5825
+
5826
+ //if (GetTextures() != null)
5827
+ if (embed)
5828
+ CameraPane.EmbedTextures(GetTextures());
5829
+ else
5830
+ {
5831
+ GetTextures().pigmentdata = null;
5832
+ GetTextures().bumpdata = null;
5833
+ GetTextures().pw = 0;
5834
+ GetTextures().ph = 0;
5835
+ GetTextures().bw = 0;
5836
+ GetTextures().bh = 0;
5837
+ }
5838
+
5839
+ int nb = Size();
5840
+ for (int i = 0; i < nb; i++)
5841
+ {
5842
+ Object3D child = (Object3D) get(i);
5843
+
5844
+ if (child == null)
5845
+ continue;
5846
+
5847
+ blockloop = true;
5848
+ child.EmbedTextures(embed);
5849
+ blockloop = false;
5850
+ }
5851
+ }
5852
+
56935853 void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
56945854 {
56955855 Draw(display, root, selected, blocked);
....@@ -5776,8 +5936,10 @@
57765936 if (support != null)
57775937 support = support;
57785938
5779
- //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5780
- boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5939
+ boolean usecalllists = !IsLive() && IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5940
+ //boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5941
+
5942
+ //usecalllists &= display.DrawMode() == display.DEFAULT; // Don't compute list in shadow pass.
57815943
57825944 if (!usecalllists && bRep != null && bRep.displaylist > 0)
57835945 {
....@@ -5787,8 +5949,9 @@
57875949 // usecalllists &= !(parent instanceof RandomNode);
57885950 // usecalllists = false;
57895951
5790
- if (GetBRep() != null)
5791
- usecalllists = usecalllists;
5952
+ if (display.DrawMode() == display.SHADOW)
5953
+ //GetBRep() != null)
5954
+ usecalllists = !!usecalllists;
57925955 //System.out.println("draw " + this);
57935956 //new Exception().printStackTrace();
57945957
....@@ -5810,7 +5973,7 @@
58105973 if (!(this instanceof Composite))
58115974 touched = false;
58125975 //if (displaylist == -1 && usecalllists)
5813
- if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
5976
+ if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013
58145977 {
58155978 bRep.displaylist = display.GenList();
58165979 assert(bRep.displaylist != 0);
....@@ -5821,7 +5984,7 @@
58215984
58225985 //System.out.println("\tnew list " + list);
58235986 //gl.glDrawBuffer(gl.GL_NONE);
5824
- if (usecalllists)
5987
+ if (usecalllists && bRep.displaylist > 0)
58255988 {
58265989 // System.err.println("new list " + bRep.displaylist + " for " + this);
58275990 display.NewList(bRep.displaylist);
....@@ -5830,7 +5993,7 @@
58305993 CallList(display, root, selected, blocked);
58315994
58325995 // compiled = true;
5833
- if (usecalllists)
5996
+ if (usecalllists && bRep.displaylist > 0)
58345997 {
58355998 // System.err.println("end list " + bRep.displaylist + " for " + this);
58365999 display.EndList();
....@@ -7181,20 +7344,23 @@
71817344 }
71827345 }
71837346
7184
- protected void calcHotSpot(cVector in, ClickInfo info, Point outPt, Rectangle outRec)
7347
+ static ClickInfo clickInfo = new ClickInfo();
7348
+
7349
+ protected void calcHotSpot(cVector in, //ClickInfo clickInfo,
7350
+ Point outPt, Rectangle outRec)
71857351 {
7186
- int hc = info.bounds.x + info.bounds.width / 2;
7187
- int vc = info.bounds.y + info.bounds.height / 2;
7188
- double[][] toscreen = info.toScreen;
7352
+ int hc = clickInfo.bounds.x + clickInfo.bounds.width / 2;
7353
+ int vc = clickInfo.bounds.y + clickInfo.bounds.height / 2;
7354
+ double[][] toscreen = clickInfo.toScreen;
71897355 if (toscreen == null)
71907356 {
7191
- toscreen = new Camera(info.camera.viewCode).toScreen;
7357
+ toscreen = new Camera(clickInfo.camera.viewCode).toScreen;
71927358 }
71937359 cVector vec = in;
71947360 LA.xformPos(in, toscreen, in);
71957361 //System.out.println("Distance = " + info.camera.Distance());
7196
- vec.x *= 100 * info.camera.SCALE / info.camera.Distance();
7197
- vec.y *= 100 * info.camera.SCALE / info.camera.Distance();
7362
+ vec.x *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
7363
+ vec.y *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
71987364 outPt.x = hc + (int) vec.x;
71997365 outPt.y = vc - (int) vec.y;
72007366 outRec.x = outPt.x - 3;
....@@ -7202,15 +7368,18 @@
72027368 outRec.width = outRec.height = 6;
72037369 }
72047370
7205
- protected Rectangle calcHotSpot(cVector in, ClickInfo info)
7371
+ protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo
7372
+ )
72067373 {
72077374 Point pt = new Point(0, 0);
72087375 Rectangle rec = new Rectangle();
7209
- calcHotSpot(in, info, pt, rec);
7376
+ calcHotSpot(in, //clickInfo,
7377
+ pt, rec);
72107378 return rec;
72117379 }
72127380
7213
- void drawEditHandles0(ClickInfo info, int level)
7381
+ void drawEditHandles0(//ClickInfo clickInfo,
7382
+ int level)
72147383 {
72157384 if (level == 0)
72167385 {
....@@ -7219,16 +7388,19 @@
72197388 {
72207389 cVector origin = new cVector();
72217390 //LA.xformPos(origin, toParent, origin);
7222
- Rectangle spot = calcHotSpot(origin, info);
7391
+ if (this.clickInfo == null)
7392
+ this.clickInfo = new ClickInfo();
7393
+
7394
+ Rectangle spot = calcHotSpot(origin); //, clickInfo);
72237395 Rectangle boundary = new Rectangle();
72247396 boundary.x = spot.x - 30;
72257397 boundary.y = spot.y - 30;
72267398 boundary.width = spot.width + 60;
72277399 boundary.height = spot.height + 60;
7228
- info.g.setColor(Color.red);
7400
+ clickInfo.g.setColor(Color.red);
72297401 int spotw = spot.x + spot.width;
72307402 int spoth = spot.y + spot.height;
7231
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7403
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
72327404 // if (CameraPane.Xmin > spot.x)
72337405 // {
72347406 // CameraPane.Xmin = spot.x;
....@@ -7248,8 +7420,8 @@
72487420 spot.translate(32, 32);
72497421 spotw = spot.x + spot.width;
72507422 spoth = spot.y + spot.height;
7251
- info.g.setColor(Color.cyan);
7252
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7423
+ clickInfo.g.setColor(Color.cyan);
7424
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
72537425 // if (CameraPane.Xmin > spot.x)
72547426 // {
72557427 // CameraPane.Xmin = spot.x;
....@@ -7269,9 +7441,9 @@
72697441 // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
72707442 //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
72717443 spot.translate(0, -32);
7272
- info.g.setColor(Color.yellow);
7273
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7274
- info.g.setColor(Color.green);
7444
+ clickInfo.g.setColor(Color.yellow);
7445
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7446
+ clickInfo.g.setColor(Color.green);
72757447 // if (CameraPane.Xmin > spot.x)
72767448 // {
72777449 // CameraPane.Xmin = spot.x;
....@@ -7288,8 +7460,8 @@
72887460 // {
72897461 // CameraPane.Ymax = spoth;
72907462 // }
7291
- info.g.drawArc(boundary.x + info.DX, boundary.y + info.DY,
7292
- (int)(boundary.width * info.W), (int)(boundary.height * info.W), 0, 360);
7463
+ clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY,
7464
+ (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360);
72937465 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
72947466 // if (CameraPane.Xmin > boundary.x)
72957467 // {
....@@ -7311,7 +7483,8 @@
73117483 }
73127484 }
73137485
7314
- boolean doEditClick0(ClickInfo info, int level)
7486
+ boolean doEditClick0(//ClickInfo clickInfo,
7487
+ int level)
73157488 {
73167489 if (level == 0)
73177490 {
....@@ -7320,8 +7493,8 @@
73207493
73217494 boolean retval = false;
73227495
7323
- startX = info.x;
7324
- startY = info.y;
7496
+ startX = clickInfo.x;
7497
+ startY = clickInfo.y;
73257498
73267499 hitSomething = -1;
73277500 cVector origin = new cVector();
....@@ -7331,22 +7504,51 @@
73317504 {
73327505 centerPt = new Point(0, 0);
73337506 }
7334
- calcHotSpot(origin, info, centerPt, spot);
7335
- if (spot.contains(info.x, info.y))
7507
+ calcHotSpot(origin, //info,
7508
+ centerPt, spot);
7509
+ if (spot.contains(clickInfo.x, clickInfo.y))
73367510 {
73377511 hitSomething = hitCenter;
73387512 retval = true;
73397513 }
73407514 spot.translate(32, 0);
7341
- if (spot.contains(info.x, info.y))
7515
+ if (spot.contains(clickInfo.x, clickInfo.y))
73427516 {
73437517 hitSomething = hitRotate;
73447518 retval = true;
73457519 }
73467520 spot.translate(0, 32);
7347
- if (spot.contains(info.x, info.y))
7521
+ if (spot.contains(clickInfo.x, clickInfo.y))
73487522 {
73497523 hitSomething = hitScale;
7524
+
7525
+ double scale = 0.005f * clickInfo.camera.Distance();
7526
+ double hScale = (double) (clickInfo.x - centerPt.x) / 32;
7527
+ double sign = 1;
7528
+ if (hScale < 0)
7529
+ {
7530
+ sign = -1;
7531
+ }
7532
+ hScale = sign*Math.pow(sign*hScale, scale * 50);
7533
+ if (hScale < 0.01)
7534
+ {
7535
+ //hScale = 0.01;
7536
+ }
7537
+
7538
+ double vScale = (double) (clickInfo.y - centerPt.y) / 32;
7539
+ sign = 1;
7540
+ if (vScale < 0)
7541
+ {
7542
+ sign = -1;
7543
+ }
7544
+ vScale = sign*Math.pow(sign*vScale, scale * 50);
7545
+ if (vScale < 0.01)
7546
+ {
7547
+ //vScale = 0.01;
7548
+ }
7549
+
7550
+ clickInfo.scale = Math.sqrt(hScale*hScale + vScale*vScale);
7551
+
73507552 retval = true;
73517553 }
73527554
....@@ -7356,7 +7558,7 @@
73567558 }
73577559
73587560 //System.out.println("info.modifiers = " + info.modifiers);
7359
- modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META
7561
+ modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META
73607562 //System.out.println("modified = " + modified);
73617563 //new Exception().printStackTrace();
73627564 //viewCode = info.pane.renderCamera.viewCode;
....@@ -7384,7 +7586,8 @@
73847586 return true;
73857587 }
73867588
7387
- void doEditDrag0(ClickInfo info, boolean opposite)
7589
+ void doEditDrag0(//ClickInfo info,
7590
+ boolean opposite)
73887591 {
73897592 if (hitSomething == 0)
73907593 {
....@@ -7398,7 +7601,7 @@
73987601
73997602 //System.out.println("hitSomething = " + hitSomething);
74007603
7401
- double scale = 0.005f * info.camera.Distance();
7604
+ double scale = 0.005f * clickInfo.camera.Distance();
74027605
74037606 cVector xlate = new cVector();
74047607 //cVector xlate2 = new cVector();
....@@ -7432,8 +7635,8 @@
74327635 toParent[3][i] = xlate.get(i);
74337636 LA.matInvert(toParent, fromParent);
74347637 */
7435
- cVector delta = LA.newVector(0, 0, startY - info.y);
7436
- LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta);
7638
+ cVector delta = LA.newVector(0, 0, startY - clickInfo.y);
7639
+ LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta);
74377640
74387641 LA.matCopy(startMat, toParent);
74397642 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7442,7 +7645,7 @@
74427645 } else
74437646 {
74447647 //LA.xformDir(delta, info.camera.fromScreen, delta);
7445
- cVector up = new cVector(info.camera.up);
7648
+ cVector up = new cVector(clickInfo.camera.up);
74467649 cVector away = new cVector();
74477650 //cVector right2 = new cVector();
74487651 //LA.vecCross(up, cVector.Z, right);
....@@ -7459,19 +7662,19 @@
74597662 LA.xformDir(up, ClickInfo.matbuffer, up);
74607663 // if (!CameraPane.LOCALTRANSFORM)
74617664 LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up);
7462
- LA.xformDir(info.camera.away, ClickInfo.matbuffer, away);
7665
+ LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away);
74637666 // if (!CameraPane.LOCALTRANSFORM)
74647667 LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away);
74657668 //LA.vecCross(up, cVector.Z, right2);
74667669
7467
- cVector delta = LA.newVector(info.x - startX, startY - info.y, 0);
7670
+ cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0);
74687671
74697672 //System.out.println("DELTA0 = " + delta);
74707673 //System.out.println("AWAY = " + info.camera.away);
74717674 //System.out.println("UP = " + info.camera.up);
74727675 if (away.z > 0)
74737676 {
7474
- if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0)
7677
+ if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0)
74757678 {
74767679 delta.x = -delta.x;
74777680 } else
....@@ -7486,7 +7689,7 @@
74867689 //System.out.println("DELTA1 = " + delta);
74877690 LA.xformDir(delta, ClickInfo.matbuffer, delta);
74887691 //System.out.println("DELTA2 = " + delta);
7489
- LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta);
7692
+ LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta);
74907693 LA.matCopy(startMat, toParent);
74917694 //System.out.println("DELTA3 = " + delta);
74927695 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7496,8 +7699,8 @@
74967699 break;
74977700
74987701 case hitRotate: // rotate
7499
- int dx = info.x - centerPt.x;
7500
- int dy = -(info.y - centerPt.y);
7702
+ int dx = clickInfo.x - centerPt.x;
7703
+ int dy = -(clickInfo.y - centerPt.y);
75017704 double angle = (double) Math.atan2(dx, dy);
75027705 angle = -(1.570796 - angle);
75037706
....@@ -7520,7 +7723,7 @@
75207723 }
75217724 /**/
75227725
7523
- switch (info.pane.RenderCamera().viewCode)
7726
+ switch (clickInfo.pane.RenderCamera().viewCode)
75247727 {
75257728 case 1: // '\001'
75267729 LA.matZRotate(toParent, angle);
....@@ -7547,7 +7750,7 @@
75477750 break;
75487751
75497752 case hitScale: // scale
7550
- double hScale = (double) (info.x - centerPt.x) / 32;
7753
+ double hScale = (double) (clickInfo.x - centerPt.x) / 32;
75517754 double sign = 1;
75527755 if (hScale < 0)
75537756 {
....@@ -7559,7 +7762,7 @@
75597762 //hScale = 0.01;
75607763 }
75617764
7562
- double vScale = (double) (info.y - centerPt.y) / 32;
7765
+ double vScale = (double) (clickInfo.y - centerPt.y) / 32;
75637766 sign = 1;
75647767 if (vScale < 0)
75657768 {
....@@ -7570,6 +7773,7 @@
75707773 {
75717774 //vScale = 0.01;
75727775 }
7776
+
75737777 LA.matCopy(startMat, toParent);
75747778 /**/
75757779 for (int i = 0; i < 3; i++)
....@@ -7579,14 +7783,14 @@
75797783 }
75807784 /**/
75817785
7582
- double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2);
7786
+ double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale;
75837787
75847788 if (totalScale < 0.01)
75857789 {
75867790 totalScale = 0.01;
75877791 }
75887792
7589
- switch (info.pane.RenderCamera().viewCode)
7793
+ switch (clickInfo.pane.RenderCamera().viewCode)
75907794 {
75917795 case 3: // '\001'
75927796 if (modified || opposite)
....@@ -7653,7 +7857,7 @@
76537857 } // NEW ...
76547858
76557859
7656
- info.pane.repaint();
7860
+ clickInfo.pane.repaint();
76577861 }
76587862
76597863 boolean overflow = false;