Package com.sun.j3d.utils.universe

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

/*     */ package com.sun.j3d.utils.universe;
/*     */
/*     */ import java.util.ArrayList;
/*     */ import javax.media.j3d.InputDevice;
/*     */ import javax.media.j3d.PhysicalEnvironment;
/*     */ import javax.media.j3d.Transform3D;
/*     */ import javax.vecmath.Matrix4d;
/*     */
/*     */ class ConfigPhysicalEnvironment extends ConfigObject
/*     */ {
/*  51 */   PhysicalEnvironment j3dPhysicalEnvironment = null;
/*     */
/*  56 */   Matrix4d coexistenceToTrackerBase = null;
/*     */
/*  59 */   private ConfigSensor headTracker = null;
/*  60 */   private ArrayList inputDevices = new ArrayList();
/*  61 */   private int coexistenceCenterInPworldPolicy = 2;
/*     */
/*     */   protected void initialize(ConfigCommand command)
/*     */   {
/*     */   }
/*     */
/*     */   protected void setProperty(ConfigCommand command)
/*     */   {
/*  78 */     Object[] argv = command.argv;
/*  79 */     int argc = command.argc;
/*     */
/*  82 */     if (argc != 4) {
/*  83 */       syntaxError("Incorrect number of arguments to " + command.commandName);
/*     */     }
/*     */
/*  87 */     if (!isName(argv[1])) {
/*  88 */       syntaxError("The first argument to " + command.commandName + " must be a name");
/*     */     }
/*     */
/*  92 */     if (!isName(argv[2])) {
/*  93 */       syntaxError("The second argument to " + command.commandName + " must be a property name");
/*     */     }
/*     */
/*  97 */     String prop = (String)argv[2];
/*  98 */     Object val = argv[3];
/*     */
/* 100 */     if (prop.equals("CoexistenceCenterInPworldPolicy")) {
/* 101 */       if (!(val instanceof String)) {
/* 102 */         syntaxError("CoexistenceCenterInPworldPolicy must be string");
/*     */       }
/* 104 */       String sval = (String)val;
/* 105 */       if (sval.equals("NOMINAL_HEAD"))
/* 106 */         this.coexistenceCenterInPworldPolicy = 0;
/* 107 */       else if (sval.equals("NOMINAL_SCREEN"))
/* 108 */         this.coexistenceCenterInPworldPolicy = 2;
/* 109 */       else if (sval.equals("NOMINAL_FEET"))
/* 110 */         this.coexistenceCenterInPworldPolicy = 1;
/*     */       else {
/* 112 */         syntaxError("Illegal value " + sval + " for CoexistenceCenterInPworldPolicy");
/*     */       }
/*     */     }
/* 115 */     else if (prop.equals("CoexistenceToTrackerBase")) {
/* 116 */       if ((val instanceof Matrix4d))
/* 117 */         this.coexistenceToTrackerBase = ((Matrix4d)val);
/*     */       else
/* 119 */         syntaxError("CoexistenceToTrackerBase must be a Matrix4d");
/*     */     }
/* 121 */     else if (prop.equals("InputDevice")) {
/* 122 */       if (!(val instanceof String)) {
/* 123 */         syntaxError("InputDevice must be a name");
/*     */       }
/* 125 */       String sval = (String)val;
/* 126 */       this.inputDevices.add(this.configContainer.findConfigObject("Device", sval));
/*     */     }
/* 128 */     else if (prop.equals("HeadTracker")) {
/* 129 */       if (!(val instanceof String)) {
/* 130 */         syntaxError("HeadTracker must be a Sensor name");
/*     */       }
/* 132 */       String sval = (String)val;
/* 133 */       this.headTracker = ((ConfigSensor)this.configContainer.findConfigObject("Sensor", sval));
/*     */     }
/*     */     else
/*     */     {
/* 137 */       syntaxError("Unknown " + command.commandName + " \"" + prop + "\"");
/*     */     }
/*     */   }
/*     */
/*     */   PhysicalEnvironment createJ3dPhysicalEnvironment()
/*     */   {
/* 147 */     this.j3dPhysicalEnvironment = new PhysicalEnvironment();
/*     */
/* 149 */     this.j3dPhysicalEnvironment.setCoexistenceCenterInPworldPolicy(this.coexistenceCenterInPworldPolicy);
/*     */
/* 152 */     if (this.coexistenceToTrackerBase != null) {
/* 153 */       this.j3dPhysicalEnvironment.setCoexistenceToTrackerBase(new Transform3D(this.coexistenceToTrackerBase));
/*     */     }
/*     */
/* 156 */     return this.j3dPhysicalEnvironment;
/*     */   }
/*     */
/*     */   void processDevices()
/*     */   {
/* 163 */     for (int j = 0; j < this.inputDevices.size(); j++) {
/* 164 */       ConfigDevice configDevice = (ConfigDevice)this.inputDevices.get(j);
/* 165 */       InputDevice device = configDevice.j3dInputDevice;
/* 166 */       this.j3dPhysicalEnvironment.addInputDevice(device);
/*     */     }
/*     */
/* 169 */     if (this.headTracker != null) {
/* 170 */       this.j3dPhysicalEnvironment.setHeadIndex(0);
/* 171 */       this.j3dPhysicalEnvironment.setSensor(0, this.headTracker.j3dSensor);
/*     */     }
/*     */   }
/*     */ }

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

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

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.