Class Point

All Implemented Interfaces:
Pickable, Hintable, Renderable, Savable

public class Point extends Mesh
Point defines a collection of vertices that are rendered as single points or textured sprites depending on PointType.
  • Constructor Details

    • Point

      public Point()
    • Point

      public Point(Point.PointType type)
    • Point

      public Point(String name, ReadOnlyVector3[] vertex, ReadOnlyVector3[] normal, ReadOnlyColorRGBA[] color, ReadOnlyVector2[] texture)
      Constructor instantiates a new Point object with a given set of data. Any data may be null, except the vertex array. If this is null an exception is thrown.
      Parameters:
      name - the name of the scene element. This is required for identification and comparison purposes.
      vertex - the vertices or points.
      normal - the normals of the points.
      color - the color of the points.
      texture - the texture coordinates of the points.
    • Point

      public Point(String name, FloatBuffer vertex, FloatBuffer normal, FloatBuffer color, FloatBufferData coords)
      Constructor instantiates a new Point object with a given set of data. Any data may be null, except the vertex array. If this is null an exception is thrown.
      Parameters:
      name - the name of the scene element. This is required for identification and comparison purposes.
      vertex - the vertices or points.
      normal - the normals of the points.
      color - the color of the points.
      coords - the texture coordinates of the points.
  • Method Details

    • isPointSprite

      public boolean isPointSprite()
    • enableDistanceAttenuation

      public void enableDistanceAttenuation(boolean bool)
      Default attenuation coefficient is calculated to work best with pointSize = 1.
      Parameters:
      bool - true to enable the distance attenuation
    • setDistanceAttenuationCoefficients

      public void setDistanceAttenuationCoefficients(float a, float b, float c)
      Distance Attenuation Equation:
      x = distance from the eye
      Derived Size = clamp( pointSize * sqrt( attenuation(x) ) )
      attenuation(x) = 1 / (a + b*x + c*x^2)

      Default coefficients used are(they should work best with pointSize=1):
      a = 0, b = 0, c = 0.000004f
      This should give(without taking regards to the max,min pointSize clamping):
      1. A size of 1 pixel at distance of 500 units.
      Derived Size = 1/(0.000004*500^2) = 1
      2. A size of 25 pixel at distance of 100 units.
      3. A size of 2500 at a distance of 10 units.

      Parameters:
      a - constant term in the attenuation equation
      b - linear term in the attenuation equation
      c - quadratic term in the attenuation equation
      See Also:
    • isAntialiased

      public boolean isAntialiased()
      Returns:
      true if points are to be drawn antialiased
    • setAntialiased

      public void setAntialiased(boolean antialiased)
      Sets whether the point should be antialiased. May decrease performance. If you want to enabled antialiasing, you should also use an alphastate with a source of SourceFunction.SourceAlpha and a destination of DB_ONE_MINUS_SRC_ALPHA or DB_ONE.
      Parameters:
      antialiased - true if the line should be antialiased.
    • getPointType

      public Point.PointType getPointType()
    • setPointType

      public void setPointType(Point.PointType pointType)
    • getPointSize

      public float getPointSize()
      Returns:
      the pixel size of each point.
    • setPointSize

      public void setPointSize(float size)
      Sets the pixel width of the point when drawn. Non anti-aliased point sizes are rounded to the nearest whole number by opengl.
      Parameters:
      size - The size to set.
    • setMaxPointSize

      public void setMaxPointSize(float maxSize)
      When DistanceAttenuation is enabled, the points maximum size will get clamped to this value.
      Parameters:
      maxSize - the points maximum size to set
    • getMaxPointSize

      public float getMaxPointSize()
      Returns:
      the points maximum size
    • setMinPointSize

      public void setMinPointSize(float minSize)
      When DistanceAttenuation is enabled, the points minimum size will get clamped to this value.
      Parameters:
      minSize - the points minimum size to set
    • getMinPointSize

      public float getMinPointSize()
      Returns:
      the points minimum size
    • makeCopy

      public Point makeCopy(boolean shareGeometricData)
      Description copied from class: Spatial
      Create a copy of this spatial.
      Overrides:
      makeCopy in class Mesh
      Parameters:
      shareGeometricData - if true, reuse any data fields describing the geometric shape of the spatial, as applicable.
      Returns:
      the copy as described.
    • write

      public void write(OutputCapsule capsule) throws IOException
      Specified by:
      write in interface Savable
      Overrides:
      write in class Mesh
      Parameters:
      capsule - the capsule
      Throws:
      IOException - Signals that an I/O exception has occurred.
      See Also:
    • read

      public void read(InputCapsule capsule) throws IOException
      Specified by:
      read in interface Savable
      Overrides:
      read in class Mesh
      Parameters:
      capsule - the input capsule
      Throws:
      IOException - Signals that an I/O exception has occurred.
      See Also:
    • render

      public void render(Renderer renderer)
      Description copied from interface: Renderable
      Render the object using the supplied renderer instance.
      Specified by:
      render in interface Renderable
      Overrides:
      render in class Mesh
      Parameters:
      renderer - the renderer