com.sun.j3d.loaders.lw3d
Class J3dLwoParser

java.lang.Object
  extended by com.sun.j3d.loaders.lw3d.ParserObject
      extended by com.sun.j3d.loaders.lw3d.LwoParser
          extended by com.sun.j3d.loaders.lw3d.J3dLwoParser

 class J3dLwoParser
extends LwoParser

This class is responsible for turning Lightwave geometry data into Java3D geometry. It is a subclass of LwoObject and calls that superclass when first instantiated to parse the binary file and turn it into intermediate data structures. J3dLwoParser then goes through those data structures and turns them into Java3D objects. For each ShapeHolder object created by the parent class, this class retrieves the geometry data and associated surface data, creates the appropriate Geometry object (usually IndexedTriangleFanArray, unless the object is points or lines), including calculating normals for the polygons and sets up the Appearance according to the surface parameters (including calculating texture coordinates if necessary).


Field Summary
(package private)  Color3f color
           
(package private)  Color3f diffuseColor
           
(package private)  Color3f emissiveColor
           
(package private)  float[] normalCoordsArray
           
(package private)  int[] normalIndicesArray
           
(package private)  Shape3D objectShape
           
(package private)  java.util.Vector objectShapeList
           
(package private)  float shininess
           
(package private)  Color3f specularColor
           
 
Fields inherited from class com.sun.j3d.loaders.lw3d.LwoParser
blue, coordsArray, currLength, diffuse, facetIndicesArray, facetSizesArray, gloss, green, luminosity, red, shapeList, specular, surfaceList, surfNameList, theReader, transparency
 
Fields inherited from class com.sun.j3d.loaders.lw3d.ParserObject
debugPrinter, EXCEPTION, LINE_TRACE, MISC, NONE, TIME, TRACE, VALUES, WARNING
 
Constructor Summary
J3dLwoParser(java.lang.String fileName, int debugVals)
          Constructor: Calls LwoObject to parse file and create data structures
J3dLwoParser(java.net.URL url, int debugVals)
           
 
Method Summary
(package private)  void calculateCylindricalTextureCoords(int textureAxis, Vector3f textureSize, Vector3f textureCenter, float[] textureCoords, int[] textureIndices, float[] verts, int[] indices)
          See the comments in calculateTextureCoordinates
(package private)  void calculatePlanarTextureCoords(int textureAxis, Vector3f textureSize, Vector3f textureCenter, float[] textureCoords, int[] textureIndices, float[] verts, int[] indices)
          See the comments in calculateTextureCoordinates
(package private)  void calculateSphericalTextureCoords(int textureAxis, Vector3f textureCenter, float[] textureCoords, int[] textureIndices, float[] verts, int[] indices)
          See the comments in calculateTextureCoordinates
(package private)  void calculateTextureCoords(LwoTexture texture, float[] verts, int[] indices, float[] textureCoords, int[] textureIndices)
          Calculate texture coordinates for the geometry given the texture map properties specified in the LwoTexture object
(package private)  void createJava3dGeometry()
          Turns LwoObject's data structures (created from the binary geometry file) into Java3d objects
(package private)  Shape3D getJava3dShape()
           
(package private)  java.util.Vector getJava3dShapeList()
           
(package private)  void getSurf(int length)
          Creates new LwoSurface object that parses file and gets all surface parameters for a particular surface
(package private)  double xyztoh(float x, float y, float z)
          See the comments in calculateTextureCoordinates
(package private)  double xyztop(float x, float y, float z)
          See the comments in calculateTextureCoordinates
 
Methods inherited from class com.sun.j3d.loaders.lw3d.LwoParser
getAppropriateShape, getPnts, getPols, getSrfs, main, parseFile, skipDetailPolygons
 
Methods inherited from class com.sun.j3d.loaders.lw3d.ParserObject
debugOutput, debugOutputLn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

normalCoordsArray

float[] normalCoordsArray

normalIndicesArray

int[] normalIndicesArray

objectShape

Shape3D objectShape

color

Color3f color

diffuseColor

Color3f diffuseColor

specularColor

Color3f specularColor

emissiveColor

Color3f emissiveColor

shininess

float shininess

objectShapeList

java.util.Vector objectShapeList
Constructor Detail

J3dLwoParser

J3dLwoParser(java.lang.String fileName,
             int debugVals)
       throws java.io.FileNotFoundException
Constructor: Calls LwoObject to parse file and create data structures

Throws:
java.io.FileNotFoundException

J3dLwoParser

J3dLwoParser(java.net.URL url,
             int debugVals)
       throws java.io.FileNotFoundException
Throws:
java.io.FileNotFoundException
Method Detail

getSurf

void getSurf(int length)
       throws java.io.FileNotFoundException
Description copied from class: LwoParser
Creates new LwoSurface object that parses file and gets all surface parameters for a particular surface

Overrides:
getSurf in class LwoParser
Throws:
java.io.FileNotFoundException

createJava3dGeometry

void createJava3dGeometry()
                    throws IncorrectFormatException
Turns LwoObject's data structures (created from the binary geometry file) into Java3d objects

Throws:
IncorrectFormatException

calculateTextureCoords

void calculateTextureCoords(LwoTexture texture,
                            float[] verts,
                            int[] indices,
                            float[] textureCoords,
                            int[] textureIndices)
Calculate texture coordinates for the geometry given the texture map properties specified in the LwoTexture object


xyztoh

double xyztoh(float x,
              float y,
              float z)
See the comments in calculateTextureCoordinates


xyztop

double xyztop(float x,
              float y,
              float z)
See the comments in calculateTextureCoordinates


calculateSphericalTextureCoords

void calculateSphericalTextureCoords(int textureAxis,
                                     Vector3f textureCenter,
                                     float[] textureCoords,
                                     int[] textureIndices,
                                     float[] verts,
                                     int[] indices)
See the comments in calculateTextureCoordinates


calculateCylindricalTextureCoords

void calculateCylindricalTextureCoords(int textureAxis,
                                       Vector3f textureSize,
                                       Vector3f textureCenter,
                                       float[] textureCoords,
                                       int[] textureIndices,
                                       float[] verts,
                                       int[] indices)
See the comments in calculateTextureCoordinates


calculatePlanarTextureCoords

void calculatePlanarTextureCoords(int textureAxis,
                                  Vector3f textureSize,
                                  Vector3f textureCenter,
                                  float[] textureCoords,
                                  int[] textureIndices,
                                  float[] verts,
                                  int[] indices)
See the comments in calculateTextureCoordinates


getJava3dShape

Shape3D getJava3dShape()

getJava3dShapeList

java.util.Vector getJava3dShapeList()


Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.