/* */ package com.sun.j3d.utils.universe;
/* */
/* */ import java.awt.GraphicsConfiguration;
/* */ import java.awt.Point;
/* */ import java.awt.Rectangle;
/* */ import java.io.PrintStream;
/* */ import java.text.DecimalFormat;
/* */ import java.text.FieldPosition;
/* */ import java.util.Collection;
/* */ import java.util.HashMap;
/* */ import java.util.HashSet;
/* */ import java.util.Iterator;
/* */ import java.util.LinkedList;
/* */ import java.util.List;
/* */ import java.util.Map;
/* */ import java.util.Set;
/* */ import javax.media.j3d.Canvas3D;
/* */ import javax.media.j3d.PhysicalBody;
/* */ import javax.media.j3d.PhysicalEnvironment;
/* */ import javax.media.j3d.Screen3D;
/* */ import javax.media.j3d.Sensor;
/* */ import javax.media.j3d.Transform3D;
/* */ import javax.media.j3d.View;
/* */ import javax.media.j3d.ViewPlatform;
/* */ import javax.vecmath.Point3d;
/* */ import javax.vecmath.Vector3d;
/* */
/* */ public class ViewInfo
/* */ {
/* */ private static final boolean verbose = false;
/* */ public static final int SCREEN_AUTO_UPDATE = 1;
/* */ public static final int CANVAS_AUTO_UPDATE = 2;
/* */ public static final int VIEW_AUTO_UPDATE = 4;
/* */ public static final int HEAD_AUTO_UPDATE = 8;
/* */ public static final int PLATFORM_AUTO_UPDATE = 16;
/* 230 */ private static Map staticVpMap = new HashMap();
/* 231 */ private static Map staticSiMap = new HashMap();
/* */
/* 233 */ private Map screenMap = null;
/* 234 */ private Map viewPlatformMap = null;
/* */
/* 237 */ private View view = null;
/* 238 */ private Sensor headTracker = null;
/* 239 */ private boolean useTracking = false;
/* 240 */ private boolean clipVirtual = false;
/* */
/* 243 */ private ViewPlatformInfo vpi = null;
/* 244 */ private int canvasCount = 0;
/* 245 */ private Map canvasMap = new HashMap();
/* 246 */ private CanvasInfo[] canvasInfo = new CanvasInfo[1];
/* */
/* 250 */ private boolean updateView = true;
/* 251 */ private boolean updateHead = true;
/* 252 */ private boolean autoUpdate = false;
/* 253 */ private int autoUpdateFlags = 0;
/* */
/* 256 */ private int viewPolicy = 0;
/* 257 */ private int resizePolicy = 1;
/* 258 */ private int movementPolicy = 1;
/* 259 */ private int eyePolicy = 2;
/* 260 */ private int projectionPolicy = 1;
/* 261 */ private int frontClipPolicy = 3;
/* 262 */ private int backClipPolicy = 3;
/* 263 */ private int scalePolicy = 0;
/* 264 */ private boolean coeCentering = true;
/* */
/* 268 */ private Transform3D coeToTrackerBase = null;
/* 269 */ private Transform3D headToHeadTracker = null;
/* */
/* 272 */ private Transform3D headTrackerToTrackerBase = null;
/* 273 */ private Transform3D trackerBaseToHeadTracker = null;
/* */
/* 276 */ private Transform3D headToTrackerBase = null;
/* 277 */ private Transform3D coeToHeadTracker = null;
/* */
/* 280 */ private PhysicalEnvironment env = null;
/* 281 */ private PhysicalBody body = null;
/* 282 */ private Point3d leftEyeInHead = new Point3d();
/* 283 */ private Point3d rightEyeInHead = new Point3d();
/* */
/* 287 */ private Vector3d v3d = new Vector3d();
/* 288 */ private double[] m16d = new double[16];
/* 289 */ private Point3d leftEye = new Point3d();
/* 290 */ private Point3d rightEye = new Point3d();
/* 291 */ private Map newMap = new HashMap();
/* 292 */ private Set newSet = new HashSet();
/* */
/* */ public ViewInfo(View view)
/* */ {
/* 317 */ this(view, 0);
/* */ }
/* */
/* */ public ViewInfo(View view, int autoUpdateFlags)
/* */ {
/* 338 */ this(view, autoUpdateFlags, staticSiMap, staticVpMap);
/* */ }
/* */
/* */ public ViewInfo(View view, int autoUpdateFlags, Map screenMap, Map viewPlatformMap)
/* */ {
/* 379 */ if (view == null)
/* 380 */ throw new IllegalArgumentException("View is null");
/* 381 */ if (screenMap == null)
/* 382 */ throw new IllegalArgumentException("screenMap is null");
/* 383 */ if (viewPlatformMap == null) {
/* 384 */ throw new IllegalArgumentException("viewPlatformMap is null");
/* */ }
/* 386 */ this.view = view;
/* 387 */ this.screenMap = screenMap;
/* 388 */ this.viewPlatformMap = viewPlatformMap;
/* */
/* 390 */ if (autoUpdateFlags == 0) {
/* 391 */ this.autoUpdate = false;
/* */ }
/* */ else {
/* 394 */ this.autoUpdate = true;
/* 395 */ this.autoUpdateFlags = autoUpdateFlags;
/* */ }
/* */
/* 398 */ getViewInfo();
/* */ }
/* */
/* */ public void getImagePlateToViewPlatform(Canvas3D c3d, Transform3D ip2vpl, Transform3D ip2vpr)
/* */ {
/* 420 */ CanvasInfo ci = updateCache(c3d, "getImagePlateToViewPlatform", false);
/* */
/* 423 */ getImagePlateToViewPlatform(ci);
/* 424 */ ip2vpl.set(ci.plateToViewPlatform);
/* 425 */ if ((ci.useStereo) && (ip2vpr != null))
/* 426 */ ip2vpr.set(ci.rightPlateToViewPlatform);
/* */ }
/* */
/* */ private void getImagePlateToViewPlatform(CanvasInfo ci) {
/* 430 */ if (ci.updatePlateToViewPlatform)
/* */ {
/* 432 */ if (ci.plateToViewPlatform == null) {
/* 433 */ ci.plateToViewPlatform = new Transform3D();
/* */ }
/* 435 */ getCoexistenceToImagePlate(ci);
/* 436 */ getViewPlatformToCoexistence(ci);
/* */
/* 438 */ ci.plateToViewPlatform.mul(ci.coeToPlate, ci.viewPlatformToCoe);
/* 439 */ ci.plateToViewPlatform.invert();
/* */
/* 441 */ if (ci.useStereo) {
/* 442 */ if (ci.rightPlateToViewPlatform == null) {
/* 443 */ ci.rightPlateToViewPlatform = new Transform3D();
/* */ }
/* 445 */ ci.rightPlateToViewPlatform.mul(ci.coeToRightPlate, ci.viewPlatformToCoe);
/* */
/* 447 */ ci.rightPlateToViewPlatform.invert();
/* */ }
/* 449 */ ci.updatePlateToViewPlatform = false;
/* */ }
/* */ }
/* */
/* */ public void getImagePlateToVworld(Canvas3D c3d, Transform3D ip2vwl, Transform3D ip2vwr)
/* */ {
/* 476 */ CanvasInfo ci = updateCache(c3d, "getImagePlateToVworld", true);
/* 477 */ getImagePlateToVworld(ci);
/* 478 */ ip2vwl.set(ci.plateToVworld);
/* 479 */ if ((ci.useStereo) && (ip2vwr != null))
/* 480 */ ip2vwr.set(ci.rightPlateToVworld);
/* */ }
/* */
/* */ private void getImagePlateToVworld(CanvasInfo ci) {
/* 484 */ if (ci.updatePlateToVworld)
/* */ {
/* 486 */ if (ci.plateToVworld == null) {
/* 487 */ ci.plateToVworld = new Transform3D();
/* */ }
/* 489 */ getImagePlateToViewPlatform(ci);
/* 490 */ ci.plateToVworld.mul(this.vpi.viewPlatformToVworld, ci.plateToViewPlatform);
/* */
/* 493 */ if (ci.useStereo) {
/* 494 */ if (ci.rightPlateToVworld == null) {
/* 495 */ ci.rightPlateToVworld = new Transform3D();
/* */ }
/* 497 */ ci.rightPlateToVworld.mul(this.vpi.viewPlatformToVworld, ci.rightPlateToViewPlatform);
/* */ }
/* */
/* 500 */ ci.updatePlateToVworld = false;
/* */ }
/* */ }
/* */
/* */ public void getCoexistenceToImagePlate(Canvas3D c3d, Transform3D coe2ipl, Transform3D coe2ipr)
/* */ {
/* 539 */ CanvasInfo ci = updateCache(c3d, "getCoexistenceToImagePlate", false);
/* 540 */ getCoexistenceToImagePlate(ci);
/* 541 */ coe2ipl.set(ci.coeToPlate);
/* 542 */ if ((ci.useStereo) && (coe2ipr != null))
/* 543 */ coe2ipr.set(ci.coeToRightPlate);
/* */ }
/* */
/* */ private void getCoexistenceToImagePlate(CanvasInfo ci)
/* */ {
/* 554 */ if (ci.updateCoeToPlate)
/* */ {
/* 556 */ if (ci.coeToPlate == null) {
/* 557 */ ci.coeToPlate = new Transform3D();
/* 558 */ ci.coeToRightPlate = new Transform3D();
/* */ }
/* 560 */ if (this.viewPolicy == 1)
/* */ {
/* 564 */ ci.coeToPlate.mul(CanvasInfo.access$1200(ci).headTrackerToLeftPlate, this.coeToHeadTracker);
/* */
/* 566 */ if (ci.useStereo)
/* */ {
/* 569 */ ci.coeToRightPlate.mul(CanvasInfo.access$1200(ci).headTrackerToRightPlate, this.coeToHeadTracker);
/* */ }
/* */ else
/* 572 */ ci.coeToRightPlate.set(ci.coeToPlate);
/* */ }
/* 574 */ else if (this.coeCentering)
/* */ {
/* 577 */ if (this.movementPolicy == 1)
/* */ {
/* 579 */ this.v3d.set(ci.canvasX + ci.canvasWidth / 2.0D, ci.canvasY + ci.canvasHeight / 2.0D, 0.0D);
/* */ }
/* */ else
/* */ {
/* 583 */ this.v3d.set(CanvasInfo.access$1200(ci).screenWidth / 2.0D, CanvasInfo.access$1200(ci).screenHeight / 2.0D, 0.0D);
/* */ }
/* */
/* 586 */ ci.coeToPlate.set(this.v3d);
/* 587 */ ci.coeToRightPlate.set(this.v3d);
/* */ }
/* */ else
/* */ {
/* 593 */ ci.coeToPlate.mul(CanvasInfo.access$1200(ci).trackerBaseToPlate, this.coeToTrackerBase);
/* 594 */ ci.coeToRightPlate.set(ci.coeToPlate);
/* */ }
/* 596 */ ci.updateCoeToPlate = false;
/* */ }
/* */ }
/* */
/* */ public void getViewPlatformToCoexistence(Canvas3D c3d, Transform3D vp2coe)
/* */ {
/* 643 */ CanvasInfo ci = updateCache(c3d, "getViewPlatformToCoexistence", false);
/* */
/* 646 */ getViewPlatformToCoexistence(ci);
/* 647 */ vp2coe.set(ci.viewPlatformToCoe);
/* */ }
/* */
/* */ private void getViewPlatformToCoexistence(CanvasInfo ci) {
/* 651 */ if (!ci.updateViewPlatformToCoe) return;
/* */
/* 653 */ if (ci.viewPlatformToCoe == null) {
/* 654 */ ci.viewPlatformToCoe = new Transform3D();
/* */ }
/* */
/* 666 */ getScreenScale(ci);
/* 667 */ if (this.resizePolicy == 1)
/* 668 */ ci.viewPlatformToCoe.setScale(ci.screenScale * ci.windowScale);
/* */ else {
/* 670 */ ci.viewPlatformToCoe.setScale(ci.screenScale);
/* */ }
/* 672 */ if (this.viewPolicy == 1)
/* */ {
/* 675 */ ci.updateViewPlatformToCoe = false;
/* 676 */ return;
/* */ }
/* */
/* 686 */ double eyeHeight = this.body.getNominalEyeHeightFromGround();
/* 687 */ int viewAttachPolicy = this.view.getViewPlatform().getViewAttachPolicy();
/* 688 */ int pworldAttachPolicy = this.env.getCoexistenceCenterInPworldPolicy();
/* */ double eyeOffset;
/* */ double eyeOffset;
/* 690 */ if (this.eyePolicy == 2)
/* */ {
/* 692 */ eyeOffset = ci.getFieldOfViewOffset();
/* */ }
/* */ else {
/* 695 */ eyeOffset = this.body.getNominalEyeOffsetFromNominalScreen();
/* */ }
/* 697 */ if (pworldAttachPolicy == 2)
/* */ {
/* 702 */ if (viewAttachPolicy == 0)
/* */ {
/* 708 */ this.v3d.set(0.0D, 0.0D, eyeOffset);
/* */ }
/* 710 */ else if (viewAttachPolicy == 2)
/* */ {
/* 713 */ this.v3d.set(0.0D, 0.0D, 0.0D);
/* */ }
/* */ else
/* */ {
/* 718 */ this.v3d.set(0.0D, -eyeHeight, eyeOffset);
/* */ }
/* */ }
/* 721 */ else if (pworldAttachPolicy == 0)
/* */ {
/* 723 */ if (viewAttachPolicy == 0)
/* */ {
/* 727 */ this.v3d.set(0.0D, 0.0D, 0.0D);
/* */ }
/* 729 */ else if (viewAttachPolicy == 2)
/* */ {
/* 732 */ this.v3d.set(0.0D, 0.0D, -eyeOffset);
/* */ }
/* */ else
/* */ {
/* 737 */ this.v3d.set(0.0D, -eyeHeight, 0.0D);
/* */ }
/* */
/* */ }
/* 742 */ else if (viewAttachPolicy == 0) {
/* 743 */ this.v3d.set(0.0D, eyeHeight, 0.0D);
/* */ }
/* 745 */ else if (viewAttachPolicy == 2) {
/* 746 */ this.v3d.set(0.0D, eyeHeight, -eyeOffset);
/* */ }
/* */ else {
/* 749 */ this.v3d.set(0.0D, 0.0D, 0.0D);
/* */ }
/* */
/* 753 */ ci.viewPlatformToCoe.setTranslation(this.v3d);
/* 754 */ ci.updateViewPlatformToCoe = false;
/* */ }
/* */
/* */ public void getCoexistenceToViewPlatform(Canvas3D c3d, Transform3D coe2vp)
/* */ {
/* 774 */ CanvasInfo ci = updateCache(c3d, "getCoexistenceToViewPlatform", false);
/* */
/* 777 */ getCoexistenceToViewPlatform(ci);
/* 778 */ coe2vp.set(ci.coeToViewPlatform);
/* */ }
/* */
/* */ private void getCoexistenceToViewPlatform(CanvasInfo ci) {
/* 782 */ if (ci.updateCoeToViewPlatform)
/* */ {
/* 784 */ if (ci.coeToViewPlatform == null) {
/* 785 */ ci.coeToViewPlatform = new Transform3D();
/* */ }
/* 787 */ getViewPlatformToCoexistence(ci);
/* 788 */ ci.coeToViewPlatform.invert(ci.viewPlatformToCoe);
/* */
/* 790 */ ci.updateCoeToViewPlatform = false;
/* */ }
/* */ }
/* */
/* */ public void getCoexistenceToVworld(Canvas3D c3d, Transform3D coe2vw)
/* */ {
/* 815 */ CanvasInfo ci = updateCache(c3d, "getCoexistenceToVworld", true);
/* 816 */ getCoexistenceToVworld(ci);
/* 817 */ coe2vw.set(ci.coeToVworld);
/* */ }
/* */
/* */ private void getCoexistenceToVworld(CanvasInfo ci) {
/* 821 */ if (ci.updateCoeToVworld)
/* */ {
/* 823 */ if (ci.coeToVworld == null) ci.coeToVworld = new Transform3D();
/* */
/* 825 */ getCoexistenceToViewPlatform(ci);
/* 826 */ ci.coeToVworld.mul(this.vpi.viewPlatformToVworld, ci.coeToViewPlatform);
/* */
/* 829 */ ci.updateCoeToVworld = false;
/* */ }
/* */ }
/* */
/* */ public void getEyeToImagePlate(Canvas3D c3d, Transform3D e2ipl, Transform3D e2ipr)
/* */ {
/* 860 */ CanvasInfo ci = updateCache(c3d, "getEyeToImagePlate", false);
/* 861 */ getEyeToImagePlate(ci);
/* 862 */ e2ipl.set(ci.eyeToPlate);
/* 863 */ if ((ci.useStereo) && (e2ipr != null))
/* 864 */ e2ipr.set(ci.rightEyeToPlate);
/* */ }
/* */
/* */ private void getEyeToImagePlate(CanvasInfo ci) {
/* 868 */ if (ci.updateEyeInPlate)
/* */ {
/* 870 */ if (ci.eyeToPlate == null) {
/* 871 */ ci.eyeToPlate = new Transform3D();
/* */ }
/* 873 */ if (this.viewPolicy == 1) {
/* 874 */ getEyesHMD(ci);
/* */ }
/* 876 */ else if (this.useTracking) {
/* 877 */ getEyesTracked(ci);
/* */ }
/* */ else {
/* 880 */ getEyesFixedScreen(ci);
/* */ }
/* 882 */ ci.updateEyeInPlate = false;
/* */ }
/* */ }
/* */
/* */ private void getEyesHMD(CanvasInfo ci)
/* */ {
/* 909 */ if (ci.useStereo)
/* */ {
/* 913 */ this.leftEye.set(this.leftEyeInHead);
/* 914 */ this.headToHeadTracker.transform(this.leftEye);
/* 915 */ CanvasInfo.access$1200(ci).headTrackerToLeftPlate.transform(this.leftEye, ci.eyeInPlate);
/* */
/* 917 */ this.rightEye.set(this.rightEyeInHead);
/* 918 */ this.headToHeadTracker.transform(this.rightEye);
/* 919 */ CanvasInfo.access$1200(ci).headTrackerToRightPlate.transform(this.rightEye, ci.rightEyeInPlate);
/* */
/* 921 */ if (ci.rightEyeToPlate == null) {
/* 922 */ ci.rightEyeToPlate = new Transform3D();
/* */ }
/* 924 */ this.v3d.set(ci.rightEyeInPlate);
/* 925 */ ci.rightEyeToPlate.set(this.v3d);
/* */ }
/* */ else
/* */ {
/* 930 */ switch (ci.monoscopicPolicy) {
/* */ case 0:
/* 932 */ this.leftEye.set(this.leftEyeInHead);
/* 933 */ this.headToHeadTracker.transform(this.leftEye);
/* 934 */ CanvasInfo.access$1200(ci).headTrackerToLeftPlate.transform(this.leftEye, ci.eyeInPlate);
/* */
/* 936 */ break;
/* */ case 1:
/* 938 */ this.rightEye.set(this.rightEyeInHead);
/* 939 */ this.headToHeadTracker.transform(this.rightEye);
/* 940 */ CanvasInfo.access$1200(ci).headTrackerToRightPlate.transform(this.rightEye, ci.eyeInPlate);
/* */
/* 942 */ break;
/* */ case 2:
/* */ default:
/* 945 */ throw new IllegalStateException("Illegal monoscopic view policy for 2-channel HMD");
/* */ }
/* */ }
/* */
/* 949 */ this.v3d.set(ci.eyeInPlate);
/* 950 */ ci.eyeToPlate.set(this.v3d);
/* */ }
/* */
/* */ private void getEyesTracked(CanvasInfo ci) {
/* 954 */ this.leftEye.set(this.leftEyeInHead);
/* 955 */ this.rightEye.set(this.rightEyeInHead);
/* 956 */ this.headToTrackerBase.transform(this.leftEye);
/* 957 */ this.headToTrackerBase.transform(this.rightEye);
/* 958 */ if (this.coeCentering)
/* */ {
/* 961 */ getCoexistenceToImagePlate(ci);
/* 962 */ ci.coeToPlate.transform(this.leftEye);
/* 963 */ ci.coeToRightPlate.transform(this.rightEye);
/* */ }
/* */ else
/* */ {
/* 967 */ CanvasInfo.access$1200(ci).trackerBaseToPlate.transform(this.leftEye);
/* 968 */ CanvasInfo.access$1200(ci).trackerBaseToPlate.transform(this.rightEye);
/* */ }
/* 970 */ setEyeScreenRelative(ci, this.leftEye, this.rightEye);
/* */ }
/* */
/* */ private void getEyesFixedScreen(CanvasInfo ci) {
/* 974 */ switch (this.eyePolicy) {
/* */ case 2:
/* 976 */ double z = ci.getFieldOfViewOffset();
/* 977 */ setEyeWindowRelative(ci, z, z);
/* 978 */ break;
/* */ case 1:
/* 980 */ setEyeWindowRelative(ci, ci.leftManualEyeInPlate.z, ci.rightManualEyeInPlate.z);
/* */
/* 983 */ break;
/* */ case 0:
/* 985 */ setEyeScreenRelative(ci, ci.leftManualEyeInPlate, ci.rightManualEyeInPlate);
/* */
/* 988 */ break;
/* */ case 3:
/* 990 */ this.view.getLeftManualEyeInCoexistence(this.leftEye);
/* 991 */ this.view.getRightManualEyeInCoexistence(this.rightEye);
/* */
/* 993 */ getCoexistenceToImagePlate(ci);
/* 994 */ ci.coeToPlate.transform(this.leftEye);
/* 995 */ ci.coeToRightPlate.transform(this.rightEye);
/* 996 */ setEyeScreenRelative(ci, this.leftEye, this.rightEye);
/* */ }
/* */ }
/* */
/* */ private void setEyeWindowRelative(CanvasInfo ci, double leftZ, double rightZ)
/* */ {
/* 1005 */ double centerX = ci.canvasX + ci.canvasWidth / 2.0D;
/* 1006 */ this.leftEye.x = (centerX + this.leftEyeInHead.x);
/* 1007 */ this.rightEye.x = (centerX + this.rightEyeInHead.x);
/* */
/* 1010 */ this.leftEye.y = (this.rightEye.y = ci.canvasY + ci.canvasHeight / 2.0D);
/* */
/* 1013 */ this.leftEye.z = leftZ;
/* 1014 */ this.rightEye.z = rightZ;
/* */
/* 1016 */ setEyeScreenRelative(ci, this.leftEye, this.rightEye);
/* */ }
/* */
/* */ private void setEyeScreenRelative(CanvasInfo ci, Point3d leftEye, Point3d rightEye)
/* */ {
/* 1021 */ if (ci.useStereo) {
/* 1022 */ ci.eyeInPlate.set(leftEye);
/* 1023 */ ci.rightEyeInPlate.set(rightEye);
/* */
/* 1025 */ if (ci.rightEyeToPlate == null) {
/* 1026 */ ci.rightEyeToPlate = new Transform3D();
/* */ }
/* 1028 */ this.v3d.set(ci.rightEyeInPlate);
/* 1029 */ ci.rightEyeToPlate.set(this.v3d);
/* */ }
/* */ else {
/* 1032 */ switch (ci.monoscopicPolicy) {
/* */ case 2:
/* 1034 */ ci.eyeInPlate.set((leftEye.x + rightEye.x) / 2.0D, (leftEye.y + rightEye.y) / 2.0D, (leftEye.z + rightEye.z) / 2.0D);
/* */
/* 1037 */ break;
/* */ case 0:
/* 1039 */ ci.eyeInPlate.set(leftEye);
/* 1040 */ break;
/* */ case 1:
/* 1042 */ ci.eyeInPlate.set(rightEye);
/* */ }
/* */ }
/* */
/* 1046 */ this.v3d.set(ci.eyeInPlate);
/* 1047 */ ci.eyeToPlate.set(this.v3d);
/* */ }
/* */
/* */ public void getEyeToViewPlatform(Canvas3D c3d, Transform3D e2vpl, Transform3D e2vpr)
/* */ {
/* 1101 */ CanvasInfo ci = updateCache(c3d, "getEyeToViewPlatform", false);
/* 1102 */ getEyeToViewPlatform(ci);
/* 1103 */ e2vpl.set(ci.eyeToViewPlatform);
/* 1104 */ if ((ci.useStereo) && (e2vpr != null))
/* 1105 */ e2vpr.set(ci.rightEyeToViewPlatform);
/* */ }
/* */
/* */ private void getEyeToViewPlatform(CanvasInfo ci) {
/* 1109 */ if (ci.updateEyeToViewPlatform)
/* */ {
/* 1111 */ if (ci.eyeToViewPlatform == null) {
/* 1112 */ ci.eyeToViewPlatform = new Transform3D();
/* */ }
/* 1114 */ getEyeToImagePlate(ci);
/* 1115 */ getImagePlateToViewPlatform(ci);
/* 1116 */ ci.eyeToViewPlatform.mul(ci.plateToViewPlatform, ci.eyeToPlate);
/* */
/* 1118 */ if (ci.useStereo) {
/* 1119 */ if (ci.rightEyeToViewPlatform == null) {
/* 1120 */ ci.rightEyeToViewPlatform = new Transform3D();
/* */ }
/* 1122 */ ci.rightEyeToViewPlatform.mul(ci.rightPlateToViewPlatform, ci.rightEyeToPlate);
/* */ }
/* */
/* 1125 */ ci.updateEyeToViewPlatform = false;
/* */ }
/* */ }
/* */
/* */ public void getViewPlatformToEye(Canvas3D c3d, Transform3D vp2el, Transform3D vp2er)
/* */ {
/* 1152 */ CanvasInfo ci = updateCache(c3d, "getViewPlatformToEye", false);
/* 1153 */ getViewPlatformToEye(ci);
/* 1154 */ vp2el.set(ci.viewPlatformToEye);
/* 1155 */ if ((ci.useStereo) && (vp2er != null))
/* 1156 */ vp2er.set(ci.viewPlatformToRightEye);
/* */ }
/* */
/* */ private void getViewPlatformToEye(CanvasInfo ci) {
/* 1160 */ if (ci.updateViewPlatformToEye)
/* */ {
/* 1162 */ if (ci.viewPlatformToEye == null) {
/* 1163 */ ci.viewPlatformToEye = new Transform3D();
/* */ }
/* 1165 */ getEyeToViewPlatform(ci);
/* 1166 */ ci.viewPlatformToEye.invert(ci.eyeToViewPlatform);
/* */
/* 1168 */ if (ci.useStereo) {
/* 1169 */ if (ci.viewPlatformToRightEye == null) {
/* 1170 */ ci.viewPlatformToRightEye = new Transform3D();
/* */ }
/* 1172 */ ci.viewPlatformToRightEye.invert(ci.rightEyeToViewPlatform);
/* */ }
/* 1174 */ ci.updateViewPlatformToEye = false;
/* */ }
/* */ }
/* */
/* */ public void getEyeToVworld(Canvas3D c3d, Transform3D e2vwl, Transform3D e2vwr)
/* */ {
/* 1204 */ CanvasInfo ci = updateCache(c3d, "getEyeToVworld", true);
/* 1205 */ getEyeToVworld(ci);
/* 1206 */ e2vwl.set(ci.eyeToVworld);
/* 1207 */ if ((ci.useStereo) && (e2vwr != null))
/* 1208 */ e2vwr.set(ci.rightEyeToVworld);
/* */ }
/* */
/* */ private void getEyeToVworld(CanvasInfo ci) {
/* 1212 */ if (ci.updateEyeToVworld)
/* */ {
/* 1214 */ if (ci.eyeToVworld == null) {
/* 1215 */ ci.eyeToVworld = new Transform3D();
/* */ }
/* 1217 */ getEyeToViewPlatform(ci);
/* 1218 */ ci.eyeToVworld.mul(this.vpi.viewPlatformToVworld, ci.eyeToViewPlatform);
/* */
/* 1221 */ if (ci.useStereo) {
/* 1222 */ if (ci.rightEyeToVworld == null) {
/* 1223 */ ci.rightEyeToVworld = new Transform3D();
/* */ }
/* 1225 */ ci.rightEyeToVworld.mul(this.vpi.viewPlatformToVworld, ci.rightEyeToViewPlatform);
/* */ }
/* */
/* 1228 */ ci.updateEyeToVworld = false;
/* */ }
/* */ }
/* */
/* */ public void getProjection(Canvas3D c3d, Transform3D e2ccl, Transform3D e2ccr)
/* */ {
/* 1263 */ CanvasInfo ci = updateCache(c3d, "getProjection", true);
/* 1264 */ getProjection(ci);
/* 1265 */ e2ccl.set(ci.projection);
/* 1266 */ if ((ci.useStereo) && (e2ccr != null))
/* 1267 */ e2ccr.set(ci.rightProjection);
/* */ }
/* */
/* */ private void getProjection(CanvasInfo ci) {
/* 1271 */ if (ci.updateProjection)
/* */ {
/* 1273 */ if (ci.projection == null) {
/* 1274 */ ci.projection = new Transform3D();
/* */ }
/* 1276 */ getEyeToImagePlate(ci);
/* 1277 */ getClipDistances(ci);
/* */
/* 1283 */ double backClip = getBackClip(ci, ci.eyeInPlate);
/* 1284 */ computeProjection(ci, ci.eyeInPlate, getFrontClip(ci, ci.eyeInPlate), backClip, ci.projection);
/* */
/* 1288 */ if (ci.useStereo) {
/* 1289 */ if (ci.rightProjection == null) {
/* 1290 */ ci.rightProjection = new Transform3D();
/* */ }
/* 1292 */ computeProjection(ci, ci.rightEyeInPlate, getFrontClip(ci, ci.rightEyeInPlate), backClip, ci.rightProjection);
/* */ }
/* */
/* 1296 */ ci.updateProjection = false;
/* */ }
/* */ }
/* */
/* */ public void getInverseProjection(Canvas3D c3d, Transform3D cc2el, Transform3D cc2er)
/* */ {
/* 1327 */ CanvasInfo ci = updateCache(c3d, "getInverseProjection", true);
/* 1328 */ getInverseProjection(ci);
/* 1329 */ cc2el.set(ci.inverseProjection);
/* 1330 */ if ((ci.useStereo) && (cc2er != null))
/* 1331 */ cc2er.set(ci.inverseRightProjection);
/* */ }
/* */
/* */ private void getInverseProjection(CanvasInfo ci) {
/* 1335 */ if (ci.updateInverseProjection)
/* */ {
/* 1337 */ if (ci.inverseProjection == null) {
/* 1338 */ ci.inverseProjection = new Transform3D();
/* */ }
/* 1340 */ getProjection(ci);
/* 1341 */ ci.inverseProjection.invert(ci.projection);
/* */
/* 1343 */ if (ci.useStereo) {
/* 1344 */ if (ci.inverseRightProjection == null) {
/* 1345 */ ci.inverseRightProjection = new Transform3D();
/* */ }
/* 1347 */ ci.inverseRightProjection.invert(ci.rightProjection);
/* */ }
/* 1349 */ ci.updateInverseProjection = false;
/* */ }
/* */ }
/* */
/* */ public void getInverseViewPlatformProjection(Canvas3D c3d, Transform3D cc2vpl, Transform3D cc2vpr)
/* */ {
/* 1381 */ CanvasInfo ci = updateCache(c3d, "getInverseViewPlatformProjection", true);
/* */
/* 1384 */ getInverseViewPlatformProjection(ci);
/* 1385 */ cc2vpl.set(ci.inverseViewPlatformProjection);
/* 1386 */ if ((ci.useStereo & cc2vpr != null))
/* 1387 */ cc2vpr.set(ci.inverseViewPlatformRightProjection);
/* */ }
/* */
/* */ private void getInverseViewPlatformProjection(CanvasInfo ci) {
/* 1391 */ if (ci.updateInverseViewPlatformProjection)
/* */ {
/* 1393 */ if (ci.inverseViewPlatformProjection == null) {
/* 1394 */ ci.inverseViewPlatformProjection = new Transform3D();
/* */ }
/* 1396 */ getInverseProjection(ci);
/* 1397 */ getEyeToViewPlatform(ci);
/* 1398 */ ci.inverseViewPlatformProjection.mul(ci.eyeToViewPlatform, ci.inverseProjection);
/* */
/* 1401 */ if (ci.useStereo) {
/* 1402 */ if (ci.inverseViewPlatformRightProjection == null) {
/* 1403 */ ci.inverseViewPlatformRightProjection = new Transform3D();
/* */ }
/* 1405 */ ci.inverseViewPlatformRightProjection.mul(ci.rightEyeToViewPlatform, ci.inverseRightProjection);
/* */ }
/* */
/* 1408 */ ci.updateInverseVworldProjection = false;
/* */ }
/* */ }
/* */
/* */ public void getInverseVworldProjection(Canvas3D c3d, Transform3D cc2vwl, Transform3D cc2vwr)
/* */ {
/* 1437 */ CanvasInfo ci = updateCache(c3d, "getInverseVworldProjection", true);
/* 1438 */ getInverseVworldProjection(ci);
/* 1439 */ cc2vwl.set(ci.inverseVworldProjection);
/* 1440 */ if ((ci.useStereo & cc2vwr != null))
/* 1441 */ cc2vwr.set(ci.inverseVworldRightProjection);
/* */ }
/* */
/* */ private void getInverseVworldProjection(CanvasInfo ci) {
/* 1445 */ if (ci.updateInverseVworldProjection)
/* */ {
/* 1447 */ if (ci.inverseVworldProjection == null) {
/* 1448 */ ci.inverseVworldProjection = new Transform3D();
/* */ }
/* 1450 */ getInverseViewPlatformProjection(ci);
/* 1451 */ ci.inverseVworldProjection.mul(this.vpi.viewPlatformToVworld, ci.inverseViewPlatformProjection);
/* */
/* 1454 */ if (ci.useStereo) {
/* 1455 */ if (ci.inverseVworldRightProjection == null) {
/* 1456 */ ci.inverseVworldRightProjection = new Transform3D();
/* */ }
/* 1458 */ ci.inverseVworldRightProjection.mul(this.vpi.viewPlatformToVworld, ci.inverseViewPlatformRightProjection);
/* */ }
/* */
/* 1462 */ ci.updateInverseVworldProjection = false;
/* */ }
/* */ }
/* */
/* */ private void computeProjection(CanvasInfo ci, Point3d eye, double front, double back, Transform3D p)
/* */ {
/* 1475 */ double lx = ci.canvasX - eye.x;
/* 1476 */ double ly = ci.canvasY - eye.y;
/* 1477 */ double hx = ci.canvasX + ci.canvasWidth - eye.x;
/* 1478 */ double hy = ci.canvasY + ci.canvasHeight - eye.y;
/* 1479 */ double nz = front - eye.z;
/* 1480 */ double fz = back - eye.z;
/* 1481 */ double iz = -eye.z;
/* */
/* 1483 */ if (this.projectionPolicy == 1)
/* 1484 */ computePerspectiveProjection(lx, ly, hx, hy, iz, nz, fz, this.m16d);
/* */ else {
/* 1486 */ computeParallelProjection(lx, ly, hx, hy, nz, fz, this.m16d);
/* */ }
/* 1488 */ p.set(this.m16d);
/* */ }
/* */
/* */ private void computePerspectiveProjection(double lx, double ly, double hx, double hy, double iz, double nz, double fz, double[] m)
/* */ {
/* 1580 */ double idx = 1.0D / (hx - lx);
/* 1581 */ double idy = 1.0D / (hy - ly);
/* 1582 */ double idz = 1.0D / (nz - fz);
/* */
/* 1584 */ m[0] = (-2.0D * iz * idx);
/* 1585 */ m[5] = (-2.0D * iz * idy);
/* 1586 */ m[2] = ((hx + lx) * idx);
/* 1587 */ m[6] = ((hy + ly) * idy);
/* 1588 */ m[10] = (-(nz + fz) * idz);
/* 1589 */ m[11] = (2.0D * fz * nz * idz);
/* 1590 */ m[14] = -1.0D;
/* */ double tmp161_160 = (m[4] = m[7] = m[8] = m[9] = m[12] = m[13] = m[15] = 0.0D); m[3] = tmp161_160; m[1] = tmp161_160;
/* */ }
/* */
/* */ private void computeParallelProjection(double lx, double ly, double hx, double hy, double nz, double fz, double[] m)
/* */ {
/* 1606 */ double idx = 1.0D / (hx - lx);
/* 1607 */ double idy = 1.0D / (hy - ly);
/* 1608 */ double idz = 1.0D / (nz - fz);
/* */
/* 1610 */ m[0] = (2.0D * idx);
/* 1611 */ m[5] = (2.0D * idy);
/* 1612 */ m[10] = (2.0D * idz);
/* 1613 */ m[3] = (-(hx + lx) * idx);
/* 1614 */ m[7] = (-(hy + ly) * idy);
/* 1615 */ m[11] = (-(nz + fz) * idz);
/* 1616 */ m[15] = 1.0D;
/* */ double tmp149_148 = (m[4] = m[6] = m[8] = m[9] = m[12] = m[13] = m[14] = 0.0D); m[2] = tmp149_148; m[1] = tmp149_148;
/* */ }
/* */
/* */ private double getFrontClip(CanvasInfo ci, Point3d eye)
/* */ {
/* 1624 */ if ((this.frontClipPolicy == 3) || (this.frontClipPolicy == 2))
/* */ {
/* 1626 */ return eye.z - ci.frontClipDistance;
/* */ }
/* */
/* 1629 */ return -ci.frontClipDistance;
/* */ }
/* */
/* */ private double getBackClip(CanvasInfo ci, Point3d eye)
/* */ {
/* 1642 */ if ((this.backClipPolicy == 3) || (this.backClipPolicy == 2))
/* */ {
/* 1644 */ return eye.z - ci.backClipDistance;
/* */ }
/* */
/* 1647 */ return -ci.backClipDistance;
/* */ }
/* */
/* */ private double getClipScale(CanvasInfo ci, int clipPolicy)
/* */ {
/* 1655 */ if ((clipPolicy == 2) || (clipPolicy == 0))
/* */ {
/* 1657 */ getScreenScale(ci);
/* 1658 */ if (this.resizePolicy == 1) {
/* 1659 */ return this.vpi.vworldToViewPlatformScale * ci.screenScale * ci.windowScale;
/* */ }
/* */
/* 1662 */ return this.vpi.vworldToViewPlatformScale * ci.screenScale;
/* */ }
/* */
/* 1665 */ if (this.resizePolicy == 1) {
/* 1666 */ return ci.windowScale;
/* */ }
/* 1668 */ return 1.0D;
/* */ }
/* */
/* */ public double getPhysicalFrontClipDistance(Canvas3D c3d)
/* */ {
/* 1699 */ CanvasInfo ci = updateCache(c3d, "getPhysicalFrontClipDistance", true);
/* */
/* 1702 */ getClipDistances(ci);
/* 1703 */ return ci.frontClipDistance;
/* */ }
/* */
/* */ public double getPhysicalBackClipDistance(Canvas3D c3d)
/* */ {
/* 1733 */ CanvasInfo ci = updateCache(c3d, "getPhysicalBackClipDistance", true);
/* 1734 */ getClipDistances(ci);
/* 1735 */ return ci.backClipDistance;
/* */ }
/* */
/* */ private void getClipDistances(CanvasInfo ci) {
/* 1739 */ if (ci.updateClipDistances)
/* */ {
/* 1742 */ ci.frontClipDistance = (this.view.getFrontClipDistance() * getClipScale(ci, this.frontClipPolicy));
/* */
/* 1745 */ ci.backClipDistance = (this.view.getBackClipDistance() * getClipScale(ci, this.backClipPolicy));
/* */
/* 1748 */ ci.updateClipDistances = false;
/* */ }
/* */ }
/* */
/* */ private void getScreenScale(CanvasInfo ci)
/* */ {
/* 1759 */ if (ci.updateScreenScale)
/* */ {
/* 1762 */ if (this.scalePolicy == 0)
/* 1763 */ ci.screenScale = (CanvasInfo.access$1200(ci).screenWidth / 2.0D);
/* */ else {
/* 1765 */ ci.screenScale = this.view.getScreenScale();
/* */ }
/* 1767 */ ci.updateScreenScale = false;
/* */ }
/* */ }
/* */
/* */ public double getPhysicalToViewPlatformScale(Canvas3D c3d)
/* */ {
/* 1789 */ CanvasInfo ci = updateCache(c3d, "getPhysicalToViewPlatformScale", false);
/* */
/* 1792 */ getPhysicalToViewPlatformScale(ci);
/* 1793 */ return ci.physicalToVpScale;
/* */ }
/* */
/* */ private void getPhysicalToViewPlatformScale(CanvasInfo ci) {
/* 1797 */ if (ci.updatePhysicalToVpScale)
/* */ {
/* 1800 */ getScreenScale(ci);
/* 1801 */ if (this.resizePolicy == 1)
/* 1802 */ ci.physicalToVpScale = (1.0D / (ci.screenScale * ci.windowScale));
/* */ else {
/* 1804 */ ci.physicalToVpScale = (1.0D / ci.screenScale);
/* */ }
/* 1806 */ ci.updatePhysicalToVpScale = false;
/* */ }
/* */ }
/* */
/* */ public double getPhysicalToVirtualScale(Canvas3D c3d)
/* */ {
/* 1829 */ CanvasInfo ci = updateCache(c3d, "getPhysicalToVirtualScale", true);
/* 1830 */ getPhysicalToVirtualScale(ci);
/* 1831 */ return ci.physicalToVirtualScale;
/* */ }
/* */
/* */ private void getPhysicalToVirtualScale(CanvasInfo ci) {
/* 1835 */ if (ci.updatePhysicalToVirtualScale)
/* */ {
/* 1839 */ getPhysicalToViewPlatformScale(ci);
/* 1840 */ ci.physicalToVirtualScale = (ci.physicalToVpScale / this.vpi.vworldToViewPlatformScale);
/* */
/* 1843 */ ci.updatePhysicalToVirtualScale = false;
/* */ }
/* */ }
/* */
/* */ public double getPhysicalWidth(Canvas3D c3d)
/* */ {
/* 1861 */ CanvasInfo ci = updateCache(c3d, "getPhysicalWidth", false);
/* 1862 */ return ci.canvasWidth;
/* */ }
/* */
/* */ public double getPhysicalHeight(Canvas3D c3d)
/* */ {
/* 1877 */ CanvasInfo ci = updateCache(c3d, "getPhysicalHeight", false);
/* 1878 */ return ci.canvasHeight;
/* */ }
/* */
/* */ public void getPhysicalLocation(Canvas3D c3d, Point3d location)
/* */ {
/* 1895 */ CanvasInfo ci = updateCache(c3d, "getPhysicalLocation", false);
/* 1896 */ location.set(ci.canvasX, ci.canvasY, 0.0D);
/* */ }
/* */
/* */ public void getPixelLocationInImagePlate(Canvas3D c3d, int x, int y, Point3d location)
/* */ {
/* 1914 */ CanvasInfo ci = updateCache(c3d, "getPixelLocationInImagePlate", false);
/* */
/* 1917 */ location.set(ci.canvasX + x * CanvasInfo.access$1200(ci).metersPerPixelX, ci.canvasY - y * CanvasInfo.access$1200(ci).metersPerPixelY + ci.canvasHeight, 0.0D);
/* */ }
/* */
/* */ public void getSensorToVworld(Canvas3D c3d, Sensor sensor, Transform3D s2vw)
/* */ {
/* 1940 */ CanvasInfo ci = updateCache(c3d, "getSensorToVworld", true);
/* 1941 */ getTrackerBaseToVworld(ci);
/* 1942 */ sensor.getRead(s2vw);
/* 1943 */ s2vw.mul(ci.trackerBaseToVworld, s2vw);
/* */ }
/* */
/* */ public void getTrackerBaseToViewPlatform(Canvas3D c3d, Transform3D tb2vp)
/* */ {
/* 1960 */ CanvasInfo ci = updateCache(c3d, "getTrackerBaseToViewPlatform", false);
/* */
/* 1963 */ getTrackerBaseToViewPlatform(ci);
/* 1964 */ tb2vp.set(ci.trackerBaseToViewPlatform);
/* */ }
/* */
/* */ private void getTrackerBaseToViewPlatform(CanvasInfo ci) {
/* 1968 */ if (ci.updateTrackerBaseToViewPlatform)
/* */ {
/* 1970 */ if (ci.trackerBaseToViewPlatform == null) {
/* 1971 */ ci.trackerBaseToViewPlatform = new Transform3D();
/* */ }
/* 1973 */ getViewPlatformToCoexistence(ci);
/* 1974 */ ci.trackerBaseToViewPlatform.mul(this.coeToTrackerBase, ci.viewPlatformToCoe);
/* */
/* 1977 */ ci.trackerBaseToViewPlatform.invert();
/* 1978 */ ci.updateTrackerBaseToViewPlatform = false;
/* */ }
/* */ }
/* */
/* */ public void getTrackerBaseToVworld(Canvas3D c3d, Transform3D tb2vw)
/* */ {
/* 2001 */ CanvasInfo ci = updateCache(c3d, "getTrackerBaseToVworld", true);
/* 2002 */ getTrackerBaseToVworld(ci);
/* 2003 */ tb2vw.set(ci.trackerBaseToVworld);
/* */ }
/* */
/* */ private void getTrackerBaseToVworld(CanvasInfo ci) {
/* 2007 */ if (ci.updateTrackerBaseToVworld)
/* */ {
/* 2009 */ if (ci.trackerBaseToVworld == null) {
/* 2010 */ ci.trackerBaseToVworld = new Transform3D();
/* */ }
/* */
/* 2018 */ getTrackerBaseToViewPlatform(ci);
/* 2019 */ ci.trackerBaseToVworld.mul(this.vpi.viewPlatformToVworld, ci.trackerBaseToViewPlatform);
/* */
/* 2022 */ ci.updateTrackerBaseToVworld = false;
/* */ }
/* */ }
/* */
/* */ public static synchronized void clear()
/* */ {
/* 2038 */ Iterator i = staticVpMap.values().iterator();
/* 2039 */ while (i.hasNext()) ((ViewPlatformInfo)i.next()).clear();
/* 2040 */ staticVpMap.clear();
/* */
/* 2042 */ i = staticSiMap.values().iterator();
/* 2043 */ while (i.hasNext()) ((ScreenInfo)i.next()).clear();
/* 2044 */ staticSiMap.clear();
/* */ }
/* */
/* */ public void updateScreen(Screen3D s3d)
/* */ {
/* 2057 */ ScreenInfo si = (ScreenInfo)this.screenMap.get(s3d);
/* 2058 */ if (si != null) si.updateScreen = true;
/* */ }
/* */
/* */ public void updateCanvas(Canvas3D c3d)
/* */ {
/* 2072 */ CanvasInfo ci = (CanvasInfo)this.canvasMap.get(c3d);
/* 2073 */ if (ci != null) ci.updateCanvas = true;
/* */ }
/* */
/* */ public void updateView()
/* */ {
/* 2102 */ this.updateView = true;
/* */ }
/* */
/* */ public void updateHead()
/* */ {
/* 2113 */ this.updateHead = true;
/* */ }
/* */
/* */ public void updateViewPlatform()
/* */ {
/* 2129 */ this.vpi.updateViewPlatformToVworld = true;
/* */ }
/* */
/* */ private void getAutoUpdate(CanvasInfo ci)
/* */ {
/* 2137 */ if ((this.autoUpdateFlags & 0x1) != 0) {
/* 2138 */ ci.si.updateScreen = true;
/* */ }
/* 2140 */ if ((this.autoUpdateFlags & 0x2) != 0) {
/* 2141 */ ci.updateCanvas = true;
/* */ }
/* 2143 */ if ((this.autoUpdateFlags & 0x10) != 0) {
/* 2144 */ this.vpi.updateViewPlatformToVworld = true;
/* */ }
/* 2146 */ if ((this.autoUpdateFlags & 0x8) != 0)
/* 2147 */ this.updateHead = true;
/* */ }
/* */
/* */ private CanvasInfo updateCache(Canvas3D c3d, String name, boolean vworld)
/* */ {
/* 2164 */ if ((this.updateView) || ((this.autoUpdateFlags & 0x4) != 0)) {
/* 2165 */ getViewInfo();
/* */ }
/* */
/* 2168 */ CanvasInfo ci = (CanvasInfo)this.canvasMap.get(c3d);
/* 2169 */ if (ci == null) {
/* 2170 */ throw new IllegalArgumentException("\nSpecified Canvas3D is not a component of the View");
/* */ }
/* */
/* 2174 */ if (this.autoUpdate) getAutoUpdate(ci);
/* */
/* 2177 */ if (CanvasInfo.access$1200(ci).updateScreen) {
/* 2178 */ ci.si.getScreenInfo();
/* */ }
/* 2180 */ if (ci.updateCanvas) {
/* 2181 */ ci.getCanvasInfo();
/* */ }
/* 2183 */ if ((vworld) && (this.vpi.updateViewPlatformToVworld)) {
/* 2184 */ this.vpi.getViewPlatformToVworld();
/* */ }
/* 2186 */ if ((this.useTracking) && (this.updateHead)) {
/* 2187 */ getHeadInfo();
/* */ }
/* */
/* 2190 */ return ci;
/* */ }
/* */
/* */ private void getViewInfo()
/* */ {
/* 2203 */ if (this.canvasCount != this.view.numCanvas3Ds()) {
/* 2204 */ this.canvasCount = this.view.numCanvas3Ds();
/* 2205 */ getCanvases();
/* */ }
/* */ else {
/* 2208 */ for (int i = 0; i < this.canvasCount; i++) {
/* 2209 */ if (this.canvasMap.get(this.view.getCanvas3D(i)) != this.canvasInfo[i]) {
/* 2210 */ getCanvases();
/* 2211 */ break;
/* */ }
/* */ }
/* */
/* */ }
/* */
/* 2217 */ getViewPlatform();
/* */
/* 2220 */ this.body = this.view.getPhysicalBody();
/* 2221 */ this.env = this.view.getPhysicalEnvironment();
/* */
/* 2225 */ this.useTracking = useHeadTracking();
/* */
/* 2228 */ if ((this.view.getTrackingEnable()) && (this.env.getTrackingAvailable())) {
/* 2229 */ int headIndex = this.env.getHeadIndex();
/* 2230 */ this.headTracker = this.env.getSensor(headIndex);
/* */ }
/* */
/* 2234 */ this.viewPolicy = this.view.getViewPolicy();
/* 2235 */ this.projectionPolicy = this.view.getProjectionPolicy();
/* 2236 */ this.resizePolicy = this.view.getWindowResizePolicy();
/* 2237 */ this.movementPolicy = this.view.getWindowMovementPolicy();
/* 2238 */ this.eyePolicy = this.view.getWindowEyepointPolicy();
/* 2239 */ this.scalePolicy = this.view.getScreenScalePolicy();
/* 2240 */ this.backClipPolicy = this.view.getBackClipPolicy();
/* 2241 */ this.frontClipPolicy = this.view.getFrontClipPolicy();
/* */
/* 2243 */ if ((this.useTracking) || (this.viewPolicy == 1)) {
/* 2244 */ if (this.headToHeadTracker == null)
/* 2245 */ this.headToHeadTracker = new Transform3D();
/* 2246 */ if (this.headTrackerToTrackerBase == null) {
/* 2247 */ this.headTrackerToTrackerBase = new Transform3D();
/* */ }
/* 2249 */ if (this.viewPolicy == 1) {
/* 2250 */ if (this.trackerBaseToHeadTracker == null)
/* 2251 */ this.trackerBaseToHeadTracker = new Transform3D();
/* 2252 */ if (this.coeToHeadTracker == null) {
/* 2253 */ this.coeToHeadTracker = new Transform3D();
/* */ }
/* */ }
/* 2256 */ else if (this.headToTrackerBase == null) {
/* 2257 */ this.headToTrackerBase = new Transform3D();
/* */ }
/* */
/* 2260 */ this.body.getLeftEyePosition(this.leftEyeInHead);
/* 2261 */ this.body.getRightEyePosition(this.rightEyeInHead);
/* 2262 */ this.body.getHeadToHeadTracker(this.headToHeadTracker);
/* */ }
/* */
/* 2271 */ if ((this.eyePolicy == 1) || (this.eyePolicy == 2))
/* */ {
/* 2273 */ this.body.getLeftEyePosition(this.leftEyeInHead);
/* 2274 */ this.body.getRightEyePosition(this.rightEyeInHead);
/* */ }
/* */
/* 2281 */ if ((this.env.getCoexistenceCenterInPworldPolicy() != 2) || (this.viewPolicy == 1))
/* */ {
/* 2283 */ this.coeCentering = false;
/* */ }
/* 2285 */ else this.coeCentering = this.view.getCoexistenceCenteringEnable();
/* */
/* 2287 */ if ((!this.coeCentering) || (this.useTracking)) {
/* 2288 */ if (this.coeToTrackerBase == null) {
/* 2289 */ this.coeToTrackerBase = new Transform3D();
/* */ }
/* 2291 */ this.env.getCoexistenceToTrackerBase(this.coeToTrackerBase);
/* */ }
/* */
/* 2295 */ if ((this.backClipPolicy == 2) || (this.backClipPolicy == 0) || (this.frontClipPolicy == 2) || (this.frontClipPolicy == 0))
/* */ {
/* 2299 */ this.clipVirtual = true;
/* */ }
/* */ else {
/* 2302 */ this.clipVirtual = false;
/* */ }
/* */
/* 2306 */ for (int i = 0; i < this.canvasCount; i++) {
/* 2307 */ this.canvasInfo[i].updateViewDependencies();
/* */ }
/* 2309 */ this.updateView = false;
/* */ }
/* */
/* */ private void getCanvases()
/* */ {
/* 2325 */ if (this.canvasInfo.length < this.canvasCount) {
/* 2326 */ this.canvasInfo = new CanvasInfo[this.canvasCount];
/* */ }
/* */
/* 2329 */ for (int i = 0; i < this.canvasCount; i++) {
/* 2330 */ Canvas3D c3d = this.view.getCanvas3D(i);
/* 2331 */ Screen3D s3d = c3d.getScreen3D();
/* */
/* 2334 */ ScreenInfo si = (ScreenInfo)this.screenMap.get(s3d);
/* 2335 */ if (si == null) {
/* 2336 */ si = new ScreenInfo(s3d, c3d.getGraphicsConfiguration(), null);
/* 2337 */ this.screenMap.put(s3d, si);
/* */ }
/* */
/* 2343 */ if (this.newSet.add(si)) si.clear(this);
/* */
/* 2346 */ CanvasInfo ci = (CanvasInfo)this.canvasMap.get(c3d);
/* 2347 */ if (ci == null) ci = new CanvasInfo(c3d, si, null);
/* */
/* 2350 */ si.addCanvasInfo(this, ci);
/* */
/* 2353 */ this.newMap.put(c3d, ci);
/* 2354 */ this.canvasInfo[i] = ci;
/* */ }
/* */
/* 2358 */ for (int i = this.canvasCount; i < this.canvasInfo.length; i++) {
/* 2359 */ this.canvasInfo[i] = null;
/* */ }
/* */
/* 2362 */ Map tmp = this.canvasMap;
/* 2363 */ this.canvasMap = this.newMap;
/* 2364 */ this.newMap = tmp;
/* */
/* 2367 */ this.newMap.clear();
/* 2368 */ this.newSet.clear();
/* */ }
/* */
/* */ private void clearCanvases()
/* */ {
/* 2376 */ this.canvasCount = 0;
/* 2377 */ this.canvasMap.clear();
/* 2378 */ this.updateView = true;
/* */ }
/* */
/* */ private void getViewPlatform()
/* */ {
/* 2386 */ ViewPlatform vp = this.view.getViewPlatform();
/* 2387 */ if (vp == null) {
/* 2388 */ throw new IllegalStateException("The View must be attached to a ViewPlatform");
/* */ }
/* */
/* 2391 */ ViewPlatformInfo tmpVpi = (ViewPlatformInfo)this.viewPlatformMap.get(vp);
/* */
/* 2394 */ if (tmpVpi == null)
/* */ {
/* 2396 */ tmpVpi = new ViewPlatformInfo(vp, null);
/* 2397 */ this.viewPlatformMap.put(vp, tmpVpi);
/* */ }
/* */
/* 2400 */ if (this.vpi != tmpVpi)
/* */ {
/* 2403 */ if (this.vpi != null)
/* */ {
/* 2406 */ this.vpi.removeViewInfo(this);
/* */ }
/* 2408 */ this.vpi = tmpVpi;
/* 2409 */ this.vpi.addViewInfo(this);
/* */
/* 2414 */ if (vp.getCapability(11))
/* 2415 */ this.vpi.updateViewPlatformToVworld = true;
/* */ }
/* */ }
/* */
/* */ private void clearViewPlatform()
/* */ {
/* 2427 */ this.updateView = true;
/* */ }
/* */
/* */ private void updateVworldDependencies()
/* */ {
/* 2435 */ for (int i = 0; i < this.canvasCount; i++)
/* 2436 */ this.canvasInfo[i].updateVworldDependencies();
/* */ }
/* */
/* */ protected Transform3D getHeadTrackerToTrackerBase()
/* */ {
/* 2459 */ this.headTracker.getRead(this.headTrackerToTrackerBase);
/* 2460 */ return this.headTrackerToTrackerBase;
/* */ }
/* */
/* */ protected boolean useHeadTracking()
/* */ {
/* 2476 */ return (this.view.getTrackingEnable()) && (this.env.getTrackingAvailable());
/* */ }
/* */
/* */ private void getHeadInfo()
/* */ {
/* 2485 */ this.headTrackerToTrackerBase = getHeadTrackerToTrackerBase();
/* 2486 */ if (this.viewPolicy == 1) {
/* 2487 */ this.trackerBaseToHeadTracker.invert(this.headTrackerToTrackerBase);
/* 2488 */ this.coeToHeadTracker.mul(this.trackerBaseToHeadTracker, this.coeToTrackerBase);
/* */ }
/* */ else
/* */ {
/* 2492 */ this.headToTrackerBase.mul(this.headTrackerToTrackerBase, this.headToHeadTracker);
/* */ }
/* */
/* 2495 */ for (int i = 0; i < this.canvasCount; i++) {
/* 2496 */ this.canvasInfo[i].updateHeadDependencies();
/* */ }
/* 2498 */ this.updateHead = false;
/* */ }
/* */
/* */ private static void t3dPrint(Transform3D t3d, String name)
/* */ {
/* 3352 */ double[] m = new double[16];
/* 3353 */ t3d.get(m);
/* 3354 */ String[] sa = formatMatrixRows(4, 4, m);
/* 3355 */ System.err.println(name);
/* 3356 */ for (int i = 0; i < 4; i++) System.err.println(sa[i]);
/* */ }
/* */
/* */ private static String[] formatMatrixRows(int rowCount, int colCount, double[] m)
/* */ {
/* 3373 */ DecimalFormat df = new DecimalFormat("0.000000");
/* 3374 */ FieldPosition fp = new FieldPosition(0);
/* 3375 */ StringBuffer sb0 = new StringBuffer();
/* 3376 */ StringBuffer sb1 = new StringBuffer();
/* 3377 */ String[] rows = new String[rowCount];
/* */
/* 3379 */ for (int i = 0; i < rowCount; i++) {
/* 3380 */ sb0.setLength(0);
/* 3381 */ for (int j = 0; j < colCount; j++) {
/* 3382 */ sb1.setLength(0);
/* 3383 */ df.format(m[(i * colCount + j)], sb1, fp);
/* 3384 */ int pad = 8 - fp.getEndIndex();
/* 3385 */ for (int k = 0; k < pad; k++) {
/* 3386 */ sb1.insert(0, " ");
/* */ }
/* 3388 */ sb0.append(sb1);
/* */ }
/* 3390 */ rows[i] = sb0.toString();
/* */ }
/* 3392 */ return rows;
/* */ }
/* */
/* */ private class CanvasInfo
/* */ {
/* 2848 */ private Canvas3D c3d = null;
/* 2849 */ private ViewInfo.ScreenInfo si = null;
/* 2850 */ private boolean updateCanvas = true;
/* */
/* 2852 */ private double canvasX = 0.0D;
/* 2853 */ private double canvasY = 0.0D;
/* 2854 */ private boolean updatePosition = true;
/* */
/* 2856 */ private double canvasWidth = 0.0D;
/* 2857 */ private double canvasHeight = 0.0D;
/* 2858 */ private double windowScale = 0.0D;
/* 2859 */ private boolean updateWindowScale = true;
/* */
/* 2861 */ private double screenScale = 0.0D;
/* 2862 */ private boolean updateScreenScale = true;
/* */
/* 2864 */ private boolean useStereo = false;
/* 2865 */ private boolean updateStereo = true;
/* */
/* 2872 */ private Transform3D coeToPlate = null;
/* 2873 */ private Transform3D coeToRightPlate = null;
/* 2874 */ private boolean updateCoeToPlate = true;
/* */
/* 2886 */ private Transform3D viewPlatformToCoe = null;
/* 2887 */ private Transform3D coeToViewPlatform = null;
/* 2888 */ private boolean updateViewPlatformToCoe = true;
/* 2889 */ private boolean updateCoeToViewPlatform = true;
/* */
/* 2895 */ private Transform3D plateToViewPlatform = null;
/* 2896 */ private Transform3D rightPlateToViewPlatform = null;
/* 2897 */ private boolean updatePlateToViewPlatform = true;
/* */
/* 2903 */ private Transform3D trackerBaseToViewPlatform = null;
/* 2904 */ private boolean updateTrackerBaseToViewPlatform = true;
/* */
/* 2913 */ private Point3d eyeInPlate = new Point3d();
/* 2914 */ private Point3d rightEyeInPlate = new Point3d();
/* 2915 */ private Transform3D eyeToPlate = null;
/* 2916 */ private Transform3D rightEyeToPlate = null;
/* 2917 */ private boolean updateEyeInPlate = true;
/* */
/* 2919 */ private Point3d leftManualEyeInPlate = new Point3d();
/* 2920 */ private Point3d rightManualEyeInPlate = new Point3d();
/* 2921 */ private boolean updateManualEye = true;
/* */
/* 2923 */ private int monoscopicPolicy = -1;
/* 2924 */ private boolean updateMonoPolicy = true;
/* */
/* 2930 */ private Transform3D eyeToViewPlatform = null;
/* 2931 */ private Transform3D rightEyeToViewPlatform = null;
/* 2932 */ private boolean updateEyeToViewPlatform = true;
/* */
/* 2934 */ private Transform3D viewPlatformToEye = null;
/* 2935 */ private Transform3D viewPlatformToRightEye = null;
/* 2936 */ private boolean updateViewPlatformToEye = true;
/* */
/* 2941 */ private Transform3D projection = null;
/* 2942 */ private Transform3D rightProjection = null;
/* 2943 */ private boolean updateProjection = true;
/* */
/* 2945 */ private Transform3D inverseProjection = null;
/* 2946 */ private Transform3D inverseRightProjection = null;
/* 2947 */ private boolean updateInverseProjection = true;
/* */
/* 2949 */ private Transform3D inverseViewPlatformProjection = null;
/* 2950 */ private Transform3D inverseViewPlatformRightProjection = null;
/* 2951 */ private boolean updateInverseViewPlatformProjection = true;
/* */
/* 2957 */ private double frontClipDistance = 0.0D;
/* 2958 */ private double backClipDistance = 0.0D;
/* 2959 */ private boolean updateClipDistances = true;
/* */
/* 2965 */ private double physicalToVpScale = 0.0D;
/* 2966 */ private double physicalToVirtualScale = 0.0D;
/* 2967 */ private boolean updatePhysicalToVpScale = true;
/* 2968 */ private boolean updatePhysicalToVirtualScale = true;
/* */
/* 2974 */ private Transform3D plateToVworld = null;
/* 2975 */ private Transform3D rightPlateToVworld = null;
/* 2976 */ private boolean updatePlateToVworld = true;
/* */
/* 2978 */ private Transform3D coeToVworld = null;
/* 2979 */ private boolean updateCoeToVworld = true;
/* */
/* 2981 */ private Transform3D eyeToVworld = null;
/* 2982 */ private Transform3D rightEyeToVworld = null;
/* 2983 */ private boolean updateEyeToVworld = true;
/* */
/* 2985 */ private Transform3D trackerBaseToVworld = null;
/* 2986 */ private boolean updateTrackerBaseToVworld = true;
/* */
/* 2988 */ private Transform3D inverseVworldProjection = null;
/* 2989 */ private Transform3D inverseVworldRightProjection = null;
/* 2990 */ private boolean updateInverseVworldProjection = true;
/* */
/* */ private CanvasInfo(Canvas3D c3d, ViewInfo.ScreenInfo si) {
/* 2993 */ this.si = si;
/* 2994 */ this.c3d = c3d;
/* */ }
/* */
/* */ private void getCanvasInfo()
/* */ {
/* 3002 */ boolean newStereo = (this.c3d.getStereoEnable()) && (this.c3d.getStereoAvailable());
/* */
/* 3005 */ if (this.useStereo != newStereo) {
/* 3006 */ this.useStereo = newStereo;
/* 3007 */ this.updateStereo = true;
/* */ }
/* */
/* 3011 */ this.canvasWidth = (this.c3d.getWidth() * ViewInfo.ScreenInfo.access$6800(this.si));
/* 3012 */ this.canvasHeight = (this.c3d.getHeight() * ViewInfo.ScreenInfo.access$6900(this.si));
/* 3013 */ double newScale = this.canvasWidth / ViewInfo.ScreenInfo.access$1900(this.si);
/* */
/* 3015 */ if (this.windowScale != newScale) {
/* 3016 */ this.windowScale = newScale;
/* 3017 */ this.updateWindowScale = true;
/* */ }
/* */
/* 3028 */ Point awtLocation = this.c3d.getLocationOnScreen();
/* 3029 */ int x = awtLocation.x - ViewInfo.ScreenInfo.access$9600(this.si).x;
/* 3030 */ int y = awtLocation.y - ViewInfo.ScreenInfo.access$9600(this.si).y;
/* */
/* 3032 */ double newCanvasX = ViewInfo.ScreenInfo.access$6800(this.si) * x;
/* 3033 */ double newCanvasY = ViewInfo.ScreenInfo.access$6900(this.si) * (ViewInfo.ScreenInfo.access$9600(this.si).height - (y + this.c3d.getHeight()));
/* */
/* 3036 */ if ((this.canvasX != newCanvasX) || (this.canvasY != newCanvasY)) {
/* 3037 */ this.canvasX = newCanvasX;
/* 3038 */ this.canvasY = newCanvasY;
/* 3039 */ this.updatePosition = true;
/* */ }
/* */
/* 3046 */ int newMonoPolicy = this.c3d.getMonoscopicViewPolicy();
/* 3047 */ if (this.monoscopicPolicy != newMonoPolicy) {
/* 3048 */ this.monoscopicPolicy = newMonoPolicy;
/* 3049 */ this.updateMonoPolicy = true;
/* */ }
/* */
/* 3061 */ this.c3d.getLeftManualEyeInImagePlate(ViewInfo.this.leftEye);
/* 3062 */ this.c3d.getRightManualEyeInImagePlate(ViewInfo.this.rightEye);
/* */
/* 3064 */ if ((!ViewInfo.this.leftEye.equals(this.leftManualEyeInPlate)) || (!ViewInfo.this.rightEye.equals(this.rightManualEyeInPlate)))
/* */ {
/* 3067 */ this.leftManualEyeInPlate.set(ViewInfo.this.leftEye);
/* 3068 */ this.rightManualEyeInPlate.set(ViewInfo.this.rightEye);
/* 3069 */ this.updateManualEye = true;
/* */ }
/* */
/* 3080 */ updateCanvasDependencies();
/* 3081 */ this.updateStereo = false;
/* 3082 */ this.updateWindowScale = false;
/* 3083 */ this.updatePosition = false;
/* 3084 */ this.updateMonoPolicy = false;
/* 3085 */ this.updateManualEye = false;
/* 3086 */ this.updateCanvas = false;
/* */ }
/* */
/* */ private double getFieldOfViewOffset() {
/* 3090 */ return 0.5D * this.canvasWidth / Math.tan(0.5D * ViewInfo.this.view.getFieldOfView());
/* */ }
/* */
/* */ private void updateScreenDependencies() {
/* 3094 */ if ((ViewInfo.ScreenInfo.access$10000(this.si)) || (ViewInfo.ScreenInfo.access$10100(this.si))) {
/* 3095 */ if ((ViewInfo.this.eyePolicy == 1) || (ViewInfo.this.eyePolicy == 2))
/* */ {
/* 3099 */ this.updateEyeInPlate = true;
/* */ }
/* 3101 */ if ((ViewInfo.this.resizePolicy == 1) || (ViewInfo.this.eyePolicy == 2))
/* */ {
/* 3104 */ this.updateViewPlatformToCoe = true;
/* */ }
/* 3106 */ if (ViewInfo.this.resizePolicy == 1)
/* */ {
/* 3109 */ this.updateClipDistances = true;
/* 3110 */ this.updatePhysicalToVpScale = true;
/* 3111 */ this.updatePhysicalToVirtualScale = true;
/* */ }
/* */
/* 3114 */ this.updateProjection = true;
/* */ }
/* 3116 */ if ((ViewInfo.ScreenInfo.access$10100(this.si)) && (ViewInfo.this.scalePolicy == 0))
/* */ {
/* 3120 */ this.updateScreenScale = true;
/* 3121 */ this.updateClipDistances = true;
/* 3122 */ this.updatePhysicalToVpScale = true;
/* 3123 */ this.updatePhysicalToVirtualScale = true;
/* 3124 */ this.updateViewPlatformToCoe = true;
/* */ }
/* */
/* 3127 */ if (ViewInfo.this.viewPolicy == 1) {
/* 3128 */ if (ViewInfo.ScreenInfo.access$10600(this.si))
/* */ {
/* 3130 */ this.updateEyeInPlate = true;
/* 3131 */ this.updateCoeToPlate = true;
/* */ }
/* */ }
/* 3134 */ else if (ViewInfo.this.coeCentering) {
/* 3135 */ if (ViewInfo.this.movementPolicy == 1)
/* */ {
/* 3137 */ if ((ViewInfo.ScreenInfo.access$10000(this.si)) || (ViewInfo.ScreenInfo.access$10100(this.si)))
/* */ {
/* 3140 */ this.updateCoeToPlate = true;
/* */ }
/* 3142 */ } else if (ViewInfo.ScreenInfo.access$10100(this.si))
/* */ {
/* 3144 */ this.updateCoeToPlate = true;
/* */ }
/* 3146 */ } else if (ViewInfo.ScreenInfo.access$10900(this.si))
/* */ {
/* 3150 */ this.updateCoeToPlate = true;
/* */ }
/* */
/* 3153 */ if ((this.updateCoeToPlate) && (ViewInfo.this.eyePolicy == 3))
/* */ {
/* 3156 */ this.updateEyeInPlate = true;
/* */ }
/* 3158 */ if (this.updateViewPlatformToCoe)
/* */ {
/* 3161 */ this.updateCoeToViewPlatform = true;
/* 3162 */ this.updateCoeToVworld = true;
/* 3163 */ this.updateTrackerBaseToViewPlatform = true;
/* 3164 */ this.updateTrackerBaseToVworld = true;
/* */ }
/* 3166 */ if ((this.updateCoeToPlate) || (this.updateViewPlatformToCoe))
/* */ {
/* 3170 */ this.updatePlateToViewPlatform = true;
/* 3171 */ this.updatePlateToVworld = true;
/* */ }
/* 3173 */ updateEyeDependencies();
/* */ }
/* */
/* */ private void updateEyeDependencies() {
/* 3177 */ if (this.updateEyeInPlate) {
/* 3178 */ this.updateEyeToVworld = true;
/* 3179 */ this.updateProjection = true;
/* */ }
/* 3181 */ if (this.updateProjection) {
/* 3182 */ this.updateInverseProjection = true;
/* 3183 */ this.updateInverseViewPlatformProjection = true;
/* 3184 */ this.updateInverseVworldProjection = true;
/* */ }
/* 3186 */ if ((this.updateEyeInPlate) || (this.updatePlateToViewPlatform)) {
/* 3187 */ this.updateViewPlatformToEye = true;
/* 3188 */ this.updateEyeToViewPlatform = true;
/* */ }
/* */ }
/* */
/* */ private void updateCanvasDependencies() {
/* 3193 */ if ((this.updateStereo) || (this.updateMonoPolicy) || ((this.updateManualEye) && ((ViewInfo.this.eyePolicy == 1) || (ViewInfo.this.eyePolicy == 0))))
/* */ {
/* 3196 */ this.updateEyeInPlate = true;
/* */ }
/* 3198 */ if ((this.updateWindowScale) || (this.updatePosition)) {
/* 3199 */ if ((ViewInfo.this.coeCentering) && (ViewInfo.this.movementPolicy == 1))
/* */ {
/* 3201 */ this.updateCoeToPlate = true;
/* 3202 */ if (ViewInfo.this.eyePolicy == 3)
/* 3203 */ this.updateEyeInPlate = true;
/* */ }
/* 3205 */ if ((ViewInfo.this.eyePolicy == 2) || (ViewInfo.this.eyePolicy == 1))
/* */ {
/* 3208 */ this.updateEyeInPlate = true;
/* */ }
/* */ }
/* 3210 */ if (this.updateWindowScale) {
/* 3211 */ if ((ViewInfo.this.resizePolicy == 1) || (ViewInfo.this.eyePolicy == 2))
/* */ {
/* 3215 */ this.updateViewPlatformToCoe = true;
/* 3216 */ this.updateCoeToViewPlatform = true;
/* 3217 */ this.updateCoeToVworld = true;
/* 3218 */ this.updateTrackerBaseToViewPlatform = true;
/* 3219 */ this.updateTrackerBaseToVworld = true;
/* */ }
/* 3221 */ if (ViewInfo.this.resizePolicy == 1)
/* */ {
/* 3224 */ this.updateClipDistances = true;
/* 3225 */ this.updateProjection = true;
/* 3226 */ this.updatePhysicalToVpScale = true;
/* 3227 */ this.updatePhysicalToVirtualScale = true;
/* */ }
/* */ }
/* 3230 */ if ((this.updateViewPlatformToCoe) || (this.updateCoeToPlate))
/* */ {
/* 3234 */ this.updatePlateToViewPlatform = true;
/* 3235 */ this.updatePlateToVworld = true;
/* */ }
/* 3237 */ if ((ViewInfo.this.coeCentering) && (!this.updateManualEye) && (!this.updateWindowScale) && (ViewInfo.this.movementPolicy == 1) && (ViewInfo.this.eyePolicy != 0))
/* */ {
/* 3245 */ return;
/* */ }
/* 3247 */ updateEyeDependencies();
/* */ }
/* */
/* */ private void updateViewDependencies()
/* */ {
/* 3258 */ this.updateEyeInPlate = true;
/* */
/* 3265 */ this.updateProjection = true;
/* 3266 */ this.updateClipDistances = true;
/* 3267 */ this.updatePhysicalToVpScale = true;
/* 3268 */ this.updatePhysicalToVirtualScale = true;
/* */
/* 3272 */ this.updateCoeToPlate = true;
/* */
/* 3277 */ this.updateViewPlatformToCoe = true;
/* 3278 */ this.updateCoeToViewPlatform = true;
/* 3279 */ this.updateCoeToVworld = true;
/* */
/* 3284 */ this.updatePlateToViewPlatform = true;
/* 3285 */ this.updatePlateToVworld = true;
/* */
/* 3289 */ this.updateTrackerBaseToViewPlatform = true;
/* 3290 */ this.updateTrackerBaseToVworld = true;
/* */
/* 3293 */ this.updateScreenScale = true;
/* */
/* 3296 */ updateEyeDependencies();
/* */ }
/* */
/* */ private void updateHeadDependencies() {
/* 3300 */ if (ViewInfo.this.viewPolicy == 1)
/* */ {
/* 3306 */ this.updateCoeToPlate = true;
/* 3307 */ this.updatePlateToViewPlatform = true;
/* 3308 */ this.updatePlateToVworld = true;
/* 3309 */ this.updateViewPlatformToEye = true;
/* 3310 */ this.updateEyeToViewPlatform = true;
/* 3311 */ this.updateEyeToVworld = true;
/* 3312 */ this.updateInverseViewPlatformProjection = true;
/* 3313 */ this.updateInverseVworldProjection = true;
/* */ }
/* */ else
/* */ {
/* 3319 */ this.updateEyeInPlate = true;
/* 3320 */ updateEyeDependencies();
/* */ }
/* */ }
/* */
/* */ private void updateVworldDependencies() {
/* 3325 */ this.updatePlateToVworld = true;
/* 3326 */ this.updateCoeToVworld = true;
/* 3327 */ this.updateEyeToVworld = true;
/* 3328 */ this.updateTrackerBaseToVworld = true;
/* 3329 */ this.updateInverseVworldProjection = true;
/* */
/* 3331 */ if (ViewInfo.ViewPlatformInfo.access$11100(ViewInfo.this.vpi)) {
/* 3332 */ this.updatePhysicalToVirtualScale = true;
/* */ }
/* 3334 */ if ((ViewInfo.ViewPlatformInfo.access$11100(ViewInfo.this.vpi)) && (ViewInfo.this.clipVirtual))
/* */ {
/* 3337 */ this.updateProjection = true;
/* 3338 */ this.updateClipDistances = true;
/* 3339 */ this.updateInverseProjection = true;
/* 3340 */ this.updateInverseViewPlatformProjection = true;
/* */ }
/* */ }
/* */
/* */ CanvasInfo(Canvas3D x1, ViewInfo.ScreenInfo x2, ViewInfo.1 x3)
/* */ {
/* 2847 */ this(x1, x2);
/* */ }
/* */ }
/* */
/* */ private static class ViewPlatformInfo
/* */ {
/* 2766 */ private ViewPlatform vp = null;
/* 2767 */ private List viewInfo = new LinkedList();
/* 2768 */ private double[] m = new double[16];
/* */
/* 2776 */ private Transform3D viewPlatformToVworld = new Transform3D();
/* 2777 */ private Transform3D vworldToViewPlatform = new Transform3D();
/* 2778 */ private double vworldToViewPlatformScale = 1.0D;
/* */
/* 2782 */ private boolean updateViewPlatformToVworld = false;
/* 2783 */ private boolean updateVworldScale = false;
/* */
/* */ private ViewPlatformInfo(ViewPlatform vp) {
/* 2786 */ this.vp = vp;
/* */ }
/* */
/* */ private synchronized void addViewInfo(ViewInfo vi)
/* */ {
/* 2792 */ this.viewInfo.add(vi);
/* */ }
/* */
/* */ private synchronized void removeViewInfo(ViewInfo vi) {
/* 2796 */ this.viewInfo.remove(vi);
/* */ }
/* */
/* */ private synchronized void clear() {
/* 2800 */ Iterator i = this.viewInfo.iterator();
/* 2801 */ while (i.hasNext()) ((ViewInfo)i.next()).clearViewPlatform();
/* 2802 */ this.viewInfo.clear();
/* */ }
/* */
/* */ private synchronized void getViewPlatformToVworld()
/* */ {
/* 2813 */ this.vp.getLocalToVworld(this.viewPlatformToVworld);
/* 2814 */ this.vworldToViewPlatform.invert(this.viewPlatformToVworld);
/* */
/* 2818 */ this.vworldToViewPlatform.get(this.m);
/* 2819 */ double newScale = Math.sqrt(this.m[0] * this.m[0] + this.m[1] * this.m[1] + this.m[2] * this.m[2]);
/* */
/* 2826 */ if ((newScale > this.vworldToViewPlatformScale + 1.0E-007D) || (newScale < this.vworldToViewPlatformScale - 1.0E-007D))
/* */ {
/* 2828 */ this.vworldToViewPlatformScale = newScale;
/* 2829 */ this.updateVworldScale = true;
/* */ }
/* */
/* 2835 */ Iterator i = this.viewInfo.iterator();
/* 2836 */ while (i.hasNext()) {
/* 2837 */ ((ViewInfo)i.next()).updateVworldDependencies();
/* */ }
/* 2839 */ this.updateVworldScale = false;
/* 2840 */ this.updateViewPlatformToVworld = false;
/* */ }
/* */
/* */ ViewPlatformInfo(ViewPlatform x0, ViewInfo.1 x1)
/* */ {
/* 2765 */ this(x0);
/* */ }
/* */ }
/* */
/* */ private static class ScreenInfo
/* */ {
/* 2602 */ private Screen3D s3d = null;
/* 2603 */ private GraphicsConfiguration graphicsConfiguration = null;
/* 2604 */ private boolean updateScreen = true;
/* */
/* 2606 */ private Map viewInfoMap = new HashMap();
/* 2607 */ private List viewInfoList = new LinkedList();
/* 2608 */ private Transform3D t3d = new Transform3D();
/* */
/* 2610 */ private double screenWidth = 0.0D;
/* 2611 */ private double screenHeight = 0.0D;
/* 2612 */ private boolean updateScreenSize = true;
/* */
/* 2614 */ private Rectangle screenBounds = null;
/* 2615 */ private double metersPerPixelX = 0.0D;
/* 2616 */ private double metersPerPixelY = 0.0D;
/* 2617 */ private boolean updatePixelSize = true;
/* */
/* 2624 */ private Transform3D trackerBaseToPlate = new Transform3D();
/* 2625 */ private Transform3D headTrackerToLeftPlate = new Transform3D();
/* 2626 */ private Transform3D headTrackerToRightPlate = new Transform3D();
/* 2627 */ private boolean updateTrackerBaseToPlate = false;
/* 2628 */ private boolean updateHeadTrackerToPlate = false;
/* */
/* */ private ScreenInfo(Screen3D s3d, GraphicsConfiguration gc) {
/* 2631 */ this.s3d = s3d;
/* 2632 */ this.graphicsConfiguration = gc;
/* */ }
/* */
/* */ private List getCanvasList(ViewInfo vi)
/* */ {
/* 2638 */ List canvasList = (List)this.viewInfoMap.get(vi);
/* 2639 */ if (canvasList == null) {
/* 2640 */ canvasList = new LinkedList();
/* 2641 */ this.viewInfoMap.put(vi, canvasList);
/* 2642 */ this.viewInfoList.add(canvasList);
/* */ }
/* 2644 */ return canvasList;
/* */ }
/* */
/* */ private synchronized void clear(ViewInfo vi) {
/* 2648 */ getCanvasList(vi).clear();
/* */ }
/* */
/* */ private synchronized void clear() {
/* 2652 */ Iterator i = this.viewInfoMap.keySet().iterator();
/* 2653 */ while (i.hasNext()) ((ViewInfo)i.next()).clearCanvases();
/* 2654 */ this.viewInfoMap.clear();
/* */
/* 2656 */ i = this.viewInfoList.iterator();
/* 2657 */ while (i.hasNext()) ((List)i.next()).clear();
/* 2658 */ this.viewInfoList.clear();
/* */ }
/* */
/* */ private synchronized void addCanvasInfo(ViewInfo vi, ViewInfo.CanvasInfo ci) {
/* 2662 */ getCanvasList(vi).add(ci);
/* */ }
/* */
/* */ private synchronized void getScreenInfo()
/* */ {
/* 2681 */ this.s3d.getTrackerBaseToImagePlate(this.t3d);
/* 2682 */ if (!this.t3d.equals(this.trackerBaseToPlate)) {
/* 2683 */ this.trackerBaseToPlate.set(this.t3d);
/* 2684 */ this.updateTrackerBaseToPlate = true;
/* */ }
/* */
/* 2692 */ this.s3d.getHeadTrackerToLeftImagePlate(this.t3d);
/* 2693 */ if (!this.t3d.equals(this.headTrackerToLeftPlate)) {
/* 2694 */ this.headTrackerToLeftPlate.set(this.t3d);
/* 2695 */ this.updateHeadTrackerToPlate = true;
/* */ }
/* */
/* 2700 */ this.s3d.getHeadTrackerToRightImagePlate(this.t3d);
/* 2701 */ if (!this.t3d.equals(this.headTrackerToRightPlate)) {
/* 2702 */ this.headTrackerToRightPlate.set(this.t3d);
/* 2703 */ this.updateHeadTrackerToPlate = true;
/* */ }
/* */
/* 2715 */ double w = this.s3d.getPhysicalScreenWidth();
/* 2716 */ double h = this.s3d.getPhysicalScreenHeight();
/* 2717 */ if ((w != this.screenWidth) || (h != this.screenHeight)) {
/* 2718 */ this.screenWidth = w;
/* 2719 */ this.screenHeight = h;
/* 2720 */ this.updateScreenSize = true;
/* */ }
/* */
/* 2727 */ this.screenBounds = this.graphicsConfiguration.getBounds();
/* 2728 */ double mpx = this.screenWidth / this.screenBounds.width;
/* 2729 */ double mpy = this.screenHeight / this.screenBounds.height;
/* 2730 */ if ((mpx != this.metersPerPixelX) || (mpy != this.metersPerPixelY)) {
/* 2731 */ this.metersPerPixelX = mpx;
/* 2732 */ this.metersPerPixelY = mpy;
/* 2733 */ this.updatePixelSize = true;
/* */ }
/* */
/* 2742 */ Iterator vi = this.viewInfoList.iterator();
/* 2743 */ while (vi.hasNext()) {
/* 2744 */ Iterator ci = ((List)vi.next()).iterator();
/* 2745 */ while (ci.hasNext()) {
/* 2746 */ ((ViewInfo.CanvasInfo)ci.next()).updateScreenDependencies();
/* */ }
/* */ }
/* 2749 */ this.updateTrackerBaseToPlate = false;
/* 2750 */ this.updateHeadTrackerToPlate = false;
/* 2751 */ this.updateScreenSize = false;
/* 2752 */ this.updatePixelSize = false;
/* 2753 */ this.updateScreen = false;
/* */ }
/* */
/* */ ScreenInfo(Screen3D x0, GraphicsConfiguration x1, ViewInfo.1 x2)
/* */ {
/* 2601 */ this(x0, x1);
/* */ }
/* */ }
/* */ }
/* Location: Z:\System\Library\Java\Extensions\j3dutils.jar
* Qualified Name: com.sun.j3d.utils.universe.ViewInfo
* JD-Core Version: 0.6.2
*/