1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
|
/* */ package NET.worlds.scape;
/* */
/* */ import NET.worlds.console.Console;
/* */ import NET.worlds.console.Main;
/* */ import java.io.IOException;
/* */ import java.io.PrintStream;
/* */ import java.util.Vector;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class Transform
/* */ extends SuperRoot
/* */ {
/* */ static
/* */ {
/* 82 */ nativeInit();
/* */ }
/* */
/* */
/* */
/* */
/* */
/* 89 */ private static Vector<Transform> recycled = new Vector();
/* */ private int transformID;
/* */ private float xScale;
/* */ private float yScale;
/* */ private float zScale;
/* */
/* */ public static native void nativeInit();
/* */
/* 97 */ public static Transform make() { assert (Main.isMainThread());
/* */
/* 99 */ int last = recycled.size() - 1;
/* 100 */ if (last == -1) {
/* 101 */ return new Transform();
/* */ }
/* 103 */ Transform ret = (Transform)recycled.elementAt(last);
/* 104 */ recycled.removeElementAt(last);
/* */
/* 106 */ return ret;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public void recycle()
/* */ {
/* 117 */ if (recycled.size() < 100)
/* */ {
/* */
/* 120 */ makeIdentity();
/* */
/* 122 */ recycled.addElement(this);
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */ protected Transform()
/* */ {
/* 131 */ makeIdentity();
/* */ }
/* */
/* */
/* */ public native float getX();
/* */
/* */
/* */ public native float getY();
/* */
/* */
/* */ public native float getZ();
/* */
/* */ public Point3Temp getPosition()
/* */ {
/* 145 */ return Point3Temp.make(getX(), getY(), getZ());
/* */ }
/* */
/* */ public void setZ(float z) {
/* 149 */ moveTo(getX(), getY(), z);
/* */ }
/* */
/* */ public float getScaleX()
/* */ {
/* 154 */ return this.xScale;
/* */ }
/* */
/* */ public float getScaleY()
/* */ {
/* 159 */ return this.yScale;
/* */ }
/* */
/* */ public float getScaleZ()
/* */ {
/* 164 */ return this.zScale;
/* */ }
/* */
/* */ public Point3Temp getScale()
/* */ {
/* 169 */ return Point3Temp.make(getScaleX(), getScaleY(), getScaleZ());
/* */ }
/* */
/* */
/* */
/* */ public float getTotalScale()
/* */ {
/* 176 */ return (getScaleX() + getScaleY() + getScaleZ()) / 3.0F;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public native float getYaw();
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public native float getPitch();
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public native float getSpin(Point3Temp paramPoint3Temp);
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ protected void noteTransformChange() {}
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public Transform raise(float z)
/* */ {
/* 225 */ return moveBy(0.0F, 0.0F, z);
/* */ }
/* */
/* */ public Transform lower(float z)
/* */ {
/* 230 */ return moveBy(0.0F, 0.0F, -z);
/* */ }
/* */
/* */ public Transform yaw(float a)
/* */ {
/* 235 */ return spin(0.0F, 0.0F, 1.0F, a);
/* */ }
/* */
/* */ public Transform roll(float a)
/* */ {
/* 240 */ return spin(0.0F, 1.0F, 0.0F, a);
/* */ }
/* */
/* */ public Transform pitch(float a)
/* */ {
/* 245 */ return spin(1.0F, 0.0F, 0.0F, a);
/* */ }
/* */
/* */ public Transform scale(float s)
/* */ {
/* 250 */ return scale(s, s, s);
/* */ }
/* */
/* */ protected void finalize()
/* */ {
/* 255 */ nativeFinalize();
/* 256 */ super.finalize();
/* */ }
/* */
/* */
/* */
/* */
/* */ public native Transform pre(Transform paramTransform);
/* */
/* */
/* */
/* */
/* */ public Transform post(Transform t)
/* */ {
/* 269 */ Point3Temp v = t.getScale();
/* */
/* */
/* 272 */ if (!checkPostScale(v)) {
/* 273 */ return this;
/* */ }
/* */
/* 276 */ this.xScale *= v.x;
/* 277 */ this.yScale *= v.y;
/* 278 */ this.zScale *= v.z;
/* */
/* */
/* 281 */ return postHelper(t);
/* */ }
/* */
/* */ private boolean checkPostScale(Point3Temp v)
/* */ {
/* 286 */ if ((getSpin(Point3Temp.make()) == 0.0F) || ((v.x == v.y) && (v.y == v.z)))
/* 287 */ return true;
/* 288 */ Console.println(Console.message("non-uniform"));
/* 289 */ return false;
/* */ }
/* */
/* */
/* */
/* */
/* */ private native Transform postHelper(Transform paramTransform);
/* */
/* */
/* */
/* */
/* */ public native Transform makeIdentity();
/* */
/* */
/* */
/* */ public Transform moveBy(Point3Temp p)
/* */ {
/* 306 */ return moveBy(p.x, p.y, p.z);
/* */ }
/* */
/* */
/* */
/* */ public native Transform moveBy(float paramFloat1, float paramFloat2, float paramFloat3);
/* */
/* */
/* */
/* */ public Transform moveTo(Point3Temp p)
/* */ {
/* 317 */ return moveTo(p.x, p.y, p.z);
/* */ }
/* */
/* */
/* */
/* */ public native Transform moveTo(float paramFloat1, float paramFloat2, float paramFloat3);
/* */
/* */
/* */
/* */ public native Transform premoveBy(float paramFloat1, float paramFloat2, float paramFloat3);
/* */
/* */
/* */ public native Transform scale(float paramFloat1, float paramFloat2, float paramFloat3);
/* */
/* */
/* */ public Transform scale(Point3Temp s)
/* */ {
/* 334 */ return scale(s.x, s.y, s.z);
/* */ }
/* */
/* */ public void setScale(float x, float y, float z)
/* */ {
/* 339 */ scale(x / this.xScale, y / this.yScale, z / this.zScale);
/* */ }
/* */
/* */ public void setScale(Point3Temp s)
/* */ {
/* 344 */ setScale(s.x, s.y, s.z);
/* */ }
/* */
/* */ public Transform postscale(float x, float y, float z)
/* */ {
/* 349 */ return postscale(Point3Temp.make(x, y, z));
/* */ }
/* */
/* */
/* */ public Transform postscale(Point3Temp s)
/* */ {
/* 355 */ if (!checkPostScale(s)) {
/* 356 */ return this;
/* */ }
/* */
/* 359 */ this.xScale *= s.x;
/* 360 */ this.yScale *= s.y;
/* 361 */ this.zScale *= s.z;
/* */
/* */
/* */
/* 365 */ return postscaleHelper(s.x, s.y, s.z);
/* */ }
/* */
/* */
/* */
/* */
/* */ private native Transform postscaleHelper(float paramFloat1, float paramFloat2, float paramFloat3);
/* */
/* */
/* */
/* */
/* */ public Transform worldScale(float x, float y, float z)
/* */ {
/* 378 */ return worldScale(Point3Temp.make(x, y, z));
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public Transform worldScale(Point3Temp s)
/* */ {
/* 387 */ if (!checkPostScale(s)) {
/* 388 */ return this;
/* */ }
/* */
/* */
/* 392 */ return scale(s);
/* */ }
/* */
/* */
/* */ public native Transform spin(float paramFloat1, float paramFloat2, float paramFloat3, float paramFloat4);
/* */
/* */ public Transform spin(Point3Temp p, float a)
/* */ {
/* 400 */ return spin(p.x, p.y, p.z, a);
/* */ }
/* */
/* */ public Transform postspin(Point3Temp axis, float a)
/* */ {
/* 405 */ return postspin(axis.x, axis.y, axis.z, a);
/* */ }
/* */
/* */
/* */
/* */
/* */ public native Transform postspin(float paramFloat1, float paramFloat2, float paramFloat3, float paramFloat4);
/* */
/* */
/* */
/* */ public Transform worldSpin(float x, float y, float z, float a)
/* */ {
/* 417 */ return spin(worldVecToObjectVec(Point3Temp.make(x, y, z)), a);
/* */ }
/* */
/* */
/* */ private native void nativeFinalize();
/* */
/* */ public Transform getTransform()
/* */ {
/* 425 */ Transform t = make();
/* 426 */ t.setTransform(this);
/* 427 */ return t;
/* */ }
/* */
/* */
/* */
/* */
/* */ public native void setTransform(Transform paramTransform);
/* */
/* */
/* */
/* */ public native Transform invert();
/* */
/* */
/* */
/* */ public Transform getObjectToWorldMatrix()
/* */ {
/* 443 */ return getTransform();
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ private Point3Temp worldVecToObjectVec(Point3Temp worldVec)
/* */ {
/* 452 */ Transform inv = getObjectToWorldMatrix().invert();
/* 453 */ Point3Temp p = Point3Temp.make(worldVec).vectorTimes(inv)
/* 454 */ .times(getScale());
/* 455 */ inv.recycle();
/* 456 */ return p;
/* */ }
/* */
/* */
/* */
/* */
/* */ public Object properties(int index, int offset, int mode, Object value)
/* */ throws NoSuchPropertyException
/* */ {
/* 465 */ Object ret = null;
/* 466 */ switch (index - offset) {
/* */ case 0:
/* 468 */ if (mode == 0) {
/* 469 */ ret = TransformPropertyEditor.make(new Property(this, index,
/* 470 */ "Transform"));
/* 471 */ } else if (mode == 1) {
/* 472 */ ret = getTransform();
/* 473 */ } else if (mode == 2)
/* 474 */ setTransform((Transform)value);
/* 475 */ break;
/* */ default:
/* 477 */ ret = super.properties(index, offset + 1, mode, value);
/* */ }
/* 479 */ return ret;
/* */ }
/* */
/* 482 */ private static Object classCookie = new Object();
/* */
/* */
/* */
/* */
/* */ public void saveState(Saver s)
/* */ throws IOException
/* */ {
/* 490 */ s.saveVersion(2, classCookie);
/* 491 */ super.saveState(s);
/* 492 */ s.saveFloat(this.xScale);
/* 493 */ s.saveFloat(this.yScale);
/* 494 */ s.saveFloat(this.zScale);
/* 495 */ float[] guts = getGuts();
/* 496 */ for (int i = 0; i < 16; i++) {
/* 497 */ s.saveFloat(guts[i]);
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public void restoreState(Restorer r)
/* */ throws IOException, TooNewException
/* */ {
/* 508 */ switch (r.restoreVersion(classCookie)) {
/* */ case 2:
/* 510 */ super.restoreState(r);
/* 511 */ this.xScale = r.restoreFloat();
/* 512 */ this.yScale = r.restoreFloat();
/* 513 */ this.zScale = r.restoreFloat();
/* 514 */ float[] guts = new float[16];
/* 515 */ for (int i = 0; i < 16; i++)
/* 516 */ guts[i] = r.restoreFloat();
/* 517 */ setGuts(guts);
/* 518 */ break;
/* */
/* */ case 1:
/* 521 */ super.restoreState(r);
/* */ case 0:
/* 523 */ this.xScale = (this.yScale = this.zScale = r.restoreFloat());
/* 524 */ float[] guts = new float[16];
/* 525 */ for (int i = 0; i < 16; i++)
/* 526 */ guts[i] = r.restoreFloat();
/* 527 */ setGuts(guts);
/* 528 */ break;
/* */ default:
/* 530 */ throw new TooNewException();
/* */ }
/* */
/* */ }
/* */
/* */
/* */
/* */
/* */ private native float[] getGuts();
/* */
/* */
/* */
/* */
/* */ public native boolean isTransformEqual(Transform paramTransform);
/* */
/* */
/* */
/* */
/* */ private native void setGuts(float[] paramArrayOfFloat);
/* */
/* */
/* */
/* */
/* */ public String toTransformSubstring()
/* */ {
/* 555 */ Point3Temp axis = Point3Temp.make();
/* 556 */ float angle = getSpin(axis);
/* 557 */ Point3Temp pos = getPosition();
/* 558 */ if ((angle == 0.0F) && (this.xScale == 1.0F) && (this.yScale == 1.0F) && (this.zScale == 1.0F) &&
/* 559 */ (pos.x == 0.0F) && (pos.y == 0.0F) && (pos.z == 0.0F))
/* 560 */ return "[identity]";
/* 561 */ return
/* */
/* */
/* */
/* */
/* 566 */ "[pos (" + pos + "), scale (" + ((this.xScale == this.yScale) && (this.yScale == this.zScale) ? this.xScale : new StringBuilder().append(this.xScale).append(",").append(this.yScale).append(",").append(this.zScale).toString()) + "), rot (" + axis + "@" + angle + ")]";
/* */ }
/* */
/* */ public String toString()
/* */ {
/* 571 */ return getName() + toTransformSubstring();
/* */ }
/* */
/* */ public Transform printGuts()
/* */ {
/* 576 */ float[] arr = getGuts();
/* 577 */ assert (arr.length == 16);
/* 578 */ String[] strs = new String[16];
/* 579 */ int maxStr = 0;
/* 580 */ for (int i = 0; i < 16; i++) {
/* 581 */ strs[i] = Float.toString(arr[i]);
/* 582 */ maxStr = Math.max(maxStr, strs[i].length());
/* */ }
/* 584 */ for (int j = 0; j < 4; j++) {
/* 585 */ for (int k = 0; k < 4; k++) {
/* 586 */ String s = strs[(j * 4 + k)];
/* 587 */ int pad = maxStr - s.length() + 1;
/* 588 */ System.out.print(s);
/* 589 */ while (pad-- != 0)
/* 590 */ System.out.print(" ");
/* */ }
/* 592 */ System.out.println("");
/* */ }
/* 594 */ return this;
/* */ }
/* */ }
/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\Transform.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/
|