|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvrml.eai.field.BaseField
vrml.eai.field.EventOut
vrml.eai.field.EventOutMField
vrml.eai.field.EventOutMFColor
public abstract class EventOutMFColor
Reference to a MFColor event-out slot. Use this class to read values from MFColor event-out slots.
The following example gets the color values from the "color" field of a Color node and prints them to the console:
vrml.eai.Node color = ...; vrml.eai.field.EventOutMFColor color_changed = (vrml.eai.field.EventOutMFColor)color.getEventOut("color_changed"); float[][] c = color_changed.getValue(); for (int i = 0; i < c.length; ++i) System.out.println("red = " + c[i][0] + ", green = " + c[i][1] + ", blue = " + c[i][2]);
Field Summary |
---|
Fields inherited from class vrml.eai.field.BaseField |
---|
MFColor, MFFloat, MFInt32, MFNode, MFRotation, MFString, MFTime, MFVec2f, MFVec3f, SFBool, SFColor, SFFloat, SFImage, SFInt32, SFNode, SFRotation, SFString, SFTime, SFVec2f, SFVec3f |
Constructor Summary | |
---|---|
protected |
EventOutMFColor()
Default Constructor. |
Method Summary | |
---|---|
abstract float[] |
get1Value(int index)
Returns one element of a MFColor event-out slot. |
abstract void |
get1Value(int index,
float[] value)
Returns one element of a MFColor event-out slot. |
abstract float[][] |
getValue()
Returns the current value of a MFColor event-out slot. |
abstract void |
getValue(float[] value)
Returns the current value of a MFColor event-out slot. |
abstract void |
getValue(float[][] value)
Returns the current value of a MFColor event-out slot. |
Methods inherited from class vrml.eai.field.EventOutMField |
---|
size |
Methods inherited from class vrml.eai.field.EventOut |
---|
addVrmlEventListener, getUserData, removeVrmlEventListener, setUserData |
Methods inherited from class vrml.eai.field.BaseField |
---|
getType |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected EventOutMFColor()
Node.getEventOut(java.lang.String)
method.
Method Detail |
---|
public abstract float[][] getValue()
The following example gets the color values from the "color" field of a Color node and prints them to the console:
vrml.eai.Node color = ...; vrml.eai.field.EventOutMFColor color_changed = (vrml.eai.field.EventOutMFColor)color.getEventOut("color_changed"); float[][] c = color_changed.getValue(); for (int i = 0; i < c.length; ++i) System.out.println("red = " + c[i][0] + ", green = " + c[i][1] + ", blue = " + c[i][2]);
public abstract void getValue(float[][] value) throws java.lang.ArrayIndexOutOfBoundsException
The following example gets the color values from the "color" field of a Color node and prints them to the console:
vrml.eai.Node color = ...; vrml.eai.field.EventOutMFColor color_changed = (vrml.eai.field.EventOutMFColor)color.getEventOut("color_changed"); int size = color_changed.size(); float[][] c = new float[size][]; for (int i = 0; i < size; ++i) c[i] = new float[3]; color_changed.getValue(c); for (int i = 0; i < c.length; ++i) System.out.println("red = " + c[i][0] + ", green = " + c[i][1] + ", blue = " + c[i][2]);
value
- An array of float arrays that contain at least three values.
This array gets filled with the current color values. The first
element of each array gets filled with the red color component,
the second element with the green component, and the third element
with the blue component. Each component is between 0 and 1,
inclusively. 0 means no intensity, and 1 means full intensity.
java.lang.ArrayIndexOutOfBoundsException
- when either the value array
is too small, or one of the arrays contained in the value array has
less then three elements.public abstract void getValue(float[] value) throws java.lang.ArrayIndexOutOfBoundsException
The following example gets the color values from the "color" field of a Color node and prints them to the console:
vrml.eai.Node color = ...; vrml.eai.field.EventOutMFColor color_changed = (vrml.eai.field.EventOutMFColor)color.getEventOut("color_changed"); float[] c = new float[color_changed.size() * 3]; color_changed.getValue(c); for (int i = 0; i < c.length; i += 3) System.out.println("red = " + c[i] + ", green = " + c[i + 1] + ", blue = " + c[i + 2]);
value
- An array of float values that gets filled with the
current color values. The number of elements in this array
must be at least three times the number of color values. The
elements at the positions [i x 3] get filled with the red
color components, the elements at [i x 3 + 1] with the green
components, and the elements at [i x 3 + 2] with the blue
components (for 0 <= i < EventOutMField.size()
).
Each component is between 0 and 1, inclusively. 0 means no
intensity, and 1 means full intensity.
java.lang.ArrayIndexOutOfBoundsException
- when the value array is
too small.public abstract float[] get1Value(int index) throws java.lang.ArrayIndexOutOfBoundsException
The following example gets the first color value from the "color" field of a Color node and prints it to the console:
vrml.eai.Node color = ...; vrml.eai.field.EventOutMFColor color_changed = (vrml.eai.field.EventOutMFColor)color.getEventOut("color_changed"); float[] c = color_changed.get1Value(0); System.out.println("red = " + c[0] + ", green = " + c[1] + ", blue = " + c[2]);
index
- The index of the element, starting at 0.
java.lang.ArrayIndexOutOfBoundsException
- when the index is invalid.public abstract void get1Value(int index, float[] value) throws java.lang.ArrayIndexOutOfBoundsException
The following example gets the first color value from the "color" field of a Color node and prints it to the console:
vrml.eai.Node color = ...; vrml.eai.field.EventOutMFColor color_changed = (vrml.eai.field.EventOutMFColor)color.getEventOut("color_changed"); float[] c = new float[3]; color_changed.get1Value(0, 5); System.out.println("red = " + c[0] + ", green = " + c[1] + ", blue = " + c[2]);
index
- The index of the element, starting at 0.value
- An array of at least three float values that gets filled with
the color components. The first value gets filled with the red
color component, the second value with the green component, and
the third value with the blue component. Each component is between
0 and 1, inclusively. 0 means no intensity, and 1 means full
intensity.
java.lang.ArrayIndexOutOfBoundsException
- when the index is invalid, or
the value array has less than three elements.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |