Class FloatPtr

All Implemented Interfaces:
Iterable<FloatPtr>

public final class FloatPtr
extends Struct<FloatPtr>
Points to a float value (float * in C).
  • Constructor Details

    • FloatPtr

      public FloatPtr()
      Creates a new FloatPtr with a value of 0.0f.
    • FloatPtr

      public FloatPtr​(float value)
      Creates a new FloatPtr and initializes it with the specified value.
      Parameters:
      value - the value.
  • Method Details

    • get

      public float get()
      Returns the current value.
      Returns:
      the value.
    • set

      public void set​(float value)
      Sets the value.
      Parameters:
      value - the new value.
    • asFloatBuffer

      public FloatBuffer asFloatBuffer​(int n)
      Returns a FloatBuffer which reads and writes to the same memory location pointed to by this FloatPtr.
      Parameters:
      n - the maximum number of floats the FloatBuffer can read/write. This will be the FloatBuffer's capacity.
      Returns:
      the FloatBuffer.
    • toFloatArray

      public float[] toFloatArray​(int n)
      Copies n floats from the memory pointed to by this FloatPtr to a new float[] instance.
      Parameters:
      n - the number of floats to copy.
      Returns:
      the float[].
    • get

      public void get​(float[] dst)
      Copies dst.length floats from the memory pointed to by this FloatPtr to dst.
      Parameters:
      dst - the destination.
    • get

      public void get​(float[] dst, int offset, int count)
      Copies count floats from the memory pointed to by this FloatPtr to dst starting at offset offset.
      Parameters:
      dst - the destination.
      offset - the offset within the destination array to start copying to.
      count - the number of elements to copy.
    • set

      public void set​(float[] src)
      Copies src.length floats from src to the memory pointed to by this FloatPtr.
      Parameters:
      src - the source.
    • set

      public void set​(float[] src, int offset, int count)
      Copies count floats from src starting at offset offset to the memory pointed to by this FloatPtr.
      Parameters:
      src - the source.
      offset - the offset within the source array to start copying from.
      count - the number of elements to copy.