|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.sunflow.SunflowAPI
public class SunflowAPI
This API gives a simple interface for creating scenes procedurally. This is the main entry point to Sunflow. To use this class, extend from it and implement the build method which may execute arbitrary code to create a scene.
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_OPTIONS
|
static java.lang.String |
VERSION
|
Constructor Summary | |
---|---|
SunflowAPI()
Creates an empty scene. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String VERSION
public static final java.lang.String DEFAULT_OPTIONS
Constructor Detail |
---|
public SunflowAPI()
Method Detail |
---|
public static void runSystemCheck()
public final void reset()
SunflowAPIInterface
reset
in interface SunflowAPIInterface
public final void plugin(java.lang.String type, java.lang.String name, java.lang.String code)
SunflowAPIInterface
plugin
in interface SunflowAPIInterface
public final void parameter(java.lang.String name, java.lang.String value)
SunflowAPIInterface
parameter
in interface SunflowAPIInterface
name
- parameter namevalue
- parameter valuepublic final void parameter(java.lang.String name, boolean value)
SunflowAPIInterface
parameter
in interface SunflowAPIInterface
name
- parameter namevalue
- parameter valuepublic final void parameter(java.lang.String name, int value)
SunflowAPIInterface
parameter
in interface SunflowAPIInterface
name
- parameter namevalue
- parameter valuepublic final void parameter(java.lang.String name, float value)
SunflowAPIInterface
parameter
in interface SunflowAPIInterface
name
- parameter namevalue
- parameter valuepublic final void parameter(java.lang.String name, java.lang.String colorspace, float... data)
SunflowAPIInterface
parameter
in interface SunflowAPIInterface
name
- parameter namecolorspace
- color space or null
to assume internal
color spacedata
- floating point color datapublic final void parameter(java.lang.String name, Point3 value)
SunflowAPIInterface
parameter
in interface SunflowAPIInterface
name
- parameter namevalue
- parameter valuepublic final void parameter(java.lang.String name, Vector3 value)
SunflowAPIInterface
parameter
in interface SunflowAPIInterface
name
- parameter namevalue
- parameter valuepublic final void parameter(java.lang.String name, Point2 value)
SunflowAPIInterface
parameter
in interface SunflowAPIInterface
name
- parameter namevalue
- parameter valuepublic final void parameter(java.lang.String name, Matrix4 value)
SunflowAPIInterface
parameter
in interface SunflowAPIInterface
name
- parameter namevalue
- parameter valuepublic final void parameter(java.lang.String name, int[] value)
SunflowAPIInterface
parameter
in interface SunflowAPIInterface
name
- parameter namevalue
- parameter valuepublic final void parameter(java.lang.String name, java.lang.String[] value)
SunflowAPIInterface
parameter
in interface SunflowAPIInterface
name
- parameter namevalue
- parameter valuepublic final void parameter(java.lang.String name, java.lang.String type, java.lang.String interpolation, float[] data)
SunflowAPIInterface
ParameterList.InterpolationType
). The data is specified in a
flattened float array.
parameter
in interface SunflowAPIInterface
name
- parameter nametype
- parameter data typeinterpolation
- parameter interpolation modedata
- raw floating point datapublic void remove(java.lang.String name)
SunflowAPIInterface
remove
in interface SunflowAPIInterface
name
- name of the object to removepublic final void searchpath(java.lang.String type, java.lang.String path)
SunflowAPIInterface
searchpath
in interface SunflowAPIInterface
public final java.lang.String resolveTextureFilename(java.lang.String filename)
filename
- filename
public final java.lang.String resolveIncludeFilename(java.lang.String filename)
filename
- filename
public final void shader(java.lang.String name, java.lang.String shaderType)
SunflowAPIInterface
null
, the shader with the given name will be updated (if
it exists).
shader
in interface SunflowAPIInterface
name
- a unique name given to the shadershaderType
- a shader plugin typepublic final void modifier(java.lang.String name, java.lang.String modifierType)
SunflowAPIInterface
null
, the modifier with the given name will be updated
(if it exists).
modifier
in interface SunflowAPIInterface
name
- a unique name given to the modifiermodifierType
- a modifier plugin type namepublic final void geometry(java.lang.String name, java.lang.String typeName)
SunflowAPIInterface
Tesselatable
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 SunflowAPIInterface
name
- 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)
SunflowAPIInterface
null
, 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 SunflowAPIInterface
name
- instance namegeoname
- name of the geometry to instancepublic final void light(java.lang.String name, java.lang.String lightType)
SunflowAPIInterface
null
, the light source with the given name will be
updated (if it exists).
light
in interface SunflowAPIInterface
name
- 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)
SunflowAPIInterface
null
, 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 SunflowAPIInterface
name
- camera namelensType
- a camera lens plugin type namepublic final void options(java.lang.String name)
SunflowAPIInterface
options
in interface SunflowAPIInterface
public final Geometry lookupGeometry(java.lang.String name)
null
if no
geometry was found, or if the specified object is not a geometry.
name
- geometry name
public final Shader lookupShader(java.lang.String name)
null
if no shader
was found, or if the specified object is not a shader.
name
- shader name
public final Modifier lookupModifier(java.lang.String name)
null
if no
modifier was found, or if the specified object is not a modifier.
name
- modifier name
public final void render(java.lang.String optionsName, Display display)
SunflowAPIInterface
render
in interface SunflowAPIInterface
optionsName
- name of the RenderObject
which contains the
optionsdisplay
- display objectpublic final boolean include(java.lang.String filename)
SunflowAPIInterface
include
in interface SunflowAPIInterface
filename
- filename to load
true
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 load
null
on failurepublic static boolean translate(java.lang.String filename, java.lang.String outputFilename)
filename
- input filenameoutputFilename
- output filename
true
upon success, false
otherwisepublic static SunflowAPI compile(java.lang.String code)
code
- java code string
null
otherwise.public int currentFrame()
public void currentFrame(int currentFrame)
SunflowAPIInterface
currentFrame
in interface SunflowAPIInterface
currentFrame
- current frame numberpublic TextureCache getTextureCache()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |