Package com.sun.j3d.utils.universe

Source Code of com.sun.j3d.utils.universe.ConfigPhysicalBody

/*     */ package com.sun.j3d.utils.universe;
/*     */
/*     */ import javax.media.j3d.PhysicalBody;
/*     */ import javax.media.j3d.Transform3D;
/*     */ import javax.vecmath.Matrix4d;
/*     */ import javax.vecmath.Point3d;
/*     */
/*     */ class ConfigPhysicalBody extends ConfigObject
/*     */ {
/*  51 */   Point3d leftEyePosition = new Point3d(-0.033D, 0.0D, 0.0D);
/*  52 */   Point3d rightEyePosition = new Point3d(0.033D, 0.0D, 0.0D);
/*  53 */   double stereoEyeSeparation = 1.7976931348623157E+308D;
/*     */
/*  55 */   Point3d leftEarPosition = new Point3d(-0.08D, -0.03D, 0.09D);
/*  56 */   Point3d rightEarPosition = new Point3d(0.08D, -0.03D, 0.09D);
/*     */
/*  58 */   double nominalEyeHeightFromGround = 1.68D;
/*  59 */   double nominalEyeOffsetFromNominalScreen = 0.4572D;
/*     */
/*  61 */   Matrix4d headToHeadTracker = new Matrix4d(1.0D, 0.0D, 0.0D, 0.0D, 0.0D, 1.0D, 0.0D, 0.0D, 0.0D, 0.0D, 1.0D, 0.0D, 0.0D, 0.0D, 0.0D, 1.0D);
/*     */   PhysicalBody j3dPhysicalBody;
/*     */
/*     */   protected void initialize(ConfigCommand command)
/*     */   {
/*     */   }
/*     */
/*     */   protected void setProperty(ConfigCommand command)
/*     */   {
/*  74 */     int argc = command.argc;
/*  75 */     Object[] argv = command.argv;
/*     */
/*  80 */     if (argc != 4) {
/*  81 */       syntaxError("Incorrect number of arguments to " + command.commandName);
/*     */     }
/*     */
/*  85 */     if (!isName(argv[1])) {
/*  86 */       syntaxError("The first argument to " + command.commandName + " must be a name");
/*     */     }
/*     */
/*  90 */     if (!isName(argv[2])) {
/*  91 */       syntaxError("The second argument to " + command.commandName + " must be an property/attribute name");
/*     */     }
/*     */
/*  95 */     String prop = (String)argv[2];
/*  96 */     Object val = argv[3];
/*     */
/*  98 */     if (prop.equals("StereoEyeSeparation")) {
/*  99 */       if (!(val instanceof Double)) {
/* 100 */         syntaxError("StereoEyeSeparation must be a number");
/*     */       }
/* 102 */       this.stereoEyeSeparation = ((Double)val).doubleValue();
/*     */     }
/* 104 */     else if (prop.equals("LeftEyePosition")) {
/* 105 */       if (!(val instanceof Point3d)) {
/* 106 */         syntaxError("LeftEyePosition must be a point");
/*     */       }
/* 108 */       this.leftEyePosition = ((Point3d)val);
/*     */     }
/* 110 */     else if (prop.equals("RightEyePosition")) {
/* 111 */       if (!(val instanceof Point3d)) {
/* 112 */         syntaxError("RightEyePosition must be a point");
/*     */       }
/* 114 */       this.rightEyePosition = ((Point3d)val);
/*     */     }
/* 116 */     else if (prop.equals("LeftEarPosition")) {
/* 117 */       if (!(val instanceof Point3d)) {
/* 118 */         syntaxError("LeftEarPosition must be a point");
/*     */       }
/* 120 */       this.leftEarPosition = ((Point3d)val);
/*     */     }
/* 122 */     else if (prop.equals("RightEarPosition")) {
/* 123 */       if (!(val instanceof Point3d)) {
/* 124 */         syntaxError("RightEarPosition must be a point");
/*     */       }
/* 126 */       this.leftEarPosition = ((Point3d)val);
/*     */     }
/* 128 */     else if (prop.equals("NominalEyeHeightFromGround")) {
/* 129 */       if (!(val instanceof Double)) {
/* 130 */         syntaxError("NominalEyeHeightFromGround must be a number");
/*     */       }
/* 132 */       this.nominalEyeHeightFromGround = ((Double)val).doubleValue();
/*     */     }
/* 134 */     else if (prop.equals("NominalEyeOffsetFromNominalScreen")) {
/* 135 */       if (!(val instanceof Double)) {
/* 136 */         syntaxError("NominalEyeOffsetFromNominalScreen must be a number");
/*     */       }
/*     */
/* 139 */       this.nominalEyeOffsetFromNominalScreen = ((Double)val).doubleValue();
/*     */     }
/* 141 */     else if (prop.equals("HeadToHeadTracker")) {
/* 142 */       if (!(val instanceof Matrix4d)) {
/* 143 */         syntaxError("HeadToHeadTracker must be a matrix");
/*     */       }
/* 145 */       this.headToHeadTracker = ((Matrix4d)val);
/*     */     }
/*     */     else {
/* 148 */       syntaxError("Unknown " + command.commandName + " \"" + prop + "\"");
/*     */     }
/*     */   }
/*     */
/*     */   PhysicalBody createJ3dPhysicalBody()
/*     */   {
/* 155 */     if (this.stereoEyeSeparation < 1.7976931348623157E+308D) {
/* 156 */       this.leftEyePosition.set(-this.stereoEyeSeparation / 2.0D, 0.0D, 0.0D);
/* 157 */       this.rightEyePosition.set(this.stereoEyeSeparation / 2.0D, 0.0D, 0.0D);
/*     */     }
/*     */
/* 160 */     this.j3dPhysicalBody = new PhysicalBody(this.leftEyePosition, this.rightEyePosition, this.leftEarPosition, this.rightEarPosition);
/*     */
/* 163 */     this.j3dPhysicalBody.setHeadToHeadTracker(new Transform3D(this.headToHeadTracker));
/*     */
/* 166 */     this.j3dPhysicalBody.setNominalEyeHeightFromGround(this.nominalEyeHeightFromGround);
/*     */
/* 168 */     this.j3dPhysicalBody.setNominalEyeOffsetFromNominalScreen(this.nominalEyeOffsetFromNominalScreen);
/*     */
/* 171 */     return this.j3dPhysicalBody;
/*     */   }
/*     */ }

/* Location:           Z:\System\Library\Java\Extensions\j3dutils.jar
* Qualified Name:     com.sun.j3d.utils.universe.ConfigPhysicalBody
* JD-Core Version:    0.6.2
*/
TOP

Related Classes of com.sun.j3d.utils.universe.ConfigPhysicalBody

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.