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

Quick Search    Search Deep

com.trapezium.chisel.cleaners
Class IFS_ColorToDiffuseColor  view IFS_ColorToDiffuseColor download IFS_ColorToDiffuseColor.java

java.lang.Object
  extended bycom.trapezium.chisel.Optimizer
      extended bycom.trapezium.chisel.cleaners.IFS_ColorToDiffuseColor
All Implemented Interfaces:
java.util.EventListener, com.trapezium.chisel.NodeLocatorListener, com.trapezium.chisel.OptionHolder

public class IFS_ColorToDiffuseColor
extends com.trapezium.chisel.Optimizer

This Chisel takes any single colored IFS within a Shape, and modifies it so that the color is indicated by the "diffuseColor" field of the material node of the appearance. The single color is detected if the IFS colorPerVertex is false, and the color node contains only one color, or if the colorIndex contains only one index value.


Nested Class Summary
(package private)  class IFS_ColorToDiffuseColor.GenDiffuse
           
 
Field Summary
static int GenAppearance
           
static int GenDiffuseColor
           
static int GenDiffuseColorReplacement
           
static int GenMaterial
           
 
Fields inherited from class com.trapezium.chisel.Optimizer
baseFileName, baseFilePath, dataSource
 
Constructor Summary
IFS_ColorToDiffuseColor()
           
 
Method Summary
 void attemptOptimization(com.trapezium.vrml.node.Node n)
          template, subclasses override this if they modify Nodes
(package private)  com.trapezium.vrml.node.Node getAppearance(com.trapezium.vrml.node.Node n)
           
(package private)  com.trapezium.vrml.node.Node getMaterial(com.trapezium.vrml.node.Node appearance)
           
(package private)  com.trapezium.vrml.node.Node getSingleColorIFS(com.trapezium.vrml.node.Node n)
          Return an IndexedFaceSet with a single color in the Shape node provided, if not found, returns null.
 void optimize(com.trapezium.chisel.TokenPrinter tp, java.lang.Object param, int startTokenOffset, int endTokenOffset)
          Replace the coordIndex, get rid of bad faces, regenerate other fields
 
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, reset, routeFound, setBaseFileName, setBaseFilePath, setDataSource, setNodeName, setOptionConstraints, setOptionValue, setRangeReplacer, summarize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GenAppearance

public static final int GenAppearance
See Also:
Constant Field Values

GenMaterial

public static final int GenMaterial
See Also:
Constant Field Values

GenDiffuseColor

public static final int GenDiffuseColor
See Also:
Constant Field Values

GenDiffuseColorReplacement

public static final int GenDiffuseColorReplacement
See Also:
Constant Field Values
Constructor Detail

IFS_ColorToDiffuseColor

public IFS_ColorToDiffuseColor()
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


getAppearance

com.trapezium.vrml.node.Node getAppearance(com.trapezium.vrml.node.Node n)

getMaterial

com.trapezium.vrml.node.Node getMaterial(com.trapezium.vrml.node.Node appearance)

getSingleColorIFS

com.trapezium.vrml.node.Node getSingleColorIFS(com.trapezium.vrml.node.Node n)
Return an IndexedFaceSet with a single color in the Shape node provided, if not found, returns null. Single color IFS that is acceptable is one in which color node is not DEF/USE, or corresponding Appearance or Material node is not DEF/USE


optimize

public void optimize(com.trapezium.chisel.TokenPrinter tp,
                     java.lang.Object param,
                     int startTokenOffset,
                     int endTokenOffset)
Replace the coordIndex, get rid of bad faces, regenerate other fields