Package org.sunflow
Interface SunflowAPIInterface
-
- All Known Implementing Classes:
RealtimeBenchmark
,SunflowAPI
public interface SunflowAPIInterface
This interface represents the entry point for rendering scenes using Sunflow. Classes which implement this interface are able to receive input from any of the Sunflow parsers.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
camera(java.lang.String name, java.lang.String lensType)
Defines a camera with a given name.void
currentFrame(int currentFrame)
Set the value of the current frame.void
geometry(java.lang.String name, java.lang.String typeName)
Defines a geometry with a given name.boolean
include(java.lang.String filename)
Parse the specified filename.void
instance(java.lang.String name, java.lang.String geoname)
Instance the specified geometry into the scene.void
light(java.lang.String name, java.lang.String lightType)
Defines a light source with a given name.void
modifier(java.lang.String name, java.lang.String modifierType)
Defines a modifier with a given name.void
options(java.lang.String name)
Defines an option object to hold the current parameters.void
parameter(java.lang.String name, boolean value)
Declare a parameter with the specified name and value.void
parameter(java.lang.String name, float value)
Declare a parameter with the specified name and value.void
parameter(java.lang.String name, int value)
Declare a parameter with the specified name and value.void
parameter(java.lang.String name, int[] value)
Declare a parameter with the specified name and value.void
parameter(java.lang.String name, java.lang.String value)
Declare a parameter with the specified name and value.void
parameter(java.lang.String name, java.lang.String[] value)
Declare a parameter with the specified name and value.void
parameter(java.lang.String name, java.lang.String colorspace, float... data)
Declare a color parameter in the given colorspace using the specified name and value.void
parameter(java.lang.String name, java.lang.String type, java.lang.String interpolation, float[] data)
Declare a parameter with the specified name.void
parameter(java.lang.String name, Matrix4 value)
Declare a parameter with the specified name and value.void
parameter(java.lang.String name, Point2 value)
Declare a parameter with the specified name and value.void
parameter(java.lang.String name, Point3 value)
Declare a parameter with the specified name and value.void
parameter(java.lang.String name, Vector3 value)
Declare a parameter with the specified name and value.void
plugin(java.lang.String type, java.lang.String name, java.lang.String code)
Declare a plugin of the specified type with the given name from a java code string.void
remove(java.lang.String name)
Remove the specified render object.void
render(java.lang.String optionsName, Display display)
Render using the specified options and the specified display.void
reset()
Reset the state of the API completely.void
searchpath(java.lang.String type, java.lang.String path)
Add the specified path to the list of directories which are searched automatically to resolve scene filenames or textures.void
shader(java.lang.String name, java.lang.String shaderType)
Defines a shader with a given name.
-
-
-
Method Detail
-
reset
void reset()
Reset the state of the API completely. The object table is cleared, and all search paths are set back to their default values.
-
plugin
void plugin(java.lang.String type, java.lang.String name, java.lang.String code)
Declare a plugin of the specified type with the given name from a java code string. The code will be compiled with Janino and registered as a new plugin type upon success.- Parameters:
type
-name
-code
-
-
parameter
void parameter(java.lang.String name, java.lang.String value)
Declare a parameter with the specified name and value. This parameter will be added to the currently active parameter list.- Parameters:
name
- parameter namevalue
- parameter value
-
parameter
void parameter(java.lang.String name, boolean value)
Declare a parameter with the specified name and value. This parameter will be added to the currently active parameter list.- Parameters:
name
- parameter namevalue
- parameter value
-
parameter
void parameter(java.lang.String name, int value)
Declare a parameter with the specified name and value. This parameter will be added to the currently active parameter list.- Parameters:
name
- parameter namevalue
- parameter value
-
parameter
void parameter(java.lang.String name, float value)
Declare a parameter with the specified name and value. This parameter will be added to the currently active parameter list.- Parameters:
name
- parameter namevalue
- parameter value
-
parameter
void parameter(java.lang.String name, java.lang.String colorspace, float... data)
Declare a color parameter in the given colorspace using the specified name and value. This parameter will be added to the currently active parameter list.- Parameters:
name
- parameter namecolorspace
- color space ornull
to assume internal color spacedata
- floating point color data
-
parameter
void parameter(java.lang.String name, Point3 value)
Declare a parameter with the specified name and value. This parameter will be added to the currently active parameter list.- Parameters:
name
- parameter namevalue
- parameter value
-
parameter
void parameter(java.lang.String name, Vector3 value)
Declare a parameter with the specified name and value. This parameter will be added to the currently active parameter list.- Parameters:
name
- parameter namevalue
- parameter value
-
parameter
void parameter(java.lang.String name, Point2 value)
Declare a parameter with the specified name and value. This parameter will be added to the currently active parameter list.- Parameters:
name
- parameter namevalue
- parameter value
-
parameter
void parameter(java.lang.String name, Matrix4 value)
Declare a parameter with the specified name and value. This parameter will be added to the currently active parameter list.- Parameters:
name
- parameter namevalue
- parameter value
-
parameter
void parameter(java.lang.String name, int[] value)
Declare a parameter with the specified name and value. This parameter will be added to the currently active parameter list.- Parameters:
name
- parameter namevalue
- parameter value
-
parameter
void parameter(java.lang.String name, java.lang.String[] value)
Declare a parameter with the specified name and value. This parameter will be added to the currently active parameter list.- Parameters:
name
- parameter namevalue
- parameter value
-
parameter
void parameter(java.lang.String name, java.lang.String type, java.lang.String interpolation, float[] data)
Declare a parameter with the specified name. The type may be one of the follow: "float", "point", "vector", "texcoord", "matrix". The interpolation determines how the parameter is to be interpreted over surface (seeParameterList.InterpolationType
). The data is specified in a flattened float array.- Parameters:
name
- parameter nametype
- parameter data typeinterpolation
- parameter interpolation modedata
- raw floating point data
-
remove
void remove(java.lang.String name)
Remove the specified render object. Note that this may cause the removal of other objects which depended on it.- Parameters:
name
- name of the object to remove
-
searchpath
void searchpath(java.lang.String type, java.lang.String path)
Add the specified path to the list of directories which are searched automatically to resolve scene filenames or textures. Currently the supported searchpath types are: "include" and "texture". All other types will be ignored.- Parameters:
path
-
-
shader
void shader(java.lang.String name, java.lang.String shaderType)
Defines a shader with a given name. If the shader type name is leftnull
, the shader with the given name will be updated (if it exists).- Parameters:
name
- a unique name given to the shadershaderType
- a shader plugin type
-
modifier
void modifier(java.lang.String name, java.lang.String modifierType)
Defines a modifier with a given name. If the modifier type name is leftnull
, the modifier with the given name will be updated (if it exists).- Parameters:
name
- a unique name given to the modifiermodifierType
- a modifier plugin type name
-
geometry
void geometry(java.lang.String name, java.lang.String typeName)
Defines a geometry with a given name. The geometry is built from the specified type. Note that geometries may be created fromTesselatable
objects orPrimitiveList
objects. This means that two seperate plugin lists will be searched for the geometry type.Tesselatable
objects are search first. If the type name is leftnull
, the geometry with the given name will be updated (if it exists).- Parameters:
name
- a unique name given to the geometrytypeName
- a tesselatable or primitive plugin type name
-
instance
void instance(java.lang.String name, java.lang.String geoname)
Instance the specified geometry into the scene. If geoname isnull
, the specified instance object will be updated (if it exists). In order to change the instancing relationship of an existing instance, you should use the "geometry" string attribute.- Parameters:
name
- instance namegeoname
- name of the geometry to instance
-
light
void light(java.lang.String name, java.lang.String lightType)
Defines a light source with a given name. If the light type name is leftnull
, the light source with the given name will be updated (if it exists).- Parameters:
name
- a unique name given to the light sourcelightType
- a light source plugin type name
-
camera
void camera(java.lang.String name, java.lang.String lensType)
Defines a camera with a given name. The camera is built from the specified camera lens type plugin. If the lens type name is leftnull
, the camera with the given name will be updated (if it exists). It is not currently possible to change the lens of a camera after it has been created.- Parameters:
name
- camera namelensType
- a camera lens plugin type name
-
options
void options(java.lang.String name)
Defines an option object to hold the current parameters. If the object already exists, the values will simply override previous ones.- Parameters:
name
-
-
render
void render(java.lang.String optionsName, Display display)
Render using the specified options and the specified display. If the specified options do not exist - defaults will be used.- Parameters:
optionsName
- name of theRenderObject
which contains the optionsdisplay
- display object
-
include
boolean include(java.lang.String filename)
Parse the specified filename. The include paths are searched first. The contents of the file are simply added to the active scene. This allows to break up a scene into parts, even across file formats. The appropriate parser is chosen based on file extension.- Parameters:
filename
- filename to load- Returns:
true
upon sucess,false
if an error occured.
-
currentFrame
void currentFrame(int currentFrame)
Set the value of the current frame. This value is intended only for procedural animation creation. It is not used by the Sunflow core in anyway. The default value is 1.- Parameters:
currentFrame
- current frame number
-
-