Package snap.gfx3d
Class VertexArray
java.lang.Object
snap.gfx3d.VertexArray
- All Implemented Interfaces:
Cloneable
This class manages raw vertex data (points, colors, normals, texture coords).
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addColor
(double aRed, double aGreen, double aBlue, double anAlpha) Adds a color to vertex color components array.void
Adds a color to vertex color components array.void
addPoint
(double aVal1, double aVal2, double aVal3) Adds value triplet to array.void
addTexCoord
(double aU, double aV) Adds a texture coord to vertex texture coords array.clone()
Standard clone implementation.copyForTransform
(Matrix3D aTrans) Copies VertexArray for given transform.Returns bounds.getColor()
Returns the global color.float[]
Returns the vertex colors components array.int
Returns the number of components for a vertex color.int[]
Returns the index array, if points have special ordering.getLast()
Returns the last VertexArray (just returns this if no more).getNext()
Returns the next VertexArray, if part of a chain.getPoint3D
(int anIndex) Returns the Point3D at index.getPoint3D
(Point3D aPoint, int anIndex) Returns the Point3D at index.float[]
Returns the vertex points components array.int
Returns the number of components for a vertex point.int
Returns the number of vertex points in array.float[]
Returns the vertex texture coords array.Returns the texture to render on geometry surface.boolean
Returns whether color components array is set.boolean
Returns whether shape surfaces are double-sided.boolean
Returns whether index array is set.boolean
Returns whether texture coords array is set.boolean
Returns whether texture is set and loaded and text coords are set.void
Sets the global color if set.void
setDoubleSided
(boolean aValue) Sets whether shape surfaces are double-sided.void
setIndexArray
(int[] indexArray) Sets the index array, if points have special ordering.void
setLast
(VertexArray aVertexArray) Sets the last VertexArray, if part of a chain.void
setNext
(VertexArray aVertexArray) Sets the next VertexArray, if part of a chain.void
setPointArray
(float[] pointArray) Sets the vertex points components array.void
setTexCoordArray
(float[] texCoordArray) Sets the vertex texture coords array.void
setTexture
(Texture aTexture) Sets the texture to render on geometry surface.void
transformPoints
(Matrix3D aTrans) Transforms points by transform.void
trim()
Trims arrays.
-
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
Returns the Point3D at index. -
getPoint3D
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
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
Returns the global color. -
setColor
Sets the global color if set. -
getTexture
Returns the texture to render on geometry surface. -
setTexture
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
Returns the next VertexArray, if part of a chain. -
setNext
Sets the next VertexArray, if part of a chain. -
getLast
Returns the last VertexArray (just returns this if no more). -
setLast
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
Returns bounds. -
trim
public void trim()Trims arrays. -
transformPoints
Transforms points by transform. -
copyForTransform
Copies VertexArray for given transform. -
clone
Standard clone implementation.
-