java.lang.Object
com.trapezium.chisel.Optimizer
com.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.
| 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 |
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
IFS_ColorToDiffuseColor
public IFS_ColorToDiffuseColor()
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