Package snap.gfx3d

Class VertexArray

java.lang.Object
snap.gfx3d.VertexArray
All Implemented Interfaces:
Cloneable

public class VertexArray extends Object implements Cloneable
This class manages raw vertex data (points, colors, normals, texture coords).
  • Constructor Details

    • VertexArray

      public VertexArray()
      Constructor.
  • Method Details

    • getPointCount

      public int getPointCount()
      Returns the number of vertex points in array.
    • addPoint

      public void addPoint(double aVal1, double aVal2, double aVal3)
      Adds value triplet to array.
    • getPoint3D

      public Point3D getPoint3D(int anIndex)
      Returns the Point3D at index.
    • getPoint3D

      public Point3D getPoint3D(Point3D aPoint, int anIndex)
      Returns the Point3D at index.
    • addColor

      public void addColor(double aRed, double aGreen, double aBlue, double anAlpha)
      Adds a color to vertex color components array.
    • addColor

      public void addColor(Color aColor)
      Adds a color to vertex color components array.
    • addTexCoord

      public void addTexCoord(double aU, double aV)
      Adds a texture coord to vertex texture coords array.
    • getPointCompCount

      public int getPointCompCount()
      Returns the number of components for a vertex point.
    • getColorCompCount

      public int getColorCompCount()
      Returns the number of components for a vertex color.
    • getColor

      public Color getColor()
      Returns the global color.
    • setColor

      public void setColor(Color aColor)
      Sets the global color if set.
    • getTexture

      public Texture getTexture()
      Returns the texture to render on geometry surface.
    • setTexture

      public void setTexture(Texture aTexture)
      Sets the texture to render on geometry surface.
    • isDoubleSided

      public boolean isDoubleSided()
      Returns whether shape surfaces are double-sided.
    • setDoubleSided

      public void setDoubleSided(boolean aValue)
      Sets whether shape surfaces are double-sided.
    • getNext

      public VertexArray getNext()
      Returns the next VertexArray, if part of a chain.
    • setNext

      public void setNext(VertexArray aVertexArray)
      Sets the next VertexArray, if part of a chain.
    • getLast

      public VertexArray getLast()
      Returns the last VertexArray (just returns this if no more).
    • setLast

      public void setLast(VertexArray aVertexArray)
      Sets the last VertexArray, if part of a chain.
    • getPointArray

      public float[] getPointArray()
      Returns the vertex points components array.
    • setPointArray

      public void setPointArray(float[] pointArray)
      Sets the vertex points components array.
    • getColorArray

      public float[] getColorArray()
      Returns the vertex colors components array.
    • isColorArraySet

      public boolean isColorArraySet()
      Returns whether color components array is set.
    • getTexCoordArray

      public float[] getTexCoordArray()
      Returns the vertex texture coords array.
    • setTexCoordArray

      public void setTexCoordArray(float[] texCoordArray)
      Sets the vertex texture coords array.
    • isTexCoordArraySet

      public boolean isTexCoordArraySet()
      Returns whether texture coords array is set.
    • isTextureSetAndReady

      public boolean isTextureSetAndReady()
      Returns whether texture is set and loaded and text coords are set.
    • getIndexArray

      public int[] getIndexArray()
      Returns the index array, if points have special ordering.
    • setIndexArray

      public void setIndexArray(int[] indexArray)
      Sets the index array, if points have special ordering.
    • isIndexArraySet

      public boolean isIndexArraySet()
      Returns whether index array is set.
    • getBounds3D

      public Bounds3D getBounds3D()
      Returns bounds.
    • trim

      public void trim()
      Trims arrays.
    • transformPoints

      public void transformPoints(Matrix3D aTrans)
      Transforms points by transform.
    • copyForTransform

      public VertexArray copyForTransform(Matrix3D aTrans)
      Copies VertexArray for given transform.
    • clone

      public VertexArray clone()
      Standard clone implementation.
      Overrides:
      clone in class Object