com.sun.j3d.loaders.lw3d
Class SequenceLine

java.lang.Object
  extended by com.sun.j3d.loaders.lw3d.SequenceLine

 class SequenceLine
extends java.lang.Object

This class was created to handle "sequence files", which allow holosketch-type Tloop sequences to be loaded through the lw3d loader. The class reads a sequence file line by line and uses SequenceLine to load the file specified in each line.
Idea behind the Tloop process:
Artist creates "tloops" (animations with each keyframe's geometry saved out explicitly) where the geometries are spaced one frame apart. Then I can automatically create a SwitchValueInterpolator based on this spacing. If the number of frames in the sequence is greater than the number of frames in the tloop, then it will automatically loop until the end of the sequence.
Process:
1) Artist creates an animation of a null group that has a child with some special name, such as "bucket_sequence_bucketsequence.txt.lwo", which tells the lw3d loader that it should look for a sequence file by the name of bucketsequence.txt. What happens to this object is irrelevant (as far as the loader is concerned); all animation information is taken from its parent instead.
2) Artist saves out the geometry of the bucket at whatever frames she wants to. If she's saving a tloop (a sequence of frames), she should save them under the names xxx.lwo, where xxx is the 3-digit sequence number (000, 001, 002, etc.).
3) Artist creates the sequence file, which lists all saved geometry files (except sequences - these can be referred to simply by the first file (...000.lwo)), along with their associated start/end frames. She also lists the number of files in the sequence, although this parameter is implied anyway, through the existence of the sequence files and their naming convention. Maybe we should trash this guy.
4) In the lw3d loader, when LwsObject encounters an object with the filename "..._sequence_.lwo", it searches for filename. If found, it parses the file (using the SequenceReader class) to retrieve all parameters.
5) Each SequenceLine creates a Java3D group containing its objects. This is either a plain-old-Group (if there is only one object) or a Switch group with a SwitchValueInterpolator.
6) SequenceReader constructs a Switch group and adds all SequenceLine groups to this new group. It also creates a SwitchPathInterpolator (child of PathInterolator) that contsructs an Alpha based on the startFrame values of each SequenceLine. It creates a group and adds the SwitchPathInterpolator plus any SequenceLine SwitchValueInterpolators to this group.
7) LwsObject adds the SequenceReader Switch group to its objectTransform. It does a getBehaviors() from SequenceReader and adds the result (the SwitchPathInterpolator group) to its objectBehaviors group.
8) Done.


Field Summary
(package private)  Behavior behaviors
           
(package private)  int endFrame
           
(package private)  java.lang.String fileName
           
(package private)  Group geometryGroup
           
(package private)  int numFrames
           
(package private)  int startFrame
           
(package private) static java.util.Hashtable storedRefList
           
(package private)  int totalFrames
           
(package private)  float totalTime
           
 
Constructor Summary
SequenceLine(java.io.StreamTokenizer st, float time, int frames)
           
 
Method Summary
(package private)  void createJava3dObjects(int debugVals, int loadBehaviors)
          Create Java3d objects from the data in the sequence line.
private  void createSwitchBehavior(Switch target)
          Creates a SwitchValueInterpolator which is used to switch between the objects specified for the sequence.
(package private)  Behavior getBehavior()
           
(package private)  Group getGeometry()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

startFrame

int startFrame

endFrame

int endFrame

fileName

java.lang.String fileName

geometryGroup

Group geometryGroup

behaviors

Behavior behaviors

numFrames

int numFrames

totalTime

float totalTime

totalFrames

int totalFrames

storedRefList

static java.util.Hashtable storedRefList
Constructor Detail

SequenceLine

SequenceLine(java.io.StreamTokenizer st,
             float time,
             int frames)
       throws ParsingErrorException
Throws:
ParsingErrorException
Method Detail

createSwitchBehavior

private void createSwitchBehavior(Switch target)
Creates a SwitchValueInterpolator which is used to switch between the objects specified for the sequence. This is done for files that end in "000", meaning that there are a sequence of files with that same base name that should specify every frame of a sequence for an object. The Switch node is used to hold all of the files and the Switch Behavior node is used to activate switching at the right time and to the right object.


createJava3dObjects

void createJava3dObjects(int debugVals,
                         int loadBehaviors)
                   throws IncorrectFormatException,
                          java.io.FileNotFoundException
Create Java3d objects from the data in the sequence line. This means that for a tloop file (ends in "000"), we're going to create the appropriate geometry for each file, put them all in a Switch node, then create a SwitchValueInterpolator to swap between the frames of the tloop. If it's not a tloop, then we're just going to create the geometry for that file.

Throws:
IncorrectFormatException
java.io.FileNotFoundException

getGeometry

Group getGeometry()

getBehavior

Behavior getBehavior()


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