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 int
instanceCounter
private int
instanceNumber
private int
numLightSamples
private java.util.HashMap<java.lang.String,java.lang.Integer>
objectNames
protected Parser
p
-
Constructor Summary
Constructors Constructor Description SCParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.String
generateUniqueName(java.lang.String prefix)
boolean
parse(java.lang.String filename, SunflowAPIInterface api)
Parse the specified file to create a scene description into the providedSunflowAPI
object.protected void
parseBackgroundBlock(SunflowAPIInterface api)
protected void
parseCamera(SunflowAPIInterface api)
protected void
parseCameraMatrix(int index, SunflowAPIInterface api)
protected void
parseCameraTransform(SunflowAPIInterface api)
protected Color
parseColor()
protected void
parseFilter(SunflowAPIInterface api)
protected float[]
parseFloatArray(int size)
protected void
parseGIBlock(SunflowAPIInterface api)
protected void
parseImageBlock(SunflowAPIInterface api)
protected void
parseInstanceBlock(SunflowAPIInterface api)
protected int[]
parseIntArray(int size)
protected void
parseLightBlock(SunflowAPIInterface api)
protected void
parseLightserverBlock(SunflowAPIInterface api)
protected Matrix4
parseMatrix()
protected boolean
parseModifier(SunflowAPIInterface api)
protected boolean
parseNode(SunflowAPIInterface api)
protected void
parseObjectBlock(SunflowAPIInterface api)
protected void
parsePhotonBlock(SunflowAPIInterface api)
protected Point3
parsePoint()
protected boolean
parseShader(SunflowAPIInterface api)
protected void
parseTraceBlock(SunflowAPIInterface api)
protected Vector3
parseVector()
-
-
-
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:SceneParser
Parse the specified file to create a scene description into the providedSunflowAPI
object.- Specified by:
parse
in interfaceSceneParser
- Parameters:
filename
- filename to parseapi
- scene to parse the file into- Returns:
true
upon sucess, orfalse
if errors have occured.
-
parseImageBlock
protected void parseImageBlock(SunflowAPIInterface api) throws java.io.IOException, Parser.ParserException
- Throws:
java.io.IOException
Parser.ParserException
-
parseBackgroundBlock
protected void parseBackgroundBlock(SunflowAPIInterface api) throws java.io.IOException, Parser.ParserException, ColorFactory.ColorSpecificationException
- Throws:
java.io.IOException
Parser.ParserException
ColorFactory.ColorSpecificationException
-
parseFilter
protected void parseFilter(SunflowAPIInterface api) throws java.io.IOException, Parser.ParserException
- Throws:
java.io.IOException
Parser.ParserException
-
parsePhotonBlock
protected void parsePhotonBlock(SunflowAPIInterface api) throws Parser.ParserException, java.io.IOException
- Throws:
Parser.ParserException
java.io.IOException
-
parseGIBlock
protected void parseGIBlock(SunflowAPIInterface api) throws Parser.ParserException, java.io.IOException, ColorFactory.ColorSpecificationException
- Throws:
Parser.ParserException
java.io.IOException
ColorFactory.ColorSpecificationException
-
parseLightserverBlock
protected void parseLightserverBlock(SunflowAPIInterface api) throws Parser.ParserException, java.io.IOException
- Throws:
Parser.ParserException
java.io.IOException
-
parseTraceBlock
protected void parseTraceBlock(SunflowAPIInterface api) throws Parser.ParserException, java.io.IOException
- Throws:
Parser.ParserException
java.io.IOException
-
parseCamera
protected void parseCamera(SunflowAPIInterface api) throws Parser.ParserException, java.io.IOException
- Throws:
Parser.ParserException
java.io.IOException
-
parseCameraTransform
protected void parseCameraTransform(SunflowAPIInterface api) throws Parser.ParserException, java.io.IOException
- Throws:
Parser.ParserException
java.io.IOException
-
parseCameraMatrix
protected void parseCameraMatrix(int index, SunflowAPIInterface api) throws java.io.IOException, Parser.ParserException
- Throws:
java.io.IOException
Parser.ParserException
-
parseShader
protected boolean parseShader(SunflowAPIInterface api) throws Parser.ParserException, java.io.IOException, ColorFactory.ColorSpecificationException
- Throws:
Parser.ParserException
java.io.IOException
ColorFactory.ColorSpecificationException
-
parseModifier
protected boolean parseModifier(SunflowAPIInterface api) throws Parser.ParserException, java.io.IOException
- Throws:
Parser.ParserException
java.io.IOException
-
parseObjectBlock
protected void parseObjectBlock(SunflowAPIInterface api) throws Parser.ParserException, java.io.IOException
- Throws:
Parser.ParserException
java.io.IOException
-
parseInstanceBlock
protected void parseInstanceBlock(SunflowAPIInterface api) throws Parser.ParserException, java.io.IOException
- Throws:
Parser.ParserException
java.io.IOException
-
parseLightBlock
protected void parseLightBlock(SunflowAPIInterface api) throws Parser.ParserException, java.io.IOException, ColorFactory.ColorSpecificationException
- Throws:
Parser.ParserException
java.io.IOException
ColorFactory.ColorSpecificationException
-
parseNode
protected boolean parseNode(SunflowAPIInterface api) throws Parser.ParserException, java.io.IOException
- Throws:
Parser.ParserException
java.io.IOException
-
parseColor
protected Color parseColor() throws java.io.IOException, Parser.ParserException, ColorFactory.ColorSpecificationException
- Throws:
java.io.IOException
Parser.ParserException
ColorFactory.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.IOException
Parser.ParserException
-
-