Package org.sunflow.core
Class ParameterList
- java.lang.Object
-
- org.sunflow.core.ParameterList
-
- Direct Known Subclasses:
Options
public class ParameterList extends java.lang.ObjectThis class holds a list of "parameters". These are defined and then passed onto rendering objects through the API. They can hold arbitrary typed and named variables as a unified way of getting data into user objects.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classParameterList.FloatParameterRepresents an array of floating point values.static classParameterList.InterpolationTypeprotected static classParameterList.Parameter
-
Field Summary
Fields Modifier and Type Field Description protected FastHashMap<java.lang.String,ParameterList.Parameter>list
-
Constructor Summary
Constructors Constructor Description ParameterList()Creates an empty ParameterList.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBoolean(java.lang.String name, boolean value)Add the specified boolean as a parameter.voidaddColor(java.lang.String name, Color value)Add the specified color as a parameter.voidaddFloat(java.lang.String name, float value)Add the specified float as a parameter.voidaddFloats(java.lang.String name, ParameterList.InterpolationType interp, float[] data)Add the specified floats as a parameter.voidaddInteger(java.lang.String name, int value)Add the specified integer as a parameter.voidaddIntegerArray(java.lang.String name, int[] array)Add the specified array of integers as a parameter.voidaddMatrices(java.lang.String name, ParameterList.InterpolationType interp, float[] data)Add the specified matrices as a parameter.voidaddPoints(java.lang.String name, ParameterList.InterpolationType interp, float[] data)Add the specified points as a parameter.voidaddString(java.lang.String name, java.lang.String value)Add the specified string as a parameter.voidaddStringArray(java.lang.String name, java.lang.String[] array)Add the specified array of integers as a parameter.voidaddTexCoords(java.lang.String name, ParameterList.InterpolationType interp, float[] data)Add the specified texture coordinates as a parameter.voidaddVectors(java.lang.String name, ParameterList.InterpolationType interp, float[] data)Add the specified vectors as a parameter.voidclear(boolean showUnused)Clears the list of all its members.booleangetBoolean(java.lang.String name, boolean defaultValue)Get the specified boolean parameter from this list.ColorgetColor(java.lang.String name, Color defaultValue)Get the specified color parameter from this list.floatgetFloat(java.lang.String name, float defaultValue)Get the specified float parameter from this list.ParameterList.FloatParametergetFloatArray(java.lang.String name)Get the specified float array parameter from this list.intgetInt(java.lang.String name, int defaultValue)Get the specified integer parameter from this list.int[]getIntArray(java.lang.String name)Get the specified integer array parameter from this list.Matrix4getMatrix(java.lang.String name, Matrix4 defaultValue)Get the specified matrix parameter from this list.ParameterList.FloatParametergetMatrixArray(java.lang.String name)Get the specified matrix array parameter from this list.MovingMatrix4getMovingMatrix(java.lang.String name, MovingMatrix4 defaultValue)Point3getPoint(java.lang.String name, Point3 defaultValue)Get the specified point parameter from this list.ParameterList.FloatParametergetPointArray(java.lang.String name)Get the specified point array parameter from this list.java.lang.StringgetString(java.lang.String name, java.lang.String defaultValue)Get the specified string parameter from this list.java.lang.String[]getStringArray(java.lang.String name, java.lang.String[] defaultValue)Get the specified string array parameter from this list.Point2getTexCoord(java.lang.String name, Point2 defaultValue)Get the specified texture coordinate parameter from this list.ParameterList.FloatParametergetTexCoordArray(java.lang.String name)Get the specified texture coordinate array parameter from this list.Vector3getVector(java.lang.String name, Vector3 defaultValue)Get the specified vector parameter from this list.ParameterList.FloatParametergetVectorArray(java.lang.String name)Get the specified vector array parameter from this list.voidsetFaceCount(int numFaces)Setup how many faces should be used to check member count on "face" interpolated parameters.voidsetFaceVertexCount(int numFaceVerts)Setup how many "face-vertices" should be used to check member count of "facevarying" interpolated parameters.voidsetVertexCount(int numVerts)Setup how many vertices should be used to check member count of "vertex" interpolated parameters.
-
-
-
Field Detail
-
list
protected final FastHashMap<java.lang.String,ParameterList.Parameter> list
-
-
Method Detail
-
clear
public void clear(boolean showUnused)
Clears the list of all its members. If some members were never used, a warning will be printed to remind the user something may be wrong.
-
setFaceCount
public void setFaceCount(int numFaces)
Setup how many faces should be used to check member count on "face" interpolated parameters.- Parameters:
numFaces- number of faces
-
setVertexCount
public void setVertexCount(int numVerts)
Setup how many vertices should be used to check member count of "vertex" interpolated parameters.- Parameters:
numVerts- number of vertices
-
setFaceVertexCount
public void setFaceVertexCount(int numFaceVerts)
Setup how many "face-vertices" should be used to check member count of "facevarying" interpolated parameters. This should be equal to the sum of the number of vertices on each face.- Parameters:
numFaceVerts- number of "face-vertices"
-
addString
public void addString(java.lang.String name, java.lang.String value)Add the specified string as a parameter.nullvalues are not permitted.- Parameters:
name- parameter namevalue- parameter value
-
addInteger
public void addInteger(java.lang.String name, int value)Add the specified integer as a parameter.nullvalues are not permitted.- Parameters:
name- parameter namevalue- parameter value
-
addBoolean
public void addBoolean(java.lang.String name, boolean value)Add the specified boolean as a parameter.nullvalues are not permitted.- Parameters:
name- parameter namevalue- parameter value
-
addFloat
public void addFloat(java.lang.String name, float value)Add the specified float as a parameter.nullvalues are not permitted.- Parameters:
name- parameter namevalue- parameter value
-
addColor
public void addColor(java.lang.String name, Color value)Add the specified color as a parameter.nullvalues are not permitted.- Parameters:
name- parameter namevalue- parameter value
-
addIntegerArray
public void addIntegerArray(java.lang.String name, int[] array)Add the specified array of integers as a parameter.nullvalues are not permitted.- Parameters:
name- parameter namearray- parameter value
-
addStringArray
public void addStringArray(java.lang.String name, java.lang.String[] array)Add the specified array of integers as a parameter.nullvalues are not permitted.- Parameters:
name- parameter namearray- parameter value
-
addFloats
public void addFloats(java.lang.String name, ParameterList.InterpolationType interp, float[] data)Add the specified floats as a parameter.nullvalues are not permitted.- Parameters:
name- parameter nameinterp- interpolation typedata- parameter value
-
addPoints
public void addPoints(java.lang.String name, ParameterList.InterpolationType interp, float[] data)Add the specified points as a parameter.nullvalues are not permitted.- Parameters:
name- parameter nameinterp- interpolation typedata- parameter value
-
addVectors
public void addVectors(java.lang.String name, ParameterList.InterpolationType interp, float[] data)Add the specified vectors as a parameter.nullvalues are not permitted.- Parameters:
name- parameter nameinterp- interpolation typedata- parameter value
-
addTexCoords
public void addTexCoords(java.lang.String name, ParameterList.InterpolationType interp, float[] data)Add the specified texture coordinates as a parameter.nullvalues are not permitted.- Parameters:
name- parameter nameinterp- interpolation typedata- parameter value
-
addMatrices
public void addMatrices(java.lang.String name, ParameterList.InterpolationType interp, float[] data)Add the specified matrices as a parameter.nullvalues are not permitted.- Parameters:
name- parameter nameinterp- interpolation typedata- parameter value
-
getString
public java.lang.String getString(java.lang.String name, java.lang.String defaultValue)Get the specified string parameter from this list.- Parameters:
name- name of the parameterdefaultValue- value to return if not found- Returns:
- the value of the parameter specified or default value if not found
-
getStringArray
public java.lang.String[] getStringArray(java.lang.String name, java.lang.String[] defaultValue)Get the specified string array parameter from this list.- Parameters:
name- name of the parameterdefaultValue- value to return if not found- Returns:
- the value of the parameter specified or default value if not found
-
getInt
public int getInt(java.lang.String name, int defaultValue)Get the specified integer parameter from this list.- Parameters:
name- name of the parameterdefaultValue- value to return if not found- Returns:
- the value of the parameter specified or default value if not found
-
getIntArray
public int[] getIntArray(java.lang.String name)
Get the specified integer array parameter from this list.- Parameters:
name- name of the parameter- Returns:
- the value of the parameter specified or
nullif not found
-
getBoolean
public boolean getBoolean(java.lang.String name, boolean defaultValue)Get the specified boolean parameter from this list.- Parameters:
name- name of the parameterdefaultValue- value to return if not found- Returns:
- the value of the parameter specified or default value if not found
-
getFloat
public float getFloat(java.lang.String name, float defaultValue)Get the specified float parameter from this list.- Parameters:
name- name of the parameterdefaultValue- value to return if not found- Returns:
- the value of the parameter specified or default value if not found
-
getColor
public Color getColor(java.lang.String name, Color defaultValue)
Get the specified color parameter from this list.- Parameters:
name- name of the parameterdefaultValue- value to return if not found- Returns:
- the value of the parameter specified or default value if not found
-
getPoint
public Point3 getPoint(java.lang.String name, Point3 defaultValue)
Get the specified point parameter from this list.- Parameters:
name- name of the parameterdefaultValue- value to return if not found- Returns:
- the value of the parameter specified or default value if not found
-
getVector
public Vector3 getVector(java.lang.String name, Vector3 defaultValue)
Get the specified vector parameter from this list.- Parameters:
name- name of the parameterdefaultValue- value to return if not found- Returns:
- the value of the parameter specified or default value if not found
-
getTexCoord
public Point2 getTexCoord(java.lang.String name, Point2 defaultValue)
Get the specified texture coordinate parameter from this list.- Parameters:
name- name of the parameterdefaultValue- value to return if not found- Returns:
- the value of the parameter specified or default value if not found
-
getMatrix
public Matrix4 getMatrix(java.lang.String name, Matrix4 defaultValue)
Get the specified matrix parameter from this list.- Parameters:
name- name of the parameterdefaultValue- value to return if not found- Returns:
- the value of the parameter specified or default value if not found
-
getFloatArray
public ParameterList.FloatParameter getFloatArray(java.lang.String name)
Get the specified float array parameter from this list.- Parameters:
name- name of the parameter- Returns:
- the value of the parameter specified or
nullif not found
-
getPointArray
public ParameterList.FloatParameter getPointArray(java.lang.String name)
Get the specified point array parameter from this list.- Parameters:
name- name of the parameter- Returns:
- the value of the parameter specified or
nullif not found
-
getVectorArray
public ParameterList.FloatParameter getVectorArray(java.lang.String name)
Get the specified vector array parameter from this list.- Parameters:
name- name of the parameter- Returns:
- the value of the parameter specified or
nullif not found
-
getTexCoordArray
public ParameterList.FloatParameter getTexCoordArray(java.lang.String name)
Get the specified texture coordinate array parameter from this list.- Parameters:
name- name of the parameter- Returns:
- the value of the parameter specified or
nullif not found
-
getMatrixArray
public ParameterList.FloatParameter getMatrixArray(java.lang.String name)
Get the specified matrix array parameter from this list.- Parameters:
name- name of the parameter- Returns:
- the value of the parameter specified or
nullif not found
-
getMovingMatrix
public final MovingMatrix4 getMovingMatrix(java.lang.String name, MovingMatrix4 defaultValue)
-
-