Package xj3d.filter
Class MaterialFilter
java.lang.Object
xj3d.filter.AbstractFilter
xj3d.filter.MaterialFilter
- All Implemented Interfaces:
BinaryContentHandler
,ContentHandler
,ProtoHandler
,RouteHandler
,ScriptHandler
,StringContentHandler
Search for Appearance nodes which do not specify
a Material node, and add
material Material {
diffuseColor ...
}
to those nodes.
The diffuse color for the Material node can be specified
using -diffuse a b c, for example
-diffuse 1.0 0.8 0.2
By default, a 0.8 0.8 0.8 value will be supplied
(and the default value will be stripped from the output by
the default output processor).
- Author:
- Brad Vender
-
Field Summary
Fields inherited from class xj3d.filter.AbstractFilter
contentHandler, documentLocator, errorHandler, fieldHandler, fieldReader, fieldStack, lastErrorCode, majorVersion, minorVersion, nodeStack, parsingType, protoHandler, routeHandler, scriptHandler
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
endNode()
Notification of the end of a node declaration.void
fieldValue
(String value) The value of a normal field.void
setArguments
(String[] args) Set the argument parameters to control the filter operationvoid
startField
(String name) Notification of a field declaration.void
Notification of the start of a node.void
The field value is a USE for the given node name.Methods inherited from class xj3d.filter.AbstractFilter
componentDecl, endDocument, endExternProtoDecl, endField, endProtoBody, endProtoDecl, endScriptDecl, exportDecl, externProtoURI, fieldValue, fieldValue, fieldValue, fieldValue, fieldValue, fieldValue, fieldValue, fieldValue, fieldValue, fieldValue, fieldValue, fieldValue, getContentHandler, getErrorReporter, getLastErrorCode, getProtoHandler, getRouteHandler, getScriptHandler, importDecl, metaDecl, profileDecl, protoFieldDecl, protoIsDecl, routeDecl, scriptFieldDecl, setContentHandler, setDocumentLocator, setErrorReporter, setParsingType, setProtoHandler, setRouteHandler, setScriptHandler, startDocument, startExternProtoDecl, startProtoBody, startProtoDecl, startScriptDecl
-
Constructor Details
-
MaterialFilter
public MaterialFilter()Basic constructor.
-
-
Method Details
-
startNode
Notification of the start of a node. This is the opening statement of a node and it's DEF name. USE declarations are handled in a separate method.- Specified by:
startNode
in interfaceContentHandler
- Overrides:
startNode
in classAbstractFilter
- Parameters:
name
- The name of the node that we are about to parsedefName
- The string associated with the DEF name. Null if not given for this node.- Throws:
SAVException
- This call is taken at the wrong time in the structure of the document.VRMLException
- This call is taken at the wrong time in the structure of the document.
-
startField
Notification of a field declaration. This notification is only called if it is a standard node. If the node is a script or PROTO declaration then theScriptHandler
orProtoHandler
methods are used.- Specified by:
startField
in interfaceContentHandler
- Overrides:
startField
in classAbstractFilter
- Parameters:
name
- The name of the field declared- Throws:
SAVException
- This call is taken at the wrong time in the structure of the documentVRMLException
- The content provided is invalid for this part of the document or can't be parsed
-
useDecl
The field value is a USE for the given node name. This is a terminating call for startField as well. The next call will either be anotherstartField()
orendNode()
.- Specified by:
useDecl
in interfaceContentHandler
- Overrides:
useDecl
in classAbstractFilter
- Parameters:
defName
- The name of the DEF string to use- Throws:
SAVException
- This call is taken at the wrong time in the structure of the document.VRMLException
- This call is taken at the wrong time in the structure of the document.
-
endNode
Notification of the end of a node declaration.- Specified by:
endNode
in interfaceContentHandler
- Overrides:
endNode
in classAbstractFilter
- Throws:
SAVException
- This call is taken at the wrong time in the structure of the document.VRMLException
- This call is taken at the wrong time in the structure of the document.
-
fieldValue
The value of a normal field. This is a string that represents the entire value of the field. MFStrings will have to be parsed. This is a terminating call for startField as well. The next call will either be anotherstartField()
orendNode()
.If this field is an SFNode with a USE declaration you will have the
useDecl(String)
method called rather than this method.- Specified by:
fieldValue
in interfaceBinaryContentHandler
- Specified by:
fieldValue
in interfaceStringContentHandler
- Overrides:
fieldValue
in classAbstractFilter
- Parameters:
value
- The value of this field- Throws:
SAVException
- This call is taken at the wrong time in the structure of the documentVRMLException
- The content provided is invalid for this part of the document or can't be parsed
-
setArguments
Set the argument parameters to control the filter operation- Overrides:
setArguments
in classAbstractFilter
- Parameters:
args
- The array of argument parameters.
-