Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.trapezium.chisel.reducers
Class IFS_CoplanarTriToQuad  view IFS_CoplanarTriToQuad download IFS_CoplanarTriToQuad.java

java.lang.Object
  extended bycom.trapezium.chisel.Optimizer
      extended bycom.trapezium.chisel.reducers.IFS_CoplanarTriToQuad
All Implemented Interfaces:
java.util.EventListener, com.trapezium.chisel.NodeLocatorListener, com.trapezium.chisel.OptionHolder
Direct Known Subclasses:
IFS_Simplifier

public class IFS_CoplanarTriToQuad
extends com.trapezium.chisel.Optimizer

This chisel turns coplanar triangles into quads, preserving texture and normal information.


Nested Class Summary
(package private)  class IFS_CoplanarTriToQuad.FaceTracker
          The FaceTracker is used to manage per-face information independent of how it is specified in the file.
(package private)  class IFS_CoplanarTriToQuad.OptimizeParam
          The OptimizeParam is passed to each "optimize" call
 
Field Summary
(package private)  java.util.Hashtable coordToSpace
          Keep track of association between coordNode and SpaceStructure.
(package private)  int ifsCount
           
(package private)  int polygonsSmashed
           
(package private)  int processedIFS
           
(package private) static int ReplaceColorCoordIndex
           
(package private) static int ReplaceColorNodeValue
           
(package private) static int ReplaceCoordIndex
           
(package private) static int ReplaceCoordNodeValue
           
(package private) static int ReplaceNormalCoordIndex
           
(package private) static int ReplaceNormalNodeValue
           
(package private) static int ReplaceTexCoordIndex
           
(package private) static int ReplaceTexCoordNodeValue
           
(package private)  java.util.Hashtable spaceStructuresReduced
          The SpaceStructure already contains the reduction information, here we just write that information out to the file.
protected  com.trapezium.vrml.node.space.SpaceStructure ss
           
 
Fields inherited from class com.trapezium.chisel.Optimizer
baseFileName, baseFilePath, dataSource
 
Constructor Summary
IFS_CoplanarTriToQuad()
          Constructor for coplanar triangle to quad merger
IFS_CoplanarTriToQuad(java.lang.String message)
          edge reduction shares some code...
 
Method Summary
protected  boolean alreadyProcessed(com.trapezium.vrml.node.space.SpaceStructure ss)
           
(package private)  void associate(com.trapezium.vrml.node.Node coordNode, com.trapezium.vrml.node.space.SpaceStructure ss)
           
 void attemptOptimization(com.trapezium.vrml.node.Node n)
          template, subclasses override this if they modify Nodes
 void attemptOptimization(com.trapezium.vrml.node.Node n, com.trapezium.vrml.node.space.BoundingBox b)
          create the SpaceStructure for the IndexedFaceSet
(package private)  com.trapezium.vrml.node.space.SpaceStructure getSpaceStructure(com.trapezium.vrml.node.Node coordNode)
           
(package private)  boolean hasSpaceStructure(com.trapezium.vrml.node.Node coordNode)
           
 void optimize(com.trapezium.chisel.TokenPrinter tp, java.lang.Object param, int startTokenOffset, int endTokenOffset)
           
 void replaceColorCoordIndex(com.trapezium.chisel.TokenPrinter tp, com.trapezium.vrml.node.space.SpaceStructure ss, int firstFaceOffset, int lastFaceOffset, int startTokenOffset, int endTokenOffset, boolean perVertex)
           
(package private)  void replaceColorNodeValue(com.trapezium.chisel.TokenPrinter tp, com.trapezium.vrml.node.space.SpaceStructure ss, int firstFaceOffset, int lastFaceOffset, int startTokenOffset, int endTokenOffset, boolean perVertex)
          Replace color node values.
 void replaceCoordIndex(com.trapezium.chisel.TokenPrinter tp, com.trapezium.vrml.node.space.SpaceStructure ss, int firstFaceOffset, int lastFaceOffset, int startTokenOffset, int endTokenOffset)
           
 void replaceIndex(com.trapezium.chisel.TokenPrinter tp, com.trapezium.vrml.node.space.SpaceStructure ss, int firstFaceOffset, int lastFaceOffset, int startTokenOffset, int endTokenOffset)
          Replace an index field where the index values are one-to-one with coordIndex.
 void replaceIndex(com.trapezium.chisel.TokenPrinter tp, com.trapezium.vrml.node.space.SpaceStructure ss, int firstFaceOffset, int lastFaceOffset, int startTokenOffset, int endTokenOffset, int type)
           
(package private)  void replaceNodeValues(com.trapezium.chisel.TokenPrinter tp, com.trapezium.vrml.node.space.SpaceStructure ss, int firstFaceOffset, int lastFaceOffset, int startTokenOffset, int endTokenOffset)
           
 void replaceNormalCoordIndex(com.trapezium.chisel.TokenPrinter tp, com.trapezium.vrml.node.space.SpaceStructure ss, int firstFaceOffset, int lastFaceOffset, int startTokenOffset, int endTokenOffset, boolean perVertex)
           
 void replaceTexCoordIndex(com.trapezium.chisel.TokenPrinter tp, com.trapezium.vrml.node.space.SpaceStructure ss, int firstFaceOffset, int lastFaceOffset, int startTokenOffset, int endTokenOffset)
          Replace the texCoordIndex field.
 void reset()
          reset optimizer, subclasses may need this
(package private)  int skipNumbers(int scanner, int endTokenOffset, int n)
           
 void summarize(java.io.PrintStream ps)
          default summary (none), used by command line version
(package private)  int xlate(com.trapezium.vrml.node.space.SpaceStructure ss, int faceOffset)
          translate a face offset in the old face set into the corresponding face offset in the new set.
 
Methods inherited from class com.trapezium.chisel.Optimizer
addAdditionalNode, attemptOptimization, booleanToOptionValue, eofTokens, getActionMessage, getAdditionalName, getNodeName, getNumberAdditionalNames, getNumberOptions, getOptionClass, getOptionConstraints, getOptionLabel, getOptionValue, hasFinalCode, intToOptionValue, isDEFlistener, isDEFUSElistener, isPROTOlistener, isROUTElistener, nodeFound, optimizePossible, optionValueToBoolean, optionValueToInt, printFinalCode, printNumbers, replaceIndexFaceMultiple, replaceRange, replaceStartEnd, replaceValueNodeFaceMultiple, routeFound, setBaseFileName, setBaseFilePath, setDataSource, setNodeName, setOptionConstraints, setOptionValue, setRangeReplacer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

polygonsSmashed

int polygonsSmashed

ifsCount

int ifsCount

processedIFS

int processedIFS

ReplaceCoordIndex

static final int ReplaceCoordIndex
See Also:
Constant Field Values

ReplaceTexCoordIndex

static final int ReplaceTexCoordIndex
See Also:
Constant Field Values

ReplaceNormalCoordIndex

static final int ReplaceNormalCoordIndex
See Also:
Constant Field Values

ReplaceColorCoordIndex

static final int ReplaceColorCoordIndex
See Also:
Constant Field Values

ReplaceCoordNodeValue

static final int ReplaceCoordNodeValue
See Also:
Constant Field Values

ReplaceTexCoordNodeValue

static final int ReplaceTexCoordNodeValue
See Also:
Constant Field Values

ReplaceNormalNodeValue

static final int ReplaceNormalNodeValue
See Also:
Constant Field Values

ReplaceColorNodeValue

static final int ReplaceColorNodeValue
See Also:
Constant Field Values

ss

protected com.trapezium.vrml.node.space.SpaceStructure ss

coordToSpace

java.util.Hashtable coordToSpace
Keep track of association between coordNode and SpaceStructure. Don't remake SpaceStructure unless necessary.


spaceStructuresReduced

java.util.Hashtable spaceStructuresReduced
The SpaceStructure already contains the reduction information, here we just write that information out to the file.

Constructor Detail

IFS_CoplanarTriToQuad

public IFS_CoplanarTriToQuad()
Constructor for coplanar triangle to quad merger


IFS_CoplanarTriToQuad

public IFS_CoplanarTriToQuad(java.lang.String message)
edge reduction shares some code... a bit weird, but missed out on general base class construction

Method Detail

attemptOptimization

public void attemptOptimization(com.trapezium.vrml.node.Node n)
Description copied from class: com.trapezium.chisel.Optimizer
template, subclasses override this if they modify Nodes


reset

public void reset()
Description copied from class: com.trapezium.chisel.Optimizer
reset optimizer, subclasses may need this


associate

void associate(com.trapezium.vrml.node.Node coordNode,
               com.trapezium.vrml.node.space.SpaceStructure ss)

hasSpaceStructure

boolean hasSpaceStructure(com.trapezium.vrml.node.Node coordNode)

getSpaceStructure

com.trapezium.vrml.node.space.SpaceStructure getSpaceStructure(com.trapezium.vrml.node.Node coordNode)

attemptOptimization

public void attemptOptimization(com.trapezium.vrml.node.Node n,
                                com.trapezium.vrml.node.space.BoundingBox b)
create the SpaceStructure for the IndexedFaceSet


alreadyProcessed

protected boolean alreadyProcessed(com.trapezium.vrml.node.space.SpaceStructure ss)

optimize

public void optimize(com.trapezium.chisel.TokenPrinter tp,
                     java.lang.Object param,
                     int startTokenOffset,
                     int endTokenOffset)

replaceColorNodeValue

void replaceColorNodeValue(com.trapezium.chisel.TokenPrinter tp,
                           com.trapezium.vrml.node.space.SpaceStructure ss,
                           int firstFaceOffset,
                           int lastFaceOffset,
                           int startTokenOffset,
                           int endTokenOffset,
                           boolean perVertex)
Replace color node values.


replaceNodeValues

void replaceNodeValues(com.trapezium.chisel.TokenPrinter tp,
                       com.trapezium.vrml.node.space.SpaceStructure ss,
                       int firstFaceOffset,
                       int lastFaceOffset,
                       int startTokenOffset,
                       int endTokenOffset)

skipNumbers

int skipNumbers(int scanner,
                int endTokenOffset,
                int n)

xlate

int xlate(com.trapezium.vrml.node.space.SpaceStructure ss,
          int faceOffset)
translate a face offset in the old face set into the corresponding face offset in the new set.


replaceCoordIndex

public void replaceCoordIndex(com.trapezium.chisel.TokenPrinter tp,
                              com.trapezium.vrml.node.space.SpaceStructure ss,
                              int firstFaceOffset,
                              int lastFaceOffset,
                              int startTokenOffset,
                              int endTokenOffset)

replaceTexCoordIndex

public void replaceTexCoordIndex(com.trapezium.chisel.TokenPrinter tp,
                                 com.trapezium.vrml.node.space.SpaceStructure ss,
                                 int firstFaceOffset,
                                 int lastFaceOffset,
                                 int startTokenOffset,
                                 int endTokenOffset)
Replace the texCoordIndex field.


replaceNormalCoordIndex

public void replaceNormalCoordIndex(com.trapezium.chisel.TokenPrinter tp,
                                    com.trapezium.vrml.node.space.SpaceStructure ss,
                                    int firstFaceOffset,
                                    int lastFaceOffset,
                                    int startTokenOffset,
                                    int endTokenOffset,
                                    boolean perVertex)

replaceColorCoordIndex

public void replaceColorCoordIndex(com.trapezium.chisel.TokenPrinter tp,
                                   com.trapezium.vrml.node.space.SpaceStructure ss,
                                   int firstFaceOffset,
                                   int lastFaceOffset,
                                   int startTokenOffset,
                                   int endTokenOffset,
                                   boolean perVertex)

replaceIndex

public void replaceIndex(com.trapezium.chisel.TokenPrinter tp,
                         com.trapezium.vrml.node.space.SpaceStructure ss,
                         int firstFaceOffset,
                         int lastFaceOffset,
                         int startTokenOffset,
                         int endTokenOffset)
Replace an index field where the index values are one-to-one with coordIndex. We keep track of which faces get preserved, which don't, then decide what to print based on that.


replaceIndex

public void replaceIndex(com.trapezium.chisel.TokenPrinter tp,
                         com.trapezium.vrml.node.space.SpaceStructure ss,
                         int firstFaceOffset,
                         int lastFaceOffset,
                         int startTokenOffset,
                         int endTokenOffset,
                         int type)

summarize

public void summarize(java.io.PrintStream ps)
Description copied from class: com.trapezium.chisel.Optimizer
default summary (none), used by command line version