Package com.sun.j3d.loaders.lw3d

Source Code of com.sun.j3d.loaders.lw3d.LwsBackground

/*     */ package com.sun.j3d.loaders.lw3d;
/*     */
/*     */ import com.sun.j3d.loaders.ParsingErrorException;
/*     */ import java.io.IOException;
/*     */ import java.io.StreamTokenizer;
/*     */ import javax.media.j3d.Background;
/*     */ import javax.media.j3d.BoundingSphere;
/*     */ import javax.vecmath.Color3f;
/*     */ import javax.vecmath.Point3d;
/*     */
/*     */ class LwsBackground extends TextfileParser
/*     */ {
/*     */   int solidBackdrop;
/*     */   Color3f color;
/*     */   Color3f zenithColor;
/*     */   Color3f skyColor;
/*     */   Color3f groundColor;
/*     */   Color3f nadirColor;
/*  64 */   Background backgroundObject = null;
/*     */
/*     */   LwsBackground(StreamTokenizer st, int debugVals)
/*     */     throws ParsingErrorException
/*     */   {
/*  73 */     this.debugPrinter.setValidOutput(debugVals);
/*  74 */     debugOutput(1, "LwsBackground()");
/*  75 */     this.color = new Color3f(0.0F, 0.0F, 0.0F);
/*  76 */     this.zenithColor = new Color3f(0.0F, 0.0F, 0.0F);
/*  77 */     this.skyColor = new Color3f(0.0F, 0.0F, 0.0F);
/*  78 */     this.groundColor = new Color3f(0.0F, 0.0F, 0.0F);
/*  79 */     this.nadirColor = new Color3f(0.0F, 0.0F, 0.0F);
/*     */
/*  81 */     this.solidBackdrop = ((int)getNumber(st));
/*  82 */     while (!isCurrentToken(st, "FogType")) {
/*  83 */       debugOutputLn(8, "currentToken = " + st.sval);
/*     */
/*  85 */       if (isCurrentToken(st, "BackdropColor")) {
/*  86 */         this.color.x = ((float)getNumber(st) / 255.0F);
/*  87 */         this.color.y = ((float)getNumber(st) / 255.0F);
/*  88 */         this.color.z = ((float)getNumber(st) / 255.0F);
/*     */       }
/*  90 */       else if (isCurrentToken(st, "NadirColor")) {
/*  91 */         this.nadirColor.x = ((float)getNumber(st) / 255.0F);
/*  92 */         this.nadirColor.y = ((float)getNumber(st) / 255.0F);
/*  93 */         this.nadirColor.z = ((float)getNumber(st) / 255.0F);
/*     */       }
/*  95 */       else if (isCurrentToken(st, "SkyColor")) {
/*  96 */         this.skyColor.x = ((float)getNumber(st) / 255.0F);
/*  97 */         this.skyColor.y = ((float)getNumber(st) / 255.0F);
/*  98 */         this.skyColor.z = ((float)getNumber(st) / 255.0F);
/*     */       }
/* 100 */       else if (isCurrentToken(st, "GroundColor")) {
/* 101 */         this.groundColor.x = ((float)getNumber(st) / 255.0F);
/* 102 */         this.groundColor.y = ((float)getNumber(st) / 255.0F);
/* 103 */         this.groundColor.z = ((float)getNumber(st) / 255.0F);
/*     */       }
/* 105 */       else if (isCurrentToken(st, "NadirColor")) {
/* 106 */         this.nadirColor.x = ((float)getNumber(st) / 255.0F);
/* 107 */         this.nadirColor.y = ((float)getNumber(st) / 255.0F);
/* 108 */         this.nadirColor.z = ((float)getNumber(st) / 255.0F);
/*     */       }
/*     */       try {
/* 111 */         st.nextToken();
/*     */       }
/*     */       catch (IOException e) {
/* 114 */         throw new ParsingErrorException(e.getMessage());
/*     */       }
/*     */     }
/* 117 */     st.pushBack();
/*     */   }
/*     */
/*     */   void createJava3dObject()
/*     */   {
/* 139 */     if (this.solidBackdrop != 0) {
/* 140 */       this.backgroundObject = new Background(this.color);
/* 141 */       debugOutput(2, "Background color = " + this.color);
/*     */     }
/*     */     else {
/* 144 */       this.backgroundObject = new Background(this.skyColor);
/* 145 */       debugOutput(2, "Background color = " + this.skyColor);
/*     */     }
/* 147 */     BoundingSphere bounds = new BoundingSphere(new Point3d(0.0D, 0.0D, 0.0D), 100000.0D);
/* 148 */     this.backgroundObject.setApplicationBounds(bounds);
/*     */   }
/*     */
/*     */   Background getObjectNode() {
/* 152 */     return this.backgroundObject;
/*     */   }
/*     */
/*     */   void printVals() {
/* 156 */     debugOutputLn(2, "  BACKGROUND vals: ");
/*     */   }
/*     */ }

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

Related Classes of com.sun.j3d.loaders.lw3d.LwsBackground

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.