|
|||||||||
| Home >> All >> org >> pqt >> autorib >> [ rib overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.pqt.autorib.rib
Class RIBWReader

java.lang.Objectorg.pqt.autorib.rib.RIBWReader
- public class RIBWReader
- extends java.lang.Object
provides routines for reading and writing RIB files
| Field Summary | |
java.util.Vector |
addWorldRIB
RIB requests to be added to every World generated - used to store lights added by GlobalRIB and FrameRIB |
private java.util.Stack |
ArchiveStack
|
java.util.Stack |
attrStack
a stack used to store the attribute state (for attributebegin, attribute end |
org.pqt.autorib.util.Matrix |
cameraTransform
Stores the world to camera space transform |
RIBAttributeRec |
currentAttrs
the current set of graphics attributes |
RIBOptionRec |
currentOptions
this will point either to the global or frame options - depending on whether the rib file contains any frames |
org.pqt.autorib.util.Matrix |
currentTransform
The current transformation matrix |
RIBAttributeRec |
frameAttrs
the set of attributes defined in the current frame |
java.util.Vector |
frameHeader
holds any non-option rib in the frame header |
int |
frameNo
the number of the current frame, or -1 if there is no frame |
RIBOptionRec |
frameOptions
holds options in the frame header |
RIBAttributeRec |
globalAttrs
the set of attributes defined in the global header |
java.util.Vector |
globalHeader
holds the non-option rib in the global header |
RIBOptionRec |
globalOptions
holds options in the global header |
private static boolean |
initDone
|
private RIBRequest |
lastRequest
|
java.util.Vector |
lights
a list of all the lights in the current frame |
java.io.OutputStreamWriter |
mainOut
this is the main RIB output stream |
java.util.Vector |
mapList
a list of environment and reflection maps to be generated |
protected java.util.Vector |
mapOmits
Stores the omit records for map archives in mapWorldArchive |
java.io.OutputStreamWriter |
mapOut
this is the map output stream - it is the same as the main output stream if the sepfile option is not set |
protected java.util.Vector |
mapWorldArchive
Stores the names of Archives where the world has been stored for e.g environment maps |
boolean |
moreFrames
this records if there are more frames left to be read |
java.util.HashMap |
namedCoordSystems
Used for storing named coordinate systems |
java.lang.String |
nameIn
The name of the file we are reading from |
java.lang.String |
nameOut
The name of the file we are writing to |
static boolean[] |
nonoptionFilter
This option includes everything but RIB Option requests |
static boolean[] |
nonTransformFilter
this contains a filter to identify non transforms |
static boolean[] |
objectDefFilter
|
java.util.Vector |
objectDefinitions
Defined Objects - as in RIB ObjectBegin, ObjectEnd |
java.util.Vector |
objects
a list of all the objects in the current frame |
static boolean[] |
objectsFilter
this contains a filter to identify all objects |
static boolean[] |
optionFilter
this filter excludes everything but Option RIB Requests |
java.io.OutputStreamWriter |
out
this is the current output file for RIB - sometimes the same as the main file and sometimes the map file |
private boolean |
pushedBack
|
int |
requestsRead
the number of requests read tokenizer this and archived files |
static boolean[] |
shadowFilter
this contains a filter to block out all rib not required in a shadow map file - for example Color and Opacity |
protected java.util.Vector |
shadowOmits
Stores the omit records for the archives - because if different objects are omitted you need different archives |
protected java.util.Vector |
shadowWorldArchive
Stores the names of the Archives where the world has been stored for shadow maps |
java.util.Vector |
tempFilesList
stores a list of all the file names of the maps generated - nothing is done with this list at present - but it could be used to delete the files after rendering |
RIBTokenizer |
tokenizer
this is the tokenizer used for reading the RIB file |
static boolean[] |
transformFilter
this contains a filter to identify all transform commands |
java.util.Stack |
transformStack
Transformation stack |
java.util.Vector |
worldContents
this will hold the rib inside the WorldBegin, WorldEnd of the current frame |
| Constructor Summary | |
RIBWReader(java.io.InputStream is,
java.io.OutputStream os,
java.lang.String nameIn)
the constructor for the case where output is to and or from a stream rather than a file (for instance a pipe) * |
|
RIBWReader(java.lang.String nameIn,
java.io.OutputStream os)
constructor for the case where input is from a file, but output is to go to a stream (e.g stdout) |
|
RIBWReader(java.lang.String nameIn,
java.lang.String nameOut)
the constructor for the case where input is from a file, output is to a file, and there is no separate map file |
|
RIBWReader(java.lang.String nameIn,
java.lang.String nameOut,
java.lang.String nameMap)
a constructor for use when there is a separate map file |
|
| Method Summary | |
org.pqt.autorib.util.Bounds3D |
calculateWorldBounds(java.util.Vector omitNames)
Calculate the bounding box in world coordinates for the primitives that match the given omit values |
void |
filteredWrite(java.util.Vector content,
boolean[] filter)
Write out all the RIBRequest matching the given filter |
void |
filteredWrite(java.util.Vector content,
boolean[] filter,
java.util.Vector omitNames)
Write out a set of RIBRequests, filtering them, and omitting any associated with a objects whose names are given |
void |
filteredWrite(java.util.Vector content,
java.util.Vector omitNames)
Write out a set of RIB requests, omitting any associated with objects whose names are in the given list |
void |
flushOut()
Flush the output stream(s) |
private void |
init()
this sets up the filters etc |
void |
objectRead(RIBObjectBegin object)
Read in the RIBRequests forming and object definition |
void |
pushBack()
Push back the most recently read RIBRequest so that it will be read again |
void |
readFrame()
read tokenizer a frame. |
void |
readFrameHeader()
read tokenizer RIB until we reach 'WorldBegin' storing the RIB tokenizer RIBGlobals.frameOptions |
void |
readGlobalHeader()
read tokenizer RIB until we reach 'WorldBegin' or 'FrameBegin' storing the RIB tokenizer RIBGlobals.globalOptions |
RIBRequest |
readRequest()
Read in and return a RIB Request, using the routines in the RIBReadRequest class. |
void |
readWorld()
read tokenizer everything between 'WorldBegin' and 'WorldEnd' putting the contents tokenizer RIBGlobals.worldContents |
void |
switchToMain()
switch output back to main file from any map file |
void |
switchToMap()
switch output to map file |
void |
write(java.lang.String s)
write a string to the current output stream |
protected void |
write(java.util.Vector content)
Write out all the RIBRequest in the given vector |
void |
writeFrameOptions()
Write out the frame options that were explicitly set with the RIB Option call |
void |
writeGlobalOptions()
Write out to the standard out stream the RIB 'Option' calls defined in the header (only). |
void |
writeln(java.lang.String s)
write a string and newline to the current output stream |
void |
writePartFrameHeader()
write part of frame header - object instances etc and implementation specific options only |
void |
writePartGlobalHeader()
write part of the global header - object definitions etc and implementation specific options but not other options |
void |
writeRestFrameHeader()
write the rest of a frame header - Options |
void |
writeRestGlobalHeader()
write out all the options in the global header except those set using the Option RIB call |
void |
writeShadowWorld(java.util.Vector omitNames)
write out the RIB between WorldBegin and WorldEnd leaving out things that are irrelevant to shadow map generation, including, if nosurface is set, surface shaders. |
void |
writeWorld()
Write out everything between WorldBegin and WorldEnd in the current frame |
void |
writeWorld(java.util.Vector omitNames)
write out everything that was read in between WorldBegin and WorldEnd, omitting some objects. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
ArchiveStack
private java.util.Stack ArchiveStack
tokenizer
public RIBTokenizer tokenizer
- this is the tokenizer used for reading the RIB file
out
public java.io.OutputStreamWriter out
- this is the current output file for RIB - sometimes the same as the main file
and sometimes the map file
mapOut
public java.io.OutputStreamWriter mapOut
- this is the map output stream - it is the same as the main output stream
if the sepfile option is not set
mainOut
public java.io.OutputStreamWriter mainOut
- this is the main RIB output stream
lastRequest
private RIBRequest lastRequest
requestsRead
public int requestsRead
- the number of requests read tokenizer this and archived files
pushedBack
private boolean pushedBack
moreFrames
public boolean moreFrames
- this records if there are more frames left to be read
shadowFilter
public static boolean[] shadowFilter
- this contains a filter to block out all rib not required in
a shadow map file - for example Color and Opacity
transformFilter
public static boolean[] transformFilter
- this contains a filter to identify all transform commands
nonTransformFilter
public static boolean[] nonTransformFilter
- this contains a filter to identify non transforms
objectsFilter
public static boolean[] objectsFilter
- this contains a filter to identify all objects
optionFilter
public static boolean[] optionFilter
- this filter excludes everything but Option
RIB Requests
nonoptionFilter
public static boolean[] nonoptionFilter
- This option includes everything but RIB Option
requests
objectDefFilter
public static boolean[] objectDefFilter
initDone
private static boolean initDone
tempFilesList
public java.util.Vector tempFilesList
- stores a list of all the file names of the maps generated - nothing is
done with this list at present - but it could be used to delete the files
after rendering
globalHeader
public java.util.Vector globalHeader
- holds the non-option rib in the global header
frameHeader
public java.util.Vector frameHeader
- holds any non-option rib in the frame header
worldContents
public java.util.Vector worldContents
- this will hold the rib inside the WorldBegin, WorldEnd of the
current frame
globalOptions
public RIBOptionRec globalOptions
- holds options in the global header
frameOptions
public RIBOptionRec frameOptions
- holds options in the frame header
currentOptions
public RIBOptionRec currentOptions
- this will point either to the global or frame options - depending
on whether the rib file contains any frames
currentAttrs
public RIBAttributeRec currentAttrs
- the current set of graphics attributes
globalAttrs
public RIBAttributeRec globalAttrs
- the set of attributes defined in the global header
frameAttrs
public RIBAttributeRec frameAttrs
- the set of attributes defined in the current frame
attrStack
public java.util.Stack attrStack
- a stack used to store the attribute state (for attributebegin,
attribute end
lights
public java.util.Vector lights
- a list of all the lights in the current frame
objects
public java.util.Vector objects
- a list of all the objects in the current frame
frameNo
public int frameNo
- the number of the current frame, or -1 if there is no frame
mapList
public java.util.Vector mapList
- a list of environment and reflection maps to be generated
addWorldRIB
public java.util.Vector addWorldRIB
- RIB requests to be added to every World generated - used to store
lights added by GlobalRIB and FrameRIB
objectDefinitions
public java.util.Vector objectDefinitions
- Defined Objects - as in RIB ObjectBegin, ObjectEnd
transformStack
public java.util.Stack transformStack
- Transformation stack
currentTransform
public org.pqt.autorib.util.Matrix currentTransform
- The current transformation matrix
namedCoordSystems
public java.util.HashMap namedCoordSystems
- Used for storing named coordinate systems
cameraTransform
public org.pqt.autorib.util.Matrix cameraTransform
- Stores the world to camera space transform
shadowWorldArchive
protected java.util.Vector shadowWorldArchive
- Stores the names of the Archives where the world has been stored for
shadow maps
shadowOmits
protected java.util.Vector shadowOmits
- Stores the omit records for the archives - because if different objects
are omitted you need different archives
mapWorldArchive
protected java.util.Vector mapWorldArchive
- Stores the names of Archives where the world has been stored for e.g
environment maps
mapOmits
protected java.util.Vector mapOmits
- Stores the omit records for map archives in mapWorldArchive
nameIn
public java.lang.String nameIn
- The name of the file we are reading from
nameOut
public java.lang.String nameOut
- The name of the file we are writing to
| Constructor Detail |
RIBWReader
public RIBWReader(java.lang.String nameIn, java.lang.String nameOut) throws java.io.IOException, java.io.FileNotFoundException
- the constructor for the case where input is from a file, output
is to a file, and there is no separate map file
RIBWReader
public RIBWReader(java.lang.String nameIn, java.lang.String nameOut, java.lang.String nameMap) throws java.io.IOException, java.io.FileNotFoundException
- a constructor for use when there is a separate map
file
RIBWReader
public RIBWReader(java.io.InputStream is, java.io.OutputStream os, java.lang.String nameIn) throws java.io.IOException
- the constructor for the case where output is to and or from a stream
rather than a file (for instance a pipe) *
RIBWReader
public RIBWReader(java.lang.String nameIn, java.io.OutputStream os) throws java.io.IOException
- constructor for the case where input is from a file, but output is
to go to a stream (e.g stdout)
| Method Detail |
init
private void init()
- this sets up the filters etc
readRequest
public RIBRequest readRequest() throws org.pqt.autorib.tokenizer.FormatException, java.io.IOException
- Read in and return a RIB Request, using the routines
in the RIBReadRequest class. The RIBReadRequest class
does not do more than read in the requests - this function
handles AttributeBegin, AttributeEnd etc. and keeps track
of the transfromation stack. Functions like readWorld do
the work of grouping primitives into ObjectGroups
readGlobalHeader
public void readGlobalHeader()
throws org.pqt.autorib.tokenizer.FormatException,
java.io.IOException
- read tokenizer RIB until we reach 'WorldBegin' or 'FrameBegin' storing
the RIB tokenizer RIBGlobals.globalOptions
write
protected void write(java.util.Vector content) throws java.io.IOException
- Write out all the RIBRequest in the given vector
filteredWrite
public void filteredWrite(java.util.Vector content, boolean[] filter) throws java.io.IOException
- Write out all the RIBRequest matching the given filter
filteredWrite
public void filteredWrite(java.util.Vector content, boolean[] filter, java.util.Vector omitNames) throws java.io.IOException
- Write out a set of RIBRequests, filtering them, and
omitting any associated with a objects whose names
are given
filteredWrite
public void filteredWrite(java.util.Vector content, java.util.Vector omitNames) throws java.io.IOException
- Write out a set of RIB requests, omitting any associated
with objects whose names are in the given list
readFrameHeader
public void readFrameHeader()
throws org.pqt.autorib.tokenizer.FormatException,
java.io.IOException
- read tokenizer RIB until we reach 'WorldBegin' storing
the RIB tokenizer RIBGlobals.frameOptions
readFrame
public void readFrame()
throws org.pqt.autorib.tokenizer.FormatException,
java.io.IOException
- read tokenizer a frame. Set moreFrames to true if there are more frames
to be read
readWorld
public void readWorld()
throws org.pqt.autorib.tokenizer.FormatException,
java.io.IOException
- read tokenizer everything between 'WorldBegin' and 'WorldEnd' putting the
contents tokenizer RIBGlobals.worldContents
writeWorld
public void writeWorld()
throws java.io.IOException
- Write out everything between WorldBegin and WorldEnd
in the current frame
writeWorld
public void writeWorld(java.util.Vector omitNames) throws java.io.IOException
- write out everything that was read in between WorldBegin and
WorldEnd, omitting some objects. Use a map to write the world if
Globals.useArchive is true
writeShadowWorld
public void writeShadowWorld(java.util.Vector omitNames) throws java.io.IOException
- write out the RIB between WorldBegin and WorldEnd leaving out
things that are irrelevant to shadow map generation,
including, if nosurface is set, surface shaders. Leaving out
surface shaders is fine if none of them perform displacements. This
procedure also checks to see if the content should be written to an archive
and does so if required
pushBack
public void pushBack()
- Push back the most recently read RIBRequest so
that it will be read again
flushOut
public void flushOut()
throws java.io.IOException
- Flush the output stream(s)
writeGlobalOptions
public void writeGlobalOptions()
throws java.io.IOException
- Write out to the standard out stream the RIB
'Option' calls defined in the header (only). Options that were not
explicitly set with the Option call are printed
out in
writePartGlobalHeader
writePartGlobalHeader
public void writePartGlobalHeader()
throws java.io.IOException
- write part of the global header - object definitions etc and
implementation specific options but not other options
writeFrameOptions
public void writeFrameOptions()
throws java.io.IOException
- Write out the frame options that were explicitly
set with the RIB Option call
writePartFrameHeader
public void writePartFrameHeader()
throws java.io.IOException
- write part of frame header - object instances etc and implementation
specific options only
writeRestFrameHeader
public void writeRestFrameHeader()
throws java.io.IOException
- write the rest of a frame header - Options
writeRestGlobalHeader
public void writeRestGlobalHeader()
throws java.io.IOException
- write out all the options in the global header except those
set using the Option RIB call
write
public final void write(java.lang.String s) throws java.io.IOException
- write a string to the current output stream
writeln
public final void writeln(java.lang.String s) throws java.io.IOException
- write a string and newline to the current output stream
switchToMain
public void switchToMain()
throws java.io.IOException
- switch output back to main file from any map file
switchToMap
public void switchToMap()
throws java.io.IOException
- switch output to map file
objectRead
public void objectRead(RIBObjectBegin object) throws java.io.IOException, org.pqt.autorib.tokenizer.FormatException
- Read in the RIBRequests forming and object definition
calculateWorldBounds
public org.pqt.autorib.util.Bounds3D calculateWorldBounds(java.util.Vector omitNames)
- Calculate the bounding box in world coordinates for the primitives that match the
given omit values
|
|||||||||
| Home >> All >> org >> pqt >> autorib >> [ rib overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.pqt.autorib.rib.RIBWReader