com.sun.j3d.loaders.lw3d
Class LwoTexture

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

 class LwoTexture
extends ParserObject

This class is responsible for parsing the binary data in an Object file that describes a texture for a particular surface and turning that data into Java3D texture data. If the texture is coming from a file (which is the only type of texture handled by the loader currently; other types of texture definitions are ignored), then this class instantiates a TargaReader object to read the data in that file. Once all of the data has been read, the class creates a Java3D Texture object by first scaling the image using the ImageScaler class (since all textures must have width/height = power of 2; Note: this functionality is now built into the TextureLoader class, so it could be removed from this loader) and then creating a Texture with that image.


Field Summary
(package private)  int blue
           
(package private)  Color3f color
           
(package private)  Color3f diffuseColor
           
(package private)  Color3f emissiveColor
           
(package private)  int flags
           
(package private)  int green
           
(package private)  java.lang.String imageFile
           
(package private) static java.util.Hashtable imageTable
           
(package private)  java.lang.String mappingType
           
(package private)  java.lang.String nextToken
           
(package private)  int red
           
(package private)  Color3f specularColor
           
(package private)  int textureAxis
           
(package private)  Vector3f textureCenter
           
(package private)  Vector3f textureSize
           
(package private) static java.util.Hashtable textureTable
           
(package private)  java.awt.Image theImage
           
(package private)  LWOBFileReader theReader
           
(package private)  java.lang.String type
           
 
Fields inherited from class com.sun.j3d.loaders.lw3d.ParserObject
debugPrinter, EXCEPTION, LINE_TRACE, MISC, NONE, TIME, TRACE, VALUES, WARNING
 
Constructor Summary
LwoTexture(LWOBFileReader reader, int length, java.lang.String typename, int debugVals)
          Constructor: calls readTexture() to parse the file and retrieve texture parameters
 
Method Summary
(package private)  Color3f getColor()
           
(package private)  java.awt.Image getImage()
           
(package private)  java.lang.String getMappingType()
           
(package private)  java.lang.String getNextToken()
           
(package private)  Texture getTexture()
          Return the actual Texture object associated with the current image.
(package private)  int getTextureAxis()
           
(package private)  Vector3f getTextureCenter()
           
(package private)  Vector3f getTextureSize()
           
(package private)  java.lang.String getType()
           
(package private)  boolean isHandled()
          The loader currently only handles CTEX and DTEX texture types (These either represent the surface color like a decal (CTEX) or modify the diffuse color (DTEX)
(package private)  void readTexture(int length)
          Parse the binary file to retrieve all texture parameters for this surface.
 
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

theReader

LWOBFileReader theReader

red

int red

green

int green

blue

int blue

color

Color3f color

diffuseColor

Color3f diffuseColor

specularColor

Color3f specularColor

emissiveColor

Color3f emissiveColor

theImage

java.awt.Image theImage

imageFile

java.lang.String imageFile

textureSize

Vector3f textureSize

textureCenter

Vector3f textureCenter

textureAxis

int textureAxis

flags

int flags

type

java.lang.String type

mappingType

java.lang.String mappingType

nextToken

java.lang.String nextToken

imageTable

static java.util.Hashtable imageTable

textureTable

static java.util.Hashtable textureTable
Constructor Detail

LwoTexture

LwoTexture(LWOBFileReader reader,
           int length,
           java.lang.String typename,
           int debugVals)
     throws java.io.FileNotFoundException
Constructor: calls readTexture() to parse the file and retrieve texture parameters

Throws:
java.io.FileNotFoundException
Method Detail

getNextToken

java.lang.String getNextToken()

isHandled

boolean isHandled()
The loader currently only handles CTEX and DTEX texture types (These either represent the surface color like a decal (CTEX) or modify the diffuse color (DTEX)


getTexture

Texture getTexture()
Return the actual Texture object associated with the current image. If we've already created a texture for this image, return that; otherwise create a new Texture


getType

java.lang.String getType()

getColor

Color3f getColor()

getImage

java.awt.Image getImage()

getTextureSize

Vector3f getTextureSize()

getTextureAxis

int getTextureAxis()

getTextureCenter

Vector3f getTextureCenter()

getMappingType

java.lang.String getMappingType()

readTexture

void readTexture(int length)
           throws java.io.FileNotFoundException,
                  ParsingErrorException
Parse the binary file to retrieve all texture parameters for this surface. If/when we encounter a TIMG parameter, which contains the filename of an image, then create a new TargaReader object to read that image file

Throws:
java.io.FileNotFoundException
ParsingErrorException


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