public class SunflowAPI extends java.lang.Object implements SunflowAPIInterface
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_OPTIONS |
static java.lang.String |
VERSION |
| Constructor and Description |
|---|
SunflowAPI()
Creates an empty scene.
|
| Modifier and Type | Method and Description |
|---|---|
void |
build()
This method does nothing, but may be overriden to create scenes
procedurally.
|
void |
camera(java.lang.String name,
java.lang.String lensType)
Defines a camera with a given name.
|
static SunflowAPI |
compile(java.lang.String code)
Compile the specified code string via Janino.
|
static SunflowAPI |
create(java.lang.String filename,
int frameNumber)
Create an API object from the specified file.
|
int |
currentFrame()
Read the value of the current frame.
|
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.
|
BoundingBox |
getBounds()
Retrieve the bounding box of the scene.
|
TextureCache |
getTextureCache() |
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.
|
Geometry |
lookupGeometry(java.lang.String name)
Retrieve a geometry object by its name, or
null if no
geometry was found, or if the specified object is not a geometry. |
Modifier |
lookupModifier(java.lang.String name)
Retrieve a modifier object by its name, or
null if no
modifier was found, or if the specified object is not a modifier. |
Shader |
lookupShader(java.lang.String name)
Retrieve a shader object by its name, or
null if no shader
was found, or if the specified object is not a shader. |
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,
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,
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,
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.
|
java.lang.String |
resolveIncludeFilename(java.lang.String filename)
Attempts to resolve the specified filename by checking it against the
include search path.
|
java.lang.String |
resolveTextureFilename(java.lang.String filename)
Attempts to resolve the specified filename by checking it against the
texture search path.
|
static void |
runSystemCheck()
This is a quick system test which verifies that the user has launched
Java properly.
|
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.
|
static boolean |
translate(java.lang.String filename,
java.lang.String outputFilename)
Translate specfied file into the native sunflow scene file format.
|
public static final java.lang.String VERSION
public static final java.lang.String DEFAULT_OPTIONS
public static void runSystemCheck()
public final void reset()
SunflowAPIInterfacereset in interface SunflowAPIInterfacepublic final void plugin(java.lang.String type,
java.lang.String name,
java.lang.String code)
SunflowAPIInterfaceplugin in interface SunflowAPIInterfacepublic final void parameter(java.lang.String name,
java.lang.String value)
SunflowAPIInterfaceparameter in interface SunflowAPIInterfacename - parameter namevalue - parameter valuepublic final void parameter(java.lang.String name,
boolean value)
SunflowAPIInterfaceparameter in interface SunflowAPIInterfacename - parameter namevalue - parameter valuepublic final void parameter(java.lang.String name,
int value)
SunflowAPIInterfaceparameter in interface SunflowAPIInterfacename - parameter namevalue - parameter valuepublic final void parameter(java.lang.String name,
float value)
SunflowAPIInterfaceparameter in interface SunflowAPIInterfacename - parameter namevalue - parameter valuepublic final void parameter(java.lang.String name,
java.lang.String colorspace,
float... data)
SunflowAPIInterfaceparameter in interface SunflowAPIInterfacename - parameter namecolorspace - color space or null to assume internal
color spacedata - floating point color datapublic final void parameter(java.lang.String name,
Point3 value)
SunflowAPIInterfaceparameter in interface SunflowAPIInterfacename - parameter namevalue - parameter valuepublic final void parameter(java.lang.String name,
Vector3 value)
SunflowAPIInterfaceparameter in interface SunflowAPIInterfacename - parameter namevalue - parameter valuepublic final void parameter(java.lang.String name,
Point2 value)
SunflowAPIInterfaceparameter in interface SunflowAPIInterfacename - parameter namevalue - parameter valuepublic final void parameter(java.lang.String name,
Matrix4 value)
SunflowAPIInterfaceparameter in interface SunflowAPIInterfacename - parameter namevalue - parameter valuepublic final void parameter(java.lang.String name,
int[] value)
SunflowAPIInterfaceparameter in interface SunflowAPIInterfacename - parameter namevalue - parameter valuepublic final void parameter(java.lang.String name,
java.lang.String[] value)
SunflowAPIInterfaceparameter in interface SunflowAPIInterfacename - parameter namevalue - parameter valuepublic final void parameter(java.lang.String name,
java.lang.String type,
java.lang.String interpolation,
float[] data)
SunflowAPIInterfaceParameterList.InterpolationType). The data is specified in a
flattened float array.parameter in interface SunflowAPIInterfacename - parameter nametype - parameter data typeinterpolation - parameter interpolation modedata - raw floating point datapublic void remove(java.lang.String name)
SunflowAPIInterfaceremove in interface SunflowAPIInterfacename - name of the object to removepublic final void searchpath(java.lang.String type,
java.lang.String path)
SunflowAPIInterfacesearchpath in interface SunflowAPIInterfacepublic final java.lang.String resolveTextureFilename(java.lang.String filename)
filename - filenamepublic final java.lang.String resolveIncludeFilename(java.lang.String filename)
filename - filenamepublic final void shader(java.lang.String name,
java.lang.String shaderType)
SunflowAPIInterfacenull, the shader with the given name will be updated (if
it exists).shader in interface SunflowAPIInterfacename - a unique name given to the shadershaderType - a shader plugin typepublic final void modifier(java.lang.String name,
java.lang.String modifierType)
SunflowAPIInterfacenull, the modifier with the given name will be updated
(if it exists).modifier in interface SunflowAPIInterfacename - a unique name given to the modifiermodifierType - a modifier plugin type namepublic final void geometry(java.lang.String name,
java.lang.String typeName)
SunflowAPIInterfaceTesselatable objects or PrimitiveList 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 left
null, the geometry with the given name will be updated
(if it exists).geometry in interface SunflowAPIInterfacename - a unique name given to the geometrytypeName - a tesselatable or primitive plugin type namepublic final void instance(java.lang.String name,
java.lang.String geoname)
SunflowAPIInterfacenull, 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.instance in interface SunflowAPIInterfacename - instance namegeoname - name of the geometry to instancepublic final void light(java.lang.String name,
java.lang.String lightType)
SunflowAPIInterfacenull, the light source with the given name will be
updated (if it exists).light in interface SunflowAPIInterfacename - a unique name given to the light sourcelightType - a light source plugin type namepublic final void camera(java.lang.String name,
java.lang.String lensType)
SunflowAPIInterfacenull, 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.camera in interface SunflowAPIInterfacename - camera namelensType - a camera lens plugin type namepublic final void options(java.lang.String name)
SunflowAPIInterfaceoptions in interface SunflowAPIInterfacepublic final Geometry lookupGeometry(java.lang.String name)
null if no
geometry was found, or if the specified object is not a geometry.name - geometry namepublic final Shader lookupShader(java.lang.String name)
null if no shader
was found, or if the specified object is not a shader.name - shader namepublic final Modifier lookupModifier(java.lang.String name)
null if no
modifier was found, or if the specified object is not a modifier.name - modifier namepublic final void render(java.lang.String optionsName,
Display display)
SunflowAPIInterfacerender in interface SunflowAPIInterfaceoptionsName - name of the RenderObject which contains the
optionsdisplay - display objectpublic final boolean include(java.lang.String filename)
SunflowAPIInterfaceinclude in interface SunflowAPIInterfacefilename - filename to loadtrue upon sucess, false if an error
occured.public final BoundingBox getBounds()
render(String, Display) has been made.public void build()
public static SunflowAPI create(java.lang.String filename, int frameNumber)
filename - filename to loadnull on failurepublic static boolean translate(java.lang.String filename,
java.lang.String outputFilename)
filename - input filenameoutputFilename - output filenametrue upon success, false otherwisepublic static SunflowAPI compile(java.lang.String code)
code - java code stringnull
otherwise.public int currentFrame()
public void currentFrame(int currentFrame)
SunflowAPIInterfacecurrentFrame in interface SunflowAPIInterfacecurrentFrame - current frame numberpublic TextureCache getTextureCache()