Package org.sunflow.core.parser
Class SCParser
- java.lang.Object
-
- org.sunflow.core.parser.SCParser
-
- All Implemented Interfaces:
SceneParser
public class SCParser extends java.lang.Object implements SceneParser
This class provides a static method for loading files in the Sunflow scene file format.
-
-
Field Summary
Fields Modifier and Type Field Description private static intinstanceCounterprivate intinstanceNumberprivate intnumLightSamplesprivate java.util.HashMap<java.lang.String,java.lang.Integer>objectNamesprotected Parserp
-
Constructor Summary
Constructors Constructor Description SCParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.StringgenerateUniqueName(java.lang.String prefix)booleanparse(java.lang.String filename, SunflowAPIInterface api)Parse the specified file to create a scene description into the providedSunflowAPIobject.protected voidparseBackgroundBlock(SunflowAPIInterface api)protected voidparseCamera(SunflowAPIInterface api)protected voidparseCameraMatrix(int index, SunflowAPIInterface api)protected voidparseCameraTransform(SunflowAPIInterface api)protected ColorparseColor()protected voidparseFilter(SunflowAPIInterface api)protected float[]parseFloatArray(int size)protected voidparseGIBlock(SunflowAPIInterface api)protected voidparseImageBlock(SunflowAPIInterface api)protected voidparseInstanceBlock(SunflowAPIInterface api)protected int[]parseIntArray(int size)protected voidparseLightBlock(SunflowAPIInterface api)protected voidparseLightserverBlock(SunflowAPIInterface api)protected Matrix4parseMatrix()protected booleanparseModifier(SunflowAPIInterface api)protected booleanparseNode(SunflowAPIInterface api)protected voidparseObjectBlock(SunflowAPIInterface api)protected voidparsePhotonBlock(SunflowAPIInterface api)protected Point3parsePoint()protected booleanparseShader(SunflowAPIInterface api)protected voidparseTraceBlock(SunflowAPIInterface api)protected Vector3parseVector()
-
-
-
Field Detail
-
instanceCounter
private static int instanceCounter
-
instanceNumber
private int instanceNumber
-
numLightSamples
private int numLightSamples
-
objectNames
private java.util.HashMap<java.lang.String,java.lang.Integer> objectNames
-
p
protected Parser p
-
-
Method Detail
-
generateUniqueName
private java.lang.String generateUniqueName(java.lang.String prefix)
-
parse
public boolean parse(java.lang.String filename, SunflowAPIInterface api)Description copied from interface:SceneParserParse the specified file to create a scene description into the providedSunflowAPIobject.- Specified by:
parsein interfaceSceneParser- Parameters:
filename- filename to parseapi- scene to parse the file into- Returns:
trueupon sucess, orfalseif errors have occured.
-
parseImageBlock
protected void parseImageBlock(SunflowAPIInterface api) throws java.io.IOException, Parser.ParserException
- Throws:
java.io.IOExceptionParser.ParserException
-
parseBackgroundBlock
protected void parseBackgroundBlock(SunflowAPIInterface api) throws java.io.IOException, Parser.ParserException, ColorFactory.ColorSpecificationException
- Throws:
java.io.IOExceptionParser.ParserExceptionColorFactory.ColorSpecificationException
-
parseFilter
protected void parseFilter(SunflowAPIInterface api) throws java.io.IOException, Parser.ParserException
- Throws:
java.io.IOExceptionParser.ParserException
-
parsePhotonBlock
protected void parsePhotonBlock(SunflowAPIInterface api) throws Parser.ParserException, java.io.IOException
- Throws:
Parser.ParserExceptionjava.io.IOException
-
parseGIBlock
protected void parseGIBlock(SunflowAPIInterface api) throws Parser.ParserException, java.io.IOException, ColorFactory.ColorSpecificationException
- Throws:
Parser.ParserExceptionjava.io.IOExceptionColorFactory.ColorSpecificationException
-
parseLightserverBlock
protected void parseLightserverBlock(SunflowAPIInterface api) throws Parser.ParserException, java.io.IOException
- Throws:
Parser.ParserExceptionjava.io.IOException
-
parseTraceBlock
protected void parseTraceBlock(SunflowAPIInterface api) throws Parser.ParserException, java.io.IOException
- Throws:
Parser.ParserExceptionjava.io.IOException
-
parseCamera
protected void parseCamera(SunflowAPIInterface api) throws Parser.ParserException, java.io.IOException
- Throws:
Parser.ParserExceptionjava.io.IOException
-
parseCameraTransform
protected void parseCameraTransform(SunflowAPIInterface api) throws Parser.ParserException, java.io.IOException
- Throws:
Parser.ParserExceptionjava.io.IOException
-
parseCameraMatrix
protected void parseCameraMatrix(int index, SunflowAPIInterface api) throws java.io.IOException, Parser.ParserException- Throws:
java.io.IOExceptionParser.ParserException
-
parseShader
protected boolean parseShader(SunflowAPIInterface api) throws Parser.ParserException, java.io.IOException, ColorFactory.ColorSpecificationException
- Throws:
Parser.ParserExceptionjava.io.IOExceptionColorFactory.ColorSpecificationException
-
parseModifier
protected boolean parseModifier(SunflowAPIInterface api) throws Parser.ParserException, java.io.IOException
- Throws:
Parser.ParserExceptionjava.io.IOException
-
parseObjectBlock
protected void parseObjectBlock(SunflowAPIInterface api) throws Parser.ParserException, java.io.IOException
- Throws:
Parser.ParserExceptionjava.io.IOException
-
parseInstanceBlock
protected void parseInstanceBlock(SunflowAPIInterface api) throws Parser.ParserException, java.io.IOException
- Throws:
Parser.ParserExceptionjava.io.IOException
-
parseLightBlock
protected void parseLightBlock(SunflowAPIInterface api) throws Parser.ParserException, java.io.IOException, ColorFactory.ColorSpecificationException
- Throws:
Parser.ParserExceptionjava.io.IOExceptionColorFactory.ColorSpecificationException
-
parseNode
protected boolean parseNode(SunflowAPIInterface api) throws Parser.ParserException, java.io.IOException
- Throws:
Parser.ParserExceptionjava.io.IOException
-
parseColor
protected Color parseColor() throws java.io.IOException, Parser.ParserException, ColorFactory.ColorSpecificationException
- Throws:
java.io.IOExceptionParser.ParserExceptionColorFactory.ColorSpecificationException
-
parsePoint
protected Point3 parsePoint() throws java.io.IOException
- Throws:
java.io.IOException
-
parseVector
protected Vector3 parseVector() throws java.io.IOException
- Throws:
java.io.IOException
-
parseIntArray
protected int[] parseIntArray(int size) throws java.io.IOException- Throws:
java.io.IOException
-
parseFloatArray
protected float[] parseFloatArray(int size) throws java.io.IOException- Throws:
java.io.IOException
-
parseMatrix
protected Matrix4 parseMatrix() throws java.io.IOException, Parser.ParserException
- Throws:
java.io.IOExceptionParser.ParserException
-
-