/* */ package com.sun.j3d.loaders.lw3d;
/* */
/* */ import com.sun.j3d.loaders.ParsingErrorException;
/* */ import java.io.IOException;
/* */ import java.io.PrintStream;
/* */ import java.io.StreamTokenizer;
/* */ import java.util.Vector;
/* */ import javax.media.j3d.Behavior;
/* */ import javax.media.j3d.Transform3D;
/* */ import javax.media.j3d.TransformGroup;
/* */ import javax.vecmath.Matrix4d;
/* */
/* */ class LwsCamera extends TextfileParser
/* */ implements LwsPrimitive
/* */ {
/* */ String fileName;
/* */ String objName;
/* */ LwsMotion motion;
/* */ int parent;
/* */ TransformGroup objectTransform;
/* */ Vector objectBehavior;
/* */
/* */ LwsCamera(StreamTokenizer st, int firstFrame, int totalFrames, float totalTime, int debugVals)
/* */ throws ParsingErrorException
/* */ {
/* 74 */ this.debugPrinter.setValidOutput(debugVals);
/* 75 */ this.parent = -1;
/* 76 */ getNumber(st);
/* 77 */ getNumber(st);
/* 78 */ getAndCheckString(st, "CameraMotion");
/* 79 */ this.motion = new LwsMotion(st, firstFrame, totalFrames, totalTime, this.debugPrinter.getValidOutput());
/* */
/* 86 */ while (!isCurrentToken(st, "DepthOfField")) {
/* 87 */ debugOutputLn(8, "currentToken = " + st.sval);
/* */
/* 89 */ if (isCurrentToken(st, "ParentObject"))
/* 90 */ this.parent = ((int)getNumber(st));
/* */ try
/* */ {
/* 93 */ st.nextToken();
/* */ }
/* */ catch (IOException e) {
/* 96 */ throw new ParsingErrorException(e.getMessage());
/* */ }
/* */ }
/* 99 */ getNumber(st);
/* */ }
/* */
/* */ int getParent()
/* */ {
/* 106 */ return this.parent;
/* */ }
/* */
/* */ void createJava3dObject(int loadBehaviors)
/* */ {
/* 116 */ Matrix4d mat = new Matrix4d();
/* 117 */ mat.setIdentity();
/* */
/* 120 */ LwsFrame firstFrame = this.motion.getFirstFrame();
/* 121 */ firstFrame.setMatrix(mat);
/* 122 */ debugOutputLn(2, " Camera Matrix = \n" + mat);
/* 123 */ Transform3D t1 = new Transform3D();
/* 124 */ Matrix4d m = new Matrix4d();
/* 125 */ double scale = 0.1D;
/* 126 */ m.setColumn(0, scale, 0.0D, 0.0D, 0.0D);
/* 127 */ m.setColumn(1, 0.0D, scale, 0.0D, 0.0D);
/* 128 */ m.setColumn(2, 0.0D, 0.0D, scale, 0.0D);
/* 129 */ m.setColumn(3, 0.0D, 0.0D, 0.0D, 1.0D);
/* 130 */ Transform3D scaleTrans = new Transform3D(m);
/* 131 */ TransformGroup scaleGroup = new TransformGroup(scaleTrans);
/* 132 */ scaleGroup.setCapability(18);
/* 133 */ scaleGroup.setCapability(17);
/* */
/* 135 */ t1.set(mat);
/* 136 */ this.objectTransform = new TransformGroup(t1);
/* 137 */ this.objectTransform.setCapability(18);
/* 138 */ this.objectBehavior = new Vector();
/* 139 */ if (loadBehaviors != 0) {
/* 140 */ this.motion.createJava3dBehaviors(this.objectTransform);
/* 141 */ Behavior b = this.motion.getBehaviors();
/* 142 */ if (b != null)
/* 143 */ this.objectBehavior.addElement(b);
/* */ }
/* */ }
/* */
/* */ public TransformGroup getObjectNode()
/* */ {
/* 152 */ return this.objectTransform;
/* */ }
/* */
/* */ public Vector getObjectBehaviors()
/* */ {
/* 160 */ debugOutputLn(1, "getObjectBehaviors()");
/* 161 */ return this.objectBehavior;
/* */ }
/* */
/* */ void printVals()
/* */ {
/* 170 */ System.out.println(" objName = " + this.objName);
/* 171 */ this.motion.printVals();
/* */ }
/* */ }
/* Location: Z:\System\Library\Java\Extensions\j3dutils.jar
* Qualified Name: com.sun.j3d.loaders.lw3d.LwsCamera
* JD-Core Version: 0.6.2
*/