Class SoMFColorRGBA
- java.lang.Object
-
- com.openinventor.inventor.Inventor
-
- com.openinventor.inventor.fields.SoField
-
- com.openinventor.inventor.fields.SoMField
-
- com.openinventor.inventor.fields.SoMFColorRGBA
-
public class SoMFColorRGBA extends SoMField
Multiple-value field containing any number of RGBA colors stored as four floats. A multiple-value field that contains any number of RGBA colors, stored as instances ofSbColorRGBA
. RGBA stands for red, green, blue and alpha. Values should be in the range 0 to 1. Alpha is the inverse of "transparency", in other words 0 is fully transparent and 1 is fully opaque.Values can also be specified or queried in the HSV (hue, saturation and value) color space, but values are stored internally as RGBA values.
SoMFColorRGBAs are written to file as one or more RGBA quadruples of floating point numbers in standard scientific notation. When more than one value is present, all of the values are enclosed in square brackets and separated by commas. For example:
represents the three colors half transparent red, fully opeque green, and one quarter transparent blue.[ 1.0 0.0 0.0 0.5, 0 1 0 1, 0 0 1 .25 ] Data copying:
SoMF fields are a kind of "smart container", automatically expanding as necessary to hold the data provided by the application. This is very convenient, but for large blocks of data it may be desireable to avoid making a copy of the application data. The setValuesBuffer() methods allow Open Inventor to directly use an array of values supplied by the application. The application data is not copied. Please see
SoMFVec3f
for more information and example code.- See Also:
SbColorRGBA
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.openinventor.inventor.fields.SoField
SoField.FieldTypes
-
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
-
Field Summary
-
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
-
Constructor Summary
Constructors Constructor Description SoMFColorRGBA(SoFieldContainer fieldContainer, java.lang.String fieldName, SoField.FieldTypes fieldType)
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
disableDeleteValues()
Temporary disable value deleting.boolean
equals(java.lang.Object obj)
int
find(SbColorRGBA targetValue)
Calls find(targetValue, false).int
find(SbColorRGBA targetValue, boolean addIfNotFound)
Finds the given targetValue in the array and returns the index of that value.void
finishEditing()
Indicates that batch edits have finished.java.nio.FloatBuffer
getDirectValues(int start)
Returns a pointer into the array of values in the field, starting at index start.SbColorRGBA
getValueAt(int i)
SbColorRGBA[]
getValues(int start)
Returns a pointer into the array of values in the field, starting at index start.void
set1HSVAValue(int index, float[] hsva)
Sets one of N HSV plus Alpha colors from an array of 4 floats.void
set1HSVAValue(int index, float h, float s, float v, float a)
Sets one of N HSV plus Alpha colors from 4 floats.void
set1Value(int index, float[] rgba)
Sets one of N RGBA colors from an array of 4 floats.void
set1Value(int index, float r, float g, float b, float a)
Sets one of N RGBA colors from 4 floats.void
set1Value(int index, SbColorRGBA newValue)
Sets the index'th value in the array to newValue.void
set1Value(int index, SbVec4f vec)
Sets one of N RGBA colors fromSbVec4f
.void
setHSVAValue(float[] hsva)
Sets the field to contain one and only one value, the given color (expressed as an array of HSV plus Alpha floating point values in the range 0.0 to 1.0), and deletes the second and subsequent values.void
setHSVAValue(float h, float s, float v, float a)
Sets the field to contain one and only one value, the given color (expressed as HSV plus Alpha floating point values in the range 0.0 to 1.0), and deletes the second and subsequent values.void
setValue(float[] rgba)
Sets the field to contain one and only one value, the given color (expressed as an array of RGBA floating point values in the range 0.0 to 1.0), and deletes the second and subsequent values.void
setValue(float r, float g, float b, float a)
Sets the field to contain one and only one value, the given color (expressed as RGBA floating point values in the range 0.0 to 1.0), and deletes the second and subsequent values.void
setValue(SbColorRGBA newValue)
Sets the first value in the array to newValue, and deletes.void
setValue(SbVec4f vec)
Sets the field to contain one and only one value, the given color (expressed as RGBA floating point values in the range 0.0 to 1.0), and deletes the second and subsequent values.void
setValues(int start, float[] rgba)
Sets RGBA values from the specified array of floats.void
setValues(int start, int num, float[] rgba)
Deprecated.As of Open Inventor 9.3.1, usesetValues(int, float[])
instead.void
setValues(int start, SbColorRGBA[] newValues)
Sets num values starting at index start to the values.void
setValuesBuffer(java.nio.ByteBuffer userData)
Sets the field to contain the values stored in userData.java.nio.FloatBuffer
startEditing()
Returns a pointer to the internally maintained array that can be modified.-
Methods inherited from class com.openinventor.inventor.fields.SoMField
deleteValues, deleteValues, get1, getNum, insertSpace, set1, setNum
-
Methods inherited from class com.openinventor.inventor.fields.SoField
appendConnection, appendConnection, connectFrom, connectFrom, disconnect, disconnect, disconnect, enableConnection, get, getConnectedEngine, getConnectedField, getContainer, getNumConnections, getValueSize, isConnected, isConnectedFromEngine, isConnectedFromField, isConnectedFromVRMLInterp, isConnectionEnabled, isDefault, isIgnored, set, setIgnored, touch
-
Methods inherited from class com.openinventor.inventor.Inventor
dispose, getNativeResourceHandle
-
-
-
-
Constructor Detail
-
SoMFColorRGBA
public SoMFColorRGBA(SoFieldContainer fieldContainer, java.lang.String fieldName, SoField.FieldTypes fieldType)
Default constructor.
-
-
Method Detail
-
setValues
@Deprecated(since="9.3.1") public void setValues(int start, int num, float[] rgba)
Deprecated.As of Open Inventor 9.3.1, usesetValues(int, float[])
instead.Sets num RGBA values from an array of arrays of 4 floats. Each float should be in the range 0.0 to 1.0, and there must be 4* num total float values.
-
find
public int find(SbColorRGBA targetValue)
Calls find(targetValue, false).
-
getValues
public SbColorRGBA[] getValues(int start)
Returns a pointer into the array of values in the field, starting at index start. The values are read-only. See thestartEditing()
/finishEditing() methods for a way of modifying values in place.
-
set1Value
public void set1Value(int index, SbColorRGBA newValue)
Sets the index'th value in the array to newValue. The array will be automatically expanded, if necessary. In that case, if field's values are stored in an user data array, this array is no more used.
-
find
public int find(SbColorRGBA targetValue, boolean addIfNotFound)
Finds the given targetValue in the array and returns the index of that value. in the array. If the value is not found, -1 is returned. If addIfNotFound is set, then targetValue is added to the end of the array (but -1 is still returned).
-
startEditing
public java.nio.FloatBuffer startEditing()
Returns a pointer to the internally maintained array that can be modified. The values in the array may be changed, but values cannot be added or removed. It is illegal to call any other editing methods betweenstartEditing()
andfinishEditing()
(e.g.set1Value()
,setValue()
, etc.). Fields, engines or sensors connected to this field and sensors are not notified that this field has changed untilfinishEditing()
is called. CallingfinishEditing()
always sets theisDefault()
flag to false and informs engines and sensors that the field changed, even if none of the values actually were changed.
-
setValues
public void setValues(int start, SbColorRGBA[] newValues)
Sets num values starting at index start to the values. in newValues. The array will automatically be made larger to accommodate the new values, if necessary. In that case, if field's values are stored in an user data array, this array is no more used.
-
setValues
public void setValues(int start, float[] rgba)
Sets RGBA values from the specified array of floats. Each float should be in the range 0.0 to 1.0, and size of the array must be a multiple of 4.
-
finishEditing
public void finishEditing()
Indicates that batch edits have finished. SeestartEditing()
.
-
getDirectValues
public java.nio.FloatBuffer getDirectValues(int start)
Returns a pointer into the array of values in the field, starting at index start. The values are read-only. See thestartEditing()
/finishEditing() methods for a way of modifying values in place.
-
getValueAt
public SbColorRGBA getValueAt(int i)
-
setValue
public void setValue(SbColorRGBA newValue)
Sets the first value in the array to newValue, and deletes. the second and subsequent values. If field's values are stored in an user data array, this array is no more used.
-
setValuesBuffer
public void setValuesBuffer(java.nio.ByteBuffer userData)
Sets the field to contain the values stored in userData. This data will not be copied into the field: it will be directly used by the field.
-
setHSVAValue
public void setHSVAValue(float[] hsva)
Sets the field to contain one and only one value, the given color (expressed as an array of HSV plus Alpha floating point values in the range 0.0 to 1.0), and deletes the second and subsequent values.
-
set1Value
public void set1Value(int index, SbVec4f vec)
Sets one of N RGBA colors fromSbVec4f
. The array will be expanded and filled with zeros as necessary.
-
setValue
public void setValue(float r, float g, float b, float a)
Sets the field to contain one and only one value, the given color (expressed as RGBA floating point values in the range 0.0 to 1.0), and deletes the second and subsequent values.
-
setValue
public void setValue(float[] rgba)
Sets the field to contain one and only one value, the given color (expressed as an array of RGBA floating point values in the range 0.0 to 1.0), and deletes the second and subsequent values.
-
setHSVAValue
public void setHSVAValue(float h, float s, float v, float a)
Sets the field to contain one and only one value, the given color (expressed as HSV plus Alpha floating point values in the range 0.0 to 1.0), and deletes the second and subsequent values.
-
set1Value
public void set1Value(int index, float r, float g, float b, float a)
Sets one of N RGBA colors from 4 floats. The array will be expanded and filled with zeros as necessary.
-
setValue
public void setValue(SbVec4f vec)
Sets the field to contain one and only one value, the given color (expressed as RGBA floating point values in the range 0.0 to 1.0), and deletes the second and subsequent values.
-
set1HSVAValue
public void set1HSVAValue(int index, float[] hsva)
Sets one of N HSV plus Alpha colors from an array of 4 floats. The array will be expanded and filled with zeros as necessary.
-
disableDeleteValues
public void disableDeleteValues()
Temporary disable value deleting.
-
set1Value
public void set1Value(int index, float[] rgba)
Sets one of N RGBA colors from an array of 4 floats. The array will be expanded and filled with zeros as necessary.
-
set1HSVAValue
public void set1HSVAValue(int index, float h, float s, float v, float a)
Sets one of N HSV plus Alpha colors from 4 floats. The array will be expanded and filled with zeros as necessary.
-
-