Commits

Michael Ludwig committed 91cc5a6

Complete new buffer data API, including documentation

Comments (0)

Files changed (11)

ferox-renderer/ferox-renderer-api/src/main/java/com/ferox/resource/data/BufferData.java

 
     /**
      * <p/>
-     * Create a BufferData that will store <tt>length</tt> primitives of the given data
-     * type, <tt>type</tt>. This constructor verifies that the length is at least 0, but
+     * Create a BufferData that will store <var>length</var> primitives of the given data
+     * type, <var>type</var>. This constructor verifies that the length is at least 0, but
      * subclasses may further restrict to be greater.
      *
      * @param type   The data type of this BufferData

ferox-renderer/ferox-renderer-api/src/main/java/com/ferox/resource/data/ByteData.java

 package com.ferox.resource.data;
 
 /**
- * Created with IntelliJ IDEA. User: michaelludwig Date: 3/7/13 Time: 1:12 AM To change
- * this template use File | Settings | File Templates.
+ * ByteData is a buffer data implementation that stores signed byte values in a byte[]
+ * array. Because it is signed data, its only usable as vertex data. {@link
+ * UnsignedByteData} should be used for element or texel data.
+ * <p/>
+ * ByteData can be interpreted by OpenGL as normalized floating point values. If a
+ * ByteData instance is normalized, a byte value of -128 is -1.0 and a byte value of 127
+ * becomes 1.0.
+ *
+ * @author Michael Ludwig
  */
 public class ByteData extends BufferData implements VertexData {
     private final boolean normalized;
-    private byte[] data;
+    private final byte[] data;
 
+    /**
+     * Create a new ByteData instance with the given <var>length</var>. It will create a
+     * new byte array and will not be normalized.
+     *
+     * @param length The length of the byte data
+     *
+     * @throws NegativeArraySizeException if length is negative
+     */
     public ByteData(int length) {
         this(length, false);
     }
 
+    /**
+     * Create a new ByteData instance that will create a new byte array of the given
+     * <var>length</var>. The data will be treated as normalized or not depending on the
+     * <var>normalized</var> parameter.
+     *
+     * @param length     The length of the byte data
+     * @param normalized True if the byte data is normalized to floating point
+     *
+     * @throws NegativeArraySizeException if length is negative
+     */
     public ByteData(int length, boolean normalized) {
-        super(DataType.BYTE, length);
-        this.normalized = normalized;
+        this(new byte[length], normalized);
     }
 
+    /**
+     * Create a new ByteData instance that wraps the given byte array and treats the data
+     * as not normalized.
+     *
+     * @param data The array to wrap
+     *
+     * @throws NullPointerException if data is null
+     */
     public ByteData(byte[] data) {
         this(data, false);
     }
 
+    /**
+     * Create a new ByteData instance that wraps the given byte array and will treat the
+     * data as normalized or not depending on the <var>normalized</var> parameter.
+     *
+     * @param data       The data to wrap
+     * @param normalized True if the byte data is normalized
+     *
+     * @throws NullPointerException if data is null
+     */
     public ByteData(byte[] data, boolean normalized) {
         super(DataType.BYTE, data.length);
         this.normalized = normalized;
         this.data = data;
     }
 
-    @Override
-    public double getCoordinate(int i) {
-        return 0;  //To change body of implemented methods use File | Settings | File Templates.
+    /**
+     * Get whether or not the byte data is normalized to floating point values by OpenGL.
+     * If this returns true, a byte value of -128 becomes -1.0 and a byte value of 127
+     * becomes 1.0. Intermediate byte values are similarly converted to the range (-1.0,
+     * 1.0).
+     *
+     * @return True if it is normalized.
+     */
+    public boolean isNormalized() {
+        return normalized;
+    }
+
+    /**
+     * Get the byte array backing this ByteData instance.
+     *
+     * @return Non-null array with a length equal to {@link #getLength()}
+     */
+    public byte[] getArray() {
+        return data;
     }
 
     @Override
-    public void setColorComponent(int i, double value) {
-        //To change body of implemented methods use File | Settings | File Templates.
+    public double getCoordinate(int i) {
+        int value = data[i];
+        if (normalized) {
+            return 2.0 * (value + 128.0) / 255.0 - 1.0;
+        } else {
+            return value;
+        }
+    }
+
+    @Override
+    public void setCoordinate(int i, double value) {
+        if (normalized) {
+            data[i] = (byte) ((value + 1.0) * 255.0 / 2.0 - 128.0);
+        } else {
+            data[i] = (byte) value;
+        }
     }
 }

ferox-renderer/ferox-renderer-api/src/main/java/com/ferox/resource/data/ElementData.java

  */
 public interface ElementData {
     /**
-     * Get the unsigned integer element index at buffer index <tt>i</tt>. Depending on the
-     * underlying data type of the buffer data, the actual range of values returned may be
-     * less than a full 32-bit unsigned integer. The long return type is to guarantee that
-     * all unsigned integer values can be returned.
+     * Get the unsigned integer element index at buffer index <var>i</var>. Depending on
+     * the underlying data type of the buffer data, the actual range of values returned
+     * may be less than a full 32-bit unsigned integer. The long return type is to
+     * guarantee that all unsigned integer values can be returned.
      *
      * @param i The buffer index
      *
     public long getElementIndex(int i);
 
     /**
-     * Set the unsigned element index at the buffer index <tt>i</tt>. If the underlying
+     * Set the unsigned element index at the buffer index <var>i</var>. If the underlying
      * data type of the buffer has less precision than 32 bits, the value will be
      * truncated to fit.
      *

ferox-renderer/ferox-renderer-api/src/main/java/com/ferox/resource/data/FloatData.java

 package com.ferox.resource.data;
 
 /**
- * Created with IntelliJ IDEA. User: michaelludwig Date: 3/7/13 Time: 1:06 AM To change
- * this template use File | Settings | File Templates.
+ * FloatData is a buffer data implementation that stores 32-bit floating point values.
+ * Depending on where the buffer is used, values outside the range [0, 1] may be clamped
+ * by OpenGL or invalid.
+ *
+ * @author Michael Ludwig
  */
 public class FloatData extends BufferData implements TexelData, VertexData {
-    private float[] data;
+    private final float[] data;
 
     /**
      * <p/>
-     * Create a FloatData that will store <tt>length</tt> floats.
+     * Create a FloatData that will store <var>length</var> floats. It will create a new
+     * array of the given length to wrap.
      *
      * @param length The length of the buffer data
      *
-     * @throws IllegalArgumentException if length is less than 0
+     * @throws NegativeArraySizeException if length is less than 0
      */
     public FloatData(int length) {
-        super(DataType.FLOAT, length);
-        data = null;
+        this(new float[length]);
     }
 
     /**
      * <p/>
      * Create a FloatData that wraps the given float[] array. The buffer data's length
-     * will be equal to the length of the array. It will initially point to the given
-     * array instance.
+     * will be equal to the length of the array.
      *
-     * @param data The initial array to wrap
+     * @param data The array to wrap
      *
      * @throws NullPointerException if data is null
      */
         this.data = data;
     }
 
+    /**
+     * Get the float[] array that backs this FloatData instance. The returned array will
+     * be non-null and have a length equal to {@link #getLength()}.
+     *
+     * @return The array backing this FloatData instance
+     */
+    public float[] getArray() {
+        return data;
+    }
+
     @Override
     public double getColorComponent(int i) {
-        return 0;  //To change body of implemented methods use File | Settings | File Templates.
+        return data[i];
     }
 
     @Override
     public double getCoordinate(int i) {
-        return 0;  //To change body of implemented methods use File | Settings | File Templates.
+        return data[i];
     }
 
     @Override
     public void setColorComponent(int i, double value) {
-        //To change body of implemented methods use File | Settings | File Templates.
+        data[i] = (float) value;
+    }
+
+    @Override
+    public void setCoordinate(int i, double value) {
+        data[i] = (float) value;
     }
 }

ferox-renderer/ferox-renderer-api/src/main/java/com/ferox/resource/data/IntData.java

 package com.ferox.resource.data;
 
+
 /**
- * Created with IntelliJ IDEA. User: michaelludwig Date: 3/7/13 Time: 1:12 AM To change
- * this template use File | Settings | File Templates.
+ * IntData is a buffer data implementation that stores signed int values in a int[] array.
+ * Because it is signed data, its only usable as vertex data. {@link UnsignedIntData}
+ * should be used for element or texel data.
+ * <p/>
+ * IntData can be interpreted by OpenGL as normalized floating point values. If a IntData
+ * instance is normalized, an int value of {@link Integer#MIN_VALUE} is -1.0 and an int
+ * value of {@link Integer#MAX_VALUE} becomes 1.0.
+ *
+ * @author Michael Ludwig
  */
 public class IntData extends BufferData implements VertexData {
+    private static final double OFFSET = (double) Integer.MIN_VALUE;
+    private static final double SCALE = 4294967295.0;
+
     private final boolean normalized;
-    private int[] data;
+    private final int[] data;
 
+    /**
+     * Create a new IntData instance with the given <var>length</var>. It will create a
+     * new int array and will not be normalized.
+     *
+     * @param length The length of the int data
+     *
+     * @throws NegativeArraySizeException if length is negative
+     */
     public IntData(int length) {
         this(length, false);
     }
 
+    /**
+     * Create a new IntData instance that will create a new int array of the given
+     * <var>length</var>. The data will be treated as normalized or not depending on the
+     * <var>normalized</var> parameter.
+     *
+     * @param length     The length of the int data
+     * @param normalized True if the int data is normalized to floating point
+     *
+     * @throws NegativeArraySizeException if length is negative
+     */
     public IntData(int length, boolean normalized) {
-        super(DataType.INT, length);
-        this.normalized = normalized;
+        this(new int[length], normalized);
     }
 
+    /**
+     * Create a new IntData instance that wraps the given int array and treats the data as
+     * not normalized.
+     *
+     * @param data The array to wrap
+     *
+     * @throws NullPointerException if data is null
+     */
     public IntData(int[] data) {
         this(data, false);
     }
 
+    /**
+     * Create a new IntData instance that wraps the given int array and will treat the
+     * data as normalized or not depending on the <var>normalized</var> parameter.
+     *
+     * @param data       The data to wrap
+     * @param normalized True if the int data is normalized
+     *
+     * @throws NullPointerException if data is null
+     */
     public IntData(int[] data, boolean normalized) {
         super(DataType.INT, data.length);
         this.normalized = normalized;
         this.data = data;
     }
 
-    @Override
-    public double getCoordinate(int i) {
-        return 0;  //To change body of implemented methods use File | Settings | File Templates.
+    /**
+     * Get whether or not the int data is normalized to floating point values by OpenGL.
+     * If this returns true, a int value of -128 becomes -1.0 and a int value of 127
+     * becomes 1.0. Intermediate int values are similarly converted to the range (-1.0,
+     * 1.0).
+     *
+     * @return True if it is normalized.
+     */
+    public boolean isNormalized() {
+        return normalized;
+    }
+
+    /**
+     * Get the int array backing this IntData instance.
+     *
+     * @return Non-null array with a length equal to {@link #getLength()}
+     */
+    public int[] getArray() {
+        return data;
     }
 
     @Override
-    public void setColorComponent(int i, double value) {
-        //To change body of implemented methods use File | Settings | File Templates.
+    public double getCoordinate(int i) {
+        int value = data[i];
+        if (normalized) {
+            return 2.0 * (value - OFFSET) / SCALE - 1.0;
+        } else {
+            return value;
+        }
+    }
+
+    @Override
+    public void setCoordinate(int i, double value) {
+        if (normalized) {
+            data[i] = (int) ((value + 1.0) * SCALE / 2.0 + OFFSET);
+        } else {
+            data[i] = (int) value;
+        }
     }
 }

ferox-renderer/ferox-renderer-api/src/main/java/com/ferox/resource/data/ShortData.java

 package com.ferox.resource.data;
 
 /**
- * Created with IntelliJ IDEA. User: michaelludwig Date: 3/7/13 Time: 1:12 AM To change
- * this template use File | Settings | File Templates.
+ * ShortData is a buffer data implementation that stores signed short values in a short[]
+ * array. Because it is signed data, its only usable as vertex data. {@link
+ * UnsignedShortData} should be used for element or texel data.
+ * <p/>
+ * ShortData can be interpreted by OpenGL as normalized floating point values. If a
+ * ShortData instance is normalized, an short value of {@link Short#MIN_VALUE} is -1.0 and
+ * an short value of {@link Short#MAX_VALUE} becomes 1.0.
+ *
+ * @author Michael Ludwig
  */
 public class ShortData extends BufferData implements VertexData {
+    private static final double OFFSET = (double) Short.MIN_VALUE;
+    private static final double SCALE = 65535.0;
+
     private final boolean normalized;
-    private short[] data;
+    private final short[] data;
 
+    /**
+     * Create a new ShortData instance with the given <var>length</var>. It will create a
+     * new short array and will not be normalized.
+     *
+     * @param length The length of the short data
+     *
+     * @throws NegativeArraySizeException if length is negative
+     */
     public ShortData(int length) {
         this(length, false);
     }
 
+    /**
+     * Create a new ShortData instance that will create a new short array of the given
+     * <var>length</var>. The data will be treated as normalized or not depending on the
+     * <var>normalized</var> parameter.
+     *
+     * @param length     The length of the short data
+     * @param normalized True if the short data is normalized to floating point
+     *
+     * @throws NegativeArraySizeException if length is negative
+     */
     public ShortData(int length, boolean normalized) {
-        super(DataType.INT, length);
-        this.normalized = normalized;
+        this(new short[length], normalized);
     }
 
+    /**
+     * Create a new ShortData instance that wraps the given short array and treats the
+     * data as not normalized.
+     *
+     * @param data The array to wrap
+     *
+     * @throws NullPointerException if data is null
+     */
     public ShortData(short[] data) {
         this(data, false);
     }
 
+    /**
+     * Create a new ShortData instance that wraps the given short array and will treat the
+     * data as normalized or not depending on the <var>normalized</var> parameter.
+     *
+     * @param data       The data to wrap
+     * @param normalized True if the short data is normalized
+     *
+     * @throws NullPointerException if data is null
+     */
     public ShortData(short[] data, boolean normalized) {
-        super(DataType.INT, data.length);
+        super(DataType.SHORT, data.length);
         this.normalized = normalized;
         this.data = data;
     }
 
-    @Override
-    public double getCoordinate(int i) {
-        return 0;  //To change body of implemented methods use File | Settings | File Templates.
+    /**
+     * Get whether or not the short data is normalized to floating point values by OpenGL.
+     * If this returns true, a short value of -128 becomes -1.0 and a short value of 127
+     * becomes 1.0. Intermediate short values are similarly converted to the range (-1.0,
+     * 1.0).
+     *
+     * @return True if it is normalized.
+     */
+    public boolean isNormalized() {
+        return normalized;
+    }
+
+    /**
+     * Get the short array backing this ShortData instance.
+     *
+     * @return Non-null array with a length equal to {@link #getLength()}
+     */
+    public short[] getArray() {
+        return data;
     }
 
     @Override
-    public void setColorComponent(int i, double value) {
-        //To change body of implemented methods use File | Settings | File Templates.
+    public double getCoordinate(int i) {
+        short value = data[i];
+        if (normalized) {
+            return 2.0 * (value - OFFSET) / SCALE - 1.0;
+        } else {
+            return value;
+        }
+    }
+
+    @Override
+    public void setCoordinate(int i, double value) {
+        if (normalized) {
+            data[i] = (short) ((value + 1.0) * SCALE / 2.0 + OFFSET);
+        } else {
+            data[i] = (short) value;
+        }
     }
 }

ferox-renderer/ferox-renderer-api/src/main/java/com/ferox/resource/data/TexelData.java

  */
 public interface TexelData {
     /**
-     * Get the color component value at buffer index <tt>i</tt>. If the underlying data is
-     * already floating point, the value is returned as is. If the data is an integer
+     * Get the color component value at buffer index <var>i</var>. If the underlying data
+     * is already floating point, the value is returned as is. If the data is an integer
      * type, it is normalized to the range [0, 1].
      *
      * @param i The buffer index
     public double getColorComponent(int i);
 
     /**
-     * Set the color component value at the buffer index <tt>i</tt>. If the underlying
+     * Set the color component value at the buffer index <var>i</var>. If the underlying
      * data type of the buffer is floating point, the value is kept as is barring any loss
      * of precision. If the data is an integer type, the value is assumed to be in the
      * range [0, 1] and is unnormalized to the full range of the data type.

ferox-renderer/ferox-renderer-api/src/main/java/com/ferox/resource/data/UnsignedByteData.java

 package com.ferox.resource.data;
 
 /**
- * Created with IntelliJ IDEA. User: michaelludwig Date: 3/7/13 Time: 1:13 AM To change
- * this template use File | Settings | File Templates.
+ * UnsignedByteData is a buffer data implementation that stores data in byte[] arrays.
+ * Although Java treats bytes as 2's complement signed values, the byte patterns in these
+ * arrays will be treated by OpenGL as 1's complement unsigned values.
+ * <p/>
+ * When used as a element data, the range of interpreted values will be in [0, 255]. When
+ * used as texel data, the data will be normalized from [0, 255] to [0.0, 1.0] similarly
+ * to how the signed byte data is normalized to [-1.0, 1.0].
+ *
+ * @author Michael Ludwig
  */
 public class UnsignedByteData extends BufferData implements TexelData, ElementData {
     private byte[] data;
 
+    /**
+     * Create a new UnsignedByteData instance with the given <var>length</var>. It will
+     * create a new byte array.
+     *
+     * @param length The length of the byte data
+     *
+     * @throws NegativeArraySizeException if length is negative
+     */
     public UnsignedByteData(int length) {
-        super(DataType.BYTE, length);
-        data = null;
+        this(new byte[length]);
     }
 
+    /**
+     * Create a new UnsignedByteData instance that wraps the given byte array and treats
+     * the data.
+     *
+     * @param data The array to wrap
+     *
+     * @throws NullPointerException if data is null
+     */
     public UnsignedByteData(byte[] data) {
         super(DataType.BYTE, data.length);
         this.data = data;
     }
 
+    /**
+     * Get the byte array backing this UnsignedByteData instance.
+     *
+     * @return Non-null array with a length equal to {@link #getLength()}
+     */
+    public byte[] getArray() {
+        return data;
+    }
+
     @Override
     public long getElementIndex(int i) {
-        return 0;  //To change body of implemented methods use File | Settings | File Templates.
+        return (0xff & data[i]);
     }
 
     @Override
     public void setElementIndex(int i, long value) {
-        //To change body of implemented methods use File | Settings | File Templates.
+        data[i] = (byte) value;
     }
 
     @Override
     public double getColorComponent(int i) {
-        return 0;  //To change body of implemented methods use File | Settings | File Templates.
+        return (0xff & data[i]) / 255.0;
     }
 
     @Override
     public void setColorComponent(int i, double value) {
-        //To change body of implemented methods use File | Settings | File Templates.
+        data[i] = (byte) (value * 255);
     }
 }

ferox-renderer/ferox-renderer-api/src/main/java/com/ferox/resource/data/UnsignedIntData.java

 package com.ferox.resource.data;
 
 /**
- * Created with IntelliJ IDEA. User: michaelludwig Date: 3/7/13 Time: 1:13 AM To change
- * this template use File | Settings | File Templates.
+ * UnsignedIntData is a buffer data implementation that stores data in int[] arrays.
+ * Although Java treats ints as 2's complement signed values, the int patterns in these
+ * arrays will be treated by OpenGL as 1's complement unsigned values.
+ * <p/>
+ * When used as a element data, the range of interpreted values will be in [0,
+ * 4294967296]. When used as texel data, the data will be normalized from [0, 4294967296]
+ * to [0.0, 1.0] similarly to how the signed int data is normalized to [-1.0, 1.0].
+ *
+ * @author Michael Ludwig
  */
 public class UnsignedIntData extends BufferData implements TexelData, ElementData {
+    private static final double SCALE = 4294967295.0;
+
     private int[] data;
 
+    /**
+     * Create a new UnsignedIntData instance with the given <var>length</var>. It will
+     * create a new int array.
+     *
+     * @param length The length of the int data
+     *
+     * @throws NegativeArraySizeException if length is negative
+     */
     public UnsignedIntData(int length) {
-        super(DataType.INT, length);
-        data = null;
+        this(new int[length]);
     }
 
+    /**
+     * Create a new UnsignedIntData instance that wraps the given int array and treats the
+     * data.
+     *
+     * @param data The array to wrap
+     *
+     * @throws NullPointerException if data is null
+     */
     public UnsignedIntData(int[] data) {
         super(DataType.INT, data.length);
         this.data = data;
     }
 
+    /**
+     * Get the int array backing this UnsignedIntData instance.
+     *
+     * @return Non-null array with a length equal to {@link #getLength()}
+     */
+    public int[] getArray() {
+        return data;
+    }
+
     @Override
     public long getElementIndex(int i) {
-        return 0;  //To change body of implemented methods use File | Settings | File Templates.
+        return (0xffffffffL & (long) data[i]);
     }
 
     @Override
     public void setElementIndex(int i, long value) {
-        //To change body of implemented methods use File | Settings | File Templates.
+        data[i] = (int) value;
     }
 
     @Override
     public double getColorComponent(int i) {
-        return 0;  //To change body of implemented methods use File | Settings | File Templates.
+        return (0xffffffffL & (long) data[i]) / SCALE;
     }
 
     @Override
     public void setColorComponent(int i, double value) {
-        //To change body of implemented methods use File | Settings | File Templates.
+        long discrete = (long) (value * SCALE);
+        data[i] = (int) discrete;
     }
 }

ferox-renderer/ferox-renderer-api/src/main/java/com/ferox/resource/data/UnsignedShortData.java

 package com.ferox.resource.data;
 
 /**
- * Created with IntelliJ IDEA. User: michaelludwig Date: 3/7/13 Time: 1:13 AM To change
- * this template use File | Settings | File Templates.
+ * UnsignedShortData is a buffer data implementation that stores data in short[] arrays.
+ * Although Java treats shorts as 2's complement signed values, the short patterns in
+ * these arrays will be treated by OpenGL as 1's complement unsigned values.
+ * <p/>
+ * When used as a element data, the range of interpreted values will be in [0, 65536].
+ * When used as texel data, the data will be normalized from [0, 65536] to [0.0, 1.0]
+ * similarly to how the signed short data is normalized to [-1.0, 1.0].
+ *
+ * @author Michael Ludwig
  */
 public class UnsignedShortData extends BufferData implements TexelData, ElementData {
+    private static final double SCALE = 65535.0;
+
     private short[] data;
 
+    /**
+     * Create a new UnsignedShortData instance with the given <var>length</var>. It will
+     * create a new short array.
+     *
+     * @param length The length of the short data
+     *
+     * @throws NegativeArraySizeException if length is negative
+     */
     public UnsignedShortData(int length) {
-        super(DataType.SHORT, length);
-        data = null;
+        this(new short[length]);
     }
 
+    /**
+     * Create a new UnsignedShortData instance that wraps the given short array and treats
+     * the data.
+     *
+     * @param data The array to wrap
+     *
+     * @throws NullPointerException if data is null
+     */
     public UnsignedShortData(short[] data) {
         super(DataType.SHORT, data.length);
         this.data = data;
     }
 
+    /**
+     * Get the short array backing this UnsignedShortData instance.
+     *
+     * @return Non-null array with a length equal to {@link #getLength()}
+     */
+    public short[] getArray() {
+        return data;
+    }
+
     @Override
     public long getElementIndex(int i) {
-        return 0;  //To change body of implemented methods use File | Settings | File Templates.
+        return (0xffff & data[i]);
     }
 
     @Override
     public void setElementIndex(int i, long value) {
-        //To change body of implemented methods use File | Settings | File Templates.
+        data[i] = (short) value;
     }
 
     @Override
     public double getColorComponent(int i) {
-        return 0;  //To change body of implemented methods use File | Settings | File Templates.
+        return (0xffff & data[i]) / SCALE;
     }
 
     @Override
     public void setColorComponent(int i, double value) {
-        //To change body of implemented methods use File | Settings | File Templates.
+        data[i] = (short) (value * SCALE);
     }
 }

ferox-renderer/ferox-renderer-api/src/main/java/com/ferox/resource/data/VertexData.java

  */
 public interface VertexData {
     /**
-     * Get the coordinate value at buffer index <tt>i</tt>. If the underlying data is
+     * Get the coordinate value at buffer index <var>i</var>. If the underlying data is
      * already floating point, the value is returned as is. If the data is an integer
-     * type, it is coerced into a double (i.e. 100 becomes 100.0).
+     * type, it is converted to a double by either coercion (i.e. 100 becomes 100.0) or by
+     * normalization (i.e 127 becomes 1.0 for bytes).
+     * <p/>
+     * The exact conversion for integral types depends on the concrete type of the buffer.
+     * It must be consistent so that a given instance will never change from normalizing
+     * to coerced.
      *
      * @param i The buffer index
      *
     public double getCoordinate(int i);
 
     /**
-     * Set the coordinate value at the buffer index <tt>i</tt>. If the underlying data
-     * type of the buffer is floating point, the value is kept as is barring any loss of
-     * precision. If the data is an integer type, the value is cast to the range of the
-     * type losing any fractional part (i.e. 100.3 becomes 100).
+     * Set the coordinate value at the buffer index <var>i</var>. If the underlying data
+     * type of the buffer is floating point, the value is kept as, is barring any loss of
+     * precision. If the data is an integer type, the value is either cast to the range of
+     * the type losing any fractional part (i.e. 100.3 becomes 100), or unnormalized from
+     * [-1.0, 1.0] to the full precision of the integral type.
+     * <p/>
+     * The exact conversion for integral types depends on the concrete type of the buffer.
+     * It must be consistent so that a given instance will never change from normalizing
+     * to coerced.
      *
      * @param i     The buffer index
      * @param value The coordinate value
      *
      * @throws ArrayIndexOutOfBoundsException if i is out of bounds
      */
-    public void setColorComponent(int i, double value);
+    public void setCoordinate(int i, double value);
 }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.