codeanticode.glgraphics
Class GLModel

java.lang.Object
  extended by codeanticode.glgraphics.GLModel
All Implemented Interfaces:
GLConstants, processing.core.PConstants

public class GLModel
extends java.lang.Object
implements processing.core.PConstants, GLConstants

This class holds a 3D model composed of vertices, normals, colors (per vertex) and texture coordinates (also per vertex). All this data is stored in Vertex Buffer Objects (VBO) for fast access. This is class is still undergoing development, the API will probably change quickly in the following months as features are tested and refined. In particular, with the settings of the VBOs in this first implementation (GL.GL_DYNAMIC_DRAW_ARB) it is assumed that the coordinates will change often during the lifetime of the model. For static models a different VBO setting (GL.GL_STATIC_DRAW_ARB) should be used.


Field Summary
 java.nio.FloatBuffer attributes
           
 java.nio.FloatBuffer colors
           
 float depth
           
static int DYNAMIC
           
 float height
           
 java.nio.IntBuffer indices
           
 java.nio.FloatBuffer normals
           
static int STATIC
           
static int STREAM
           
 java.nio.FloatBuffer texCoords
           
 GLTexture[] textures
           
 java.nio.FloatBuffer vertices
           
 float width
           
 float xmax
           
 float xmin
           
 float ymax
           
 float ymin
           
 float zmax
           
 float zmin
           
 
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BILINEAR, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLAMP, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_MASK, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_MASK, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, FIXED, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HAS_NORMAL, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINE_LOOP, LINE_STRIP, LINEAR, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MODELVIEW, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, OPENGL2, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINT_SPRITES, POINTS, POLYGON, POSTERIZE, PROBLEM, PROG_GL2, PROG_GL3, PROG_GL4, PROJECT, PROJECTION, QUAD, QUAD_STRIP, QUADRATIC, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPEAT, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, TEXTURE2D, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TRILINEAR, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
 
Fields inherited from interface codeanticode.glgraphics.GLConstants
BACKGROUND_ALPHA, CG_CONTEXT, CG_EFFECT, CG_PROGRAM, COLOR, DOUBLE, FLOAT, FRAGMENT_PROGRAM, GEOMETRY_PROGRAM, GL_DEPTH_STENCIL, GL_DEPTH24_STENCIL8, GL_FRAME_BUFFER, GL_PIXEL_BUFFER, GL_RENDER_BUFFER, GL_TEXTURE_OBJECT, GL_UNSIGNED_INT_24_8, GL_VERTEX_BUFFER, GLGRAPHICS, GLSL_PROGRAM, GLSL_SHADER, IDENTITY_MATRIX, INVERSE_MATRIX, INVERSE_TRANSPOSE_MATRIX, LINE_ADJACENCY, LINEAR_MIPMAP_LINEAR, LINEAR_MIPMAP_NEAREST, LINEAR_SAMPLING, NEAREST_MIPMAP_LINEAR, NEAREST_MIPMAP_NEAREST, NEAREST_SAMPLING, SHADER_VAR_ARRAY, SHADER_VAR_FLOAT, SHADER_VAR_INT, SHADER_VAR_MAT2, SHADER_VAR_MAT3, SHADER_VAR_MAT4, SHADER_VAR_MODELVIEW_MAT, SHADER_VAR_MODELVIEW_PROJECTION_MAT, SHADER_VAR_PROJECTION_MAT, SHADER_VAR_TEXTURE_MAT, SHADER_VAR_TEXTURE_SAMPLER, SHADER_VAR_VEC2, SHADER_VAR_VEC3, SHADER_VAR_VEC4, TEX_BYTE, TEX_INT, TEX_NORM, TEX_ONEDIM, TEX_RECT, TRANSPOSE_MATRIX, TRIANGLE_ADJACENCY, VERTEX_PROGRAM
 
Constructor Summary
GLModel(processing.core.PApplet parent, java.util.ArrayList<processing.core.PVector> vertArrayList, int mode, int usage)
           
GLModel(processing.core.PApplet parent, float[] vertArray, int mode, int usage)
           
GLModel(processing.core.PApplet parent, int numVert, int mode, int usage)
          Creates an instance of GLModel with the specified parameters: number of vertices, mode to draw the vertices (as points, sprites, lines, etc) and usage (static if the vertices will never change after the first time are initialized, dynamic if they will change frequently or stream if they will change at every frame).
GLModel(processing.core.PApplet parent, java.lang.String filename)
           
GLModel(processing.core.PApplet parent, java.net.URL url)
           
 
Method Summary
 void autoIndexBounds(boolean val)
          This method enables/disables the automatic calculation of index bounds (maximum and minimum).
 void beginUpdateAttributes(int n)
           
 void beginUpdateColors()
           
 void beginUpdateIndices()
          Prepares the indices for updating.
 void beginUpdateNormals()
           
 void beginUpdateTexCoords(int n)
           
 void beginUpdateVertices()
          Enables vertex updating, to be done with the updateVertex()/displaceVertex() methods.
 void centerVertices()
          Centers the model to (0, 0, 0).
 void centerVertices(float xc, float yc)
          Centers the model to (xc, yc, 0).
 void centerVertices(float xc, float yc, float zc)
          Centers the model to (xc, yc, zc).
 void delete()
           
 void displaceAttribute(int idx, float dx)
           
 void displaceAttribute(int idx, float[] dvalues)
           
 void displaceAttribute(int idx, float dx, float dy)
           
 void displaceAttribute(int idx, float x, float y, float z)
           
 void displaceAttribute(int idx, float x, float y, float z, float w)
           
 void displaceNormal(int idx, float dx, float dy)
           
 void displaceNormal(int idx, float dx, float dy, float dz)
           
 void displaceNormal(int idx, float dx, float dy, float dz, float dw)
           
 void displaceTexCoord(int idx, float ds, float dt)
           
 void displaceVertex(int idx, float dx, float dy)
          Adds a displacement (dx, dy) to the vertex idx.
 void displaceVertex(int idx, float dx, float dy, float dz)
          Adds a displacement (dx, dy, dz) to the vertex idx.
 void displaceVertex(int idx, float dx, float dy, float dz, float dw)
          Adds a displacement (dx, dy, dz, dw) to the vertex idx.
 void endUpdateAttributes()
           
 void endUpdateColors()
           
 void endUpdateIndices()
          Cleans-up index updating.
 void endUpdateNormals()
           
 void endUpdateTexCoords()
           
 void endUpdateVertices()
          Disables vertex updating.
 java.util.ArrayList<float[]> getAttributes(java.lang.String filename, int len)
          Returns array list with attributes stored in binary file.
 java.util.ArrayList<float[]> getColors(java.lang.String filename)
          Returns array list with colors stored in binary file.
 int getCoordsVBO()
          Returns the OpenGL identifier of the Vertex Buffer Object holding the coordinates of this model.
 java.lang.String getDescription()
           
 float getMaxPointSize()
           
 int getMode()
           
 java.util.ArrayList<processing.core.PVector> getNormals(java.lang.String filename)
          Returns array list with normals stored in binary file.
 int getNumTextures()
          Returns the number of textures.
 int getSize()
           
 java.util.ArrayList<processing.core.PVector> getTexCoords(java.lang.String filename)
          Returns array list with texture coordinates stored in binary file.
 GLTexture getTexture(int i)
          Returns the i-th texture.
 java.util.ArrayList<processing.core.PVector> getVertices(java.lang.String filename)
          Returns array list with vertices stored in binary file.
 void initAttributes(int n)
          Sets the number of attributes for this model.
 void initColors()
          This method creates the colors, i.e.: it creates the internal OpenGL variables to store color data.
 void initIndices(int n)
          This method initializes the index array in this GLModel, capable to hold up to n vertex indices.
 void initIndices(int n, int usage)
          This method initializes the index array in this GLModel, capable to hold up to n vertex indices.
 void initNormals()
          This method creates the normals, i.e.: it creates the internal OpenGL variables to store normal data.
 void initTextures(int n)
          This method creates n textures, i.e.: it creates the internal OpenGL variables to store n textures.
 void loadAttributes(int n, java.lang.String filename)
          Loads attribute nth from binary file into model.
 void loadColors(java.lang.String filename)
          Loads colors from binary file into model.
 void loadNormals(java.lang.String filename)
          Loads normals from binary file into model.
 void loadTexCoords(int n, java.lang.String filename)
          Loads texture coordinates of nth texture from binary file into model.
 void loadVertices(java.lang.String filename)
          Loads vertices from binary file into model.
 void noBlend()
          Disables blending.
 void noTint()
          Set the tint color to solid white.
 void render()
           
 void render(GLModelEffect effect)
           
 void render(int first, int last)
           
 void render(int first, int last, GLModelEffect effect)
           
 void saveAttributes(int n, java.lang.String filename)
          Saves attribute n-th in the model to binary file.
 void saveAttributes(java.lang.String filename, java.util.ArrayList<float[]> iattrib, int len)
          Saves attributes in the given array list to binary file.
 void saveColors(java.lang.String filename)
          Saves colors in the model to binary file.
 void saveColors(java.lang.String filename, java.util.ArrayList<float[]> icolors)
          Saves colors in the given array list to binary file.
 void saveNormals(java.lang.String filename)
          Saves normals in the model to binary file.
 void saveNormals(java.lang.String filename, java.util.ArrayList<processing.core.PVector> norms)
          Saves normals in the given array list to binary file.
 void saveTexCoords(int n, java.lang.String filename)
          Saves colors in the model to binary file.
 void saveTexCoords(java.lang.String filename, java.util.ArrayList<processing.core.PVector> itexCoords)
          Saves texture coordinates in the given array list to binary file.
 void saveVertices(java.lang.String filename)
          Saves vertices in the model to binary file.
 void saveVertices(java.lang.String filename, java.util.ArrayList<processing.core.PVector> verts)
          Saves vertices in the given array list to binary file.
 void setAttribute(int i, java.lang.String aname, int asize)
          Sets the name and size (number of components per vertex) of attribute i.
 void setBlendMode(int MODE)
          Enables blending and sets the mode.
 void setColors(float gray)
          Paints all vertices with the specified gray tone.
 void setColors(float gray, float alpha)
          Paints all vertices with the specified gray tone and alpha value.
 void setColors(float x, float y, float z)
          Paints all vertices with the specified color components.
 void setColors(float x, float y, float z, float a)
          Paints all vertices with the specified color components and alpha component.
 void setColors(int rgb, float alpha)
          Paints all vertices with the specified rgb color and alpha value.
 void setColors(int gray, int alpha)
          Paints all vertices with the specified gray tone and alpha value.
 void setColors(int x, int y, int z)
          Paints all vertices with the specified color components.
 void setColors(int x, int y, int z, int a)
          Paints all vertices with the specified color components and alpha component.
 void setEmission(float gray)
          Set the emissive color to the specified gray tone.
 void setEmission(float gray, float alpha)
          Set the emissive color to the specified gray tone and alpha value.
 void setEmission(float x, float y, float z)
          Set the emissive color to the specified color components.
 void setEmission(float x, float y, float z, float a)
          Set the emissive color to the specified color components and alpha component.
 void setEmission(int rgb, float alpha)
          Set the emissive color to the specified rgb color and alpha value.
 void setEmission(int gray, int alpha)
          Set the emissive color to the specified gray tone and alpha value.
 void setEmission(int x, int y, int z)
          Set the emissive color to the specified color components.
 void setEmission(int x, int y, int z, int a)
          Set the emissive color to the specified color components and alpha component.
 void setLineWidth(float w)
           
 void setMaxIndex(int max)
          Sets the maximum index value to use when rendering the model.
 void setMaxSpriteSize(float s)
          Sets the maximum sprite size (which is capped by the maximum point size).
 void setMinIndex(int min)
          Sets the minimum index value to use when rendering the model.
 void setPointSize(float s)
           
 void setReflection(float gray)
          Set the specular color to the specified gray tone.
 void setReflection(float gray, float alpha)
          Set the specular color to the specified gray tone and alpha value.
 void setReflection(float x, float y, float z)
          Set the specular color to the specified color components.
 void setReflection(float x, float y, float z, float a)
          Set the specular color to the specified color components and alpha component.
 void setReflection(int rgb, float alpha)
          Set the specular color to the specified rgb color and alpha value.
 void setReflection(int gray, int alpha)
          Set the specular color to the specified gray tone and alpha value.
 void setReflection(int x, int y, int z)
          Set the specular color to the specified color components.
 void setReflection(int x, int y, int z, int a)
          Set the specular color to the specified color components and alpha component.
 void setShininess(float val)
           
 void setSpriteSize(float s)
          Sets the sprite size to be constant and equal to s.
 void setSpriteSize(float s, float d)
          Sets the sprite distance attenuation function for sprites using quadratic dependence on the distance.
 void setSpriteSize(float s, float d, boolean quadratic)
          Sets the sprite distance attenuation function for sprites such that the sprite size at distance d from the camera is exactly s.
 void setTexture(int i, GLTexture tex)
          Sets the i-th texture.
 void setTint(float gray)
          Set the tint color to the specified gray tone.
 void setTint(float gray, float alpha)
          Set the tint color to the specified gray tone and alpha value.
 void setTint(float x, float y, float z)
          Set the tint color to the specified color components.
 void setTint(float x, float y, float z, float a)
          Set the tint color to the specified color components and alpha component.
 void setTint(int rgb, float alpha)
          Set the tint color to the specified rgb color and alpha value.
 void setTint(int gray, int alpha)
          Set the tint color to the specified gray tone and alpha value.
 void setTint(int x, int y, int z)
          Set the tint color to the specified color components.
 void setTint(int x, int y, int z, int a)
          Set the tint color to the specified color components and alpha component.
 void updateAttribute(int idx, float x)
           
 void updateAttribute(int idx, float[] values)
           
 void updateAttribute(int idx, float x, float y)
           
 void updateAttribute(int idx, float x, float y, float z)
           
 void updateAttribute(int idx, float x, float y, float z, float w)
           
 void updateAttributes(int n, java.util.ArrayList<float[]> vertAttribsArrayList)
           
 void updateAttributes(int n, float[] attributesArray)
           
 void updateBounds()
           
 void updateBounds(int[] indices, int len)
           
 void updateColor(int i, float gray)
          Paints the vertex i with the specified gray tone.
 void updateColor(int i, float gray, float alpha)
          Paints the vertex i with the specified gray tone and alpha value.
 void updateColor(int i, float x, float y, float z)
          Paints the vertex i with the specified color components.
 void updateColor(int i, float x, float y, float z, float a)
          Paints the vertex i with the specified color components and alpha component.
 void updateColor(int i, int rgb, float alpha)
          Paints the vertex i with the specified rgb color and alpha value.
 void updateColor(int i, int gray, int alpha)
          Paints the vertex i with the specified gray tone and alpha value.
 void updateColor(int i, int x, int y, int z)
          Paints the vertex i with the specified color components.
 void updateColor(int i, int x, int y, int z, int a)
          Paints the vertex i with the specified color components and alpha component.
 void updateColors(java.util.ArrayList<float[]> colArrayList)
           
 void updateColors(float[] colArray)
           
 void updateIndices(int[] indexArray)
          Updates the indices with all the values provided in the array.
 void updateIndices(int[] indexArray, int len)
          Updates the indices with the values provided in the array, up to the element len-1.
 void updateNormal(int idx, float x, float y)
           
 void updateNormal(int idx, float x, float y, float z)
           
 void updateNormal(int idx, float x, float y, float z, float w)
           
 void updateNormals(java.util.ArrayList<processing.core.PVector> normArrayList)
           
 void updateNormals(float[] normArray)
           
 void updateTexCoord(int idx, float s, float t)
           
 void updateTexCoords(int n, java.util.ArrayList<processing.core.PVector> texCoordsArrayList)
           
 void updateTexCoords(int n, float[] texCoordsArray)
           
 void updateVertex(int idx, float x, float y)
          Updates the coordinates of vertex idx.
 void updateVertex(int idx, float x, float y, float z)
          Updates the coordinates of vertex idx.
 void updateVertex(int idx, float x, float y, float z, float w)
          Updates the coordinates of vertex idx.
 void updateVertices(java.util.ArrayList<processing.core.PVector> vertArrayList)
          Updates all the vertices using the coordinates provided in the array vertArray.
 void updateVertices(float[] vertArray)
          Updates all the vertices using the coordinates provided in the array vertArray.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

textures

public GLTexture[] textures

vertices

public java.nio.FloatBuffer vertices

colors

public java.nio.FloatBuffer colors

normals

public java.nio.FloatBuffer normals

texCoords

public java.nio.FloatBuffer texCoords

attributes

public java.nio.FloatBuffer attributes

indices

public java.nio.IntBuffer indices

width

public float width

height

public float height

depth

public float depth

xmin

public float xmin

xmax

public float xmax

ymin

public float ymin

ymax

public float ymax

zmin

public float zmin

zmax

public float zmax

STATIC

public static final int STATIC
See Also:
Constant Field Values

DYNAMIC

public static final int DYNAMIC
See Also:
Constant Field Values

STREAM

public static final int STREAM
See Also:
Constant Field Values
Constructor Detail

GLModel

public GLModel(processing.core.PApplet parent,
               int numVert,
               int mode,
               int usage)
Creates an instance of GLModel with the specified parameters: number of vertices, mode to draw the vertices (as points, sprites, lines, etc) and usage (static if the vertices will never change after the first time are initialized, dynamic if they will change frequently or stream if they will change at every frame).

Parameters:
parent - PApplet
numVert - int
mode - int
usage - int

GLModel

public GLModel(processing.core.PApplet parent,
               float[] vertArray,
               int mode,
               int usage)

GLModel

public GLModel(processing.core.PApplet parent,
               java.util.ArrayList<processing.core.PVector> vertArrayList,
               int mode,
               int usage)

GLModel

public GLModel(processing.core.PApplet parent,
               java.lang.String filename)

GLModel

public GLModel(processing.core.PApplet parent,
               java.net.URL url)
Method Detail

delete

public void delete()

getMode

public int getMode()

getSize

public int getSize()

getDescription

public java.lang.String getDescription()

getCoordsVBO

public int getCoordsVBO()
Returns the OpenGL identifier of the Vertex Buffer Object holding the coordinates of this model.

Returns:
int

initNormals

public void initNormals()
This method creates the normals, i.e.: it creates the internal OpenGL variables to store normal data.


initColors

public void initColors()
This method creates the colors, i.e.: it creates the internal OpenGL variables to store color data.


initAttributes

public void initAttributes(int n)
Sets the number of attributes for this model. An attribute is a vector value associated to each vertex of the model, and can be used for any custom calculation (lighting, deformations, etc). This custom calculations can be performed using a GLModelEffect.

Parameters:
n - int

setAttribute

public void setAttribute(int i,
                         java.lang.String aname,
                         int asize)
Sets the name and size (number of components per vertex) of attribute i.

Parameters:
i - int
aname - String
asize - int

initTextures

public void initTextures(int n)
This method creates n textures, i.e.: it creates the internal OpenGL variables to store n textures.

Parameters:
n - int

initIndices

public void initIndices(int n)
This method initializes the index array in this GLModel, capable to hold up to n vertex indices. The mode of the indices is STATIC, meaning that they are optimized under the assumption that won't be modified.

Parameters:
n - int

initIndices

public void initIndices(int n,
                        int usage)
This method initializes the index array in this GLModel, capable to hold up to n vertex indices. The usage mode of the array can also be indicated, different from the usage of the model geometry itself.

Parameters:
n - maximum size of index array
usage - could be STATIC, DYNAMIC, or STREAM

autoIndexBounds

public void autoIndexBounds(boolean val)
This method enables/disables the automatic calculation of index bounds (maximum and minimum).

Parameters:
val - true or false

beginUpdateIndices

public void beginUpdateIndices()
Prepares the indices for updating.


endUpdateIndices

public void endUpdateIndices()
Cleans-up index updating.


updateIndices

public void updateIndices(int[] indexArray)
Updates the indices with all the values provided in the array.

Parameters:
indexArray - array with new indices

updateIndices

public void updateIndices(int[] indexArray,
                          int len)
Updates the indices with the values provided in the array, up to the element len-1.

Parameters:
indexArray - array with new indices
len - number of values to read from intexArray, starting at zero.

setMinIndex

public void setMinIndex(int min)
Sets the minimum index value to use when rendering the model.

Parameters:
min - minimum index

setMaxIndex

public void setMaxIndex(int max)
Sets the maximum index value to use when rendering the model.

Parameters:
max - maximum index

setTexture

public void setTexture(int i,
                       GLTexture tex)
Sets the i-th texture.

Parameters:
i - int

getNumTextures

public int getNumTextures()
Returns the number of textures.

Returns:
int

getTexture

public GLTexture getTexture(int i)
Returns the i-th texture.

Returns:
GLTexture

beginUpdateVertices

public void beginUpdateVertices()
Enables vertex updating, to be done with the updateVertex()/displaceVertex() methods.


endUpdateVertices

public void endUpdateVertices()
Disables vertex updating.


getVertices

public java.util.ArrayList<processing.core.PVector> getVertices(java.lang.String filename)
Returns array list with vertices stored in binary file.

Parameters:
String - filename
Returns:
ArrayList

saveVertices

public void saveVertices(java.lang.String filename,
                         java.util.ArrayList<processing.core.PVector> verts)
Saves vertices in the given array list to binary file.

Parameters:
String - filename
ArrayList - verts

loadVertices

public void loadVertices(java.lang.String filename)
Loads vertices from binary file into model.

Parameters:
String - filename

saveVertices

public void saveVertices(java.lang.String filename)
Saves vertices in the model to binary file.


updateVertex

public void updateVertex(int idx,
                         float x,
                         float y)
Updates the coordinates of vertex idx.

Parameters:
idx - int
x - float
y - float

updateVertex

public void updateVertex(int idx,
                         float x,
                         float y,
                         float z)
Updates the coordinates of vertex idx.

Parameters:
idx - int
x - float
y - float
z - float

updateVertex

public void updateVertex(int idx,
                         float x,
                         float y,
                         float z,
                         float w)
Updates the coordinates of vertex idx.

Parameters:
idx - int
x - float
y - float
z - float
w - float

displaceVertex

public void displaceVertex(int idx,
                           float dx,
                           float dy)
Adds a displacement (dx, dy) to the vertex idx.

Parameters:
idx - int
dx - float
dy - float

displaceVertex

public void displaceVertex(int idx,
                           float dx,
                           float dy,
                           float dz)
Adds a displacement (dx, dy, dz) to the vertex idx.

Parameters:
idx - int
dx - float
dy - float
dz - float

displaceVertex

public void displaceVertex(int idx,
                           float dx,
                           float dy,
                           float dz,
                           float dw)
Adds a displacement (dx, dy, dz, dw) to the vertex idx.

Parameters:
idx - int
dx - float
dy - float
dz - float
dw - float

updateVertices

public void updateVertices(float[] vertArray)
Updates all the vertices using the coordinates provided in the array vertArray.

Parameters:
vertArray - float[]

updateVertices

public void updateVertices(java.util.ArrayList<processing.core.PVector> vertArrayList)
Updates all the vertices using the coordinates provided in the array vertArray.

Parameters:
vertArrayList - ArrayList

centerVertices

public void centerVertices()
Centers the model to (0, 0, 0).


centerVertices

public void centerVertices(float xc,
                           float yc)
Centers the model to (xc, yc, 0).

Parameters:
xc - float
yc - float

centerVertices

public void centerVertices(float xc,
                           float yc,
                           float zc)
Centers the model to (xc, yc, zc).

Parameters:
xc - float
yc - float
zc - float

updateBounds

public void updateBounds()

updateBounds

public void updateBounds(int[] indices,
                         int len)

beginUpdateColors

public void beginUpdateColors()

endUpdateColors

public void endUpdateColors()

getColors

public java.util.ArrayList<float[]> getColors(java.lang.String filename)
Returns array list with colors stored in binary file.

Parameters:
String - filename
Returns:
ArrayList

saveColors

public void saveColors(java.lang.String filename,
                       java.util.ArrayList<float[]> icolors)
Saves colors in the given array list to binary file.

Parameters:
String - filename
ArrayList - icolors

loadColors

public void loadColors(java.lang.String filename)
Loads colors from binary file into model.

Parameters:
String - filename

saveColors

public void saveColors(java.lang.String filename)
Saves colors in the model to binary file.


updateColor

public void updateColor(int i,
                        float gray)
Paints the vertex i with the specified gray tone.

Parameters:
gray - float

updateColor

public void updateColor(int i,
                        int gray,
                        int alpha)
Paints the vertex i with the specified gray tone and alpha value.

Parameters:
gray - int
alpha - int

updateColor

public void updateColor(int i,
                        int rgb,
                        float alpha)
Paints the vertex i with the specified rgb color and alpha value.

Parameters:
rgb - int
alpha - float

updateColor

public void updateColor(int i,
                        float gray,
                        float alpha)
Paints the vertex i with the specified gray tone and alpha value.

Parameters:
gray - float
alpha - float

updateColor

public void updateColor(int i,
                        int x,
                        int y,
                        int z)
Paints the vertex i with the specified color components.

Parameters:
x - int
y - int
z - int

updateColor

public void updateColor(int i,
                        float x,
                        float y,
                        float z)
Paints the vertex i with the specified color components.

Parameters:
x - float
y - float
z - float

updateColor

public void updateColor(int i,
                        int x,
                        int y,
                        int z,
                        int a)
Paints the vertex i with the specified color components and alpha component.

Parameters:
x - int
y - int
z - int
a - int

updateColor

public void updateColor(int i,
                        float x,
                        float y,
                        float z,
                        float a)
Paints the vertex i with the specified color components and alpha component.

Parameters:
x - float
y - float
z - float
a - float

setColors

public void setColors(float gray)
Paints all vertices with the specified gray tone.

Parameters:
gray - float

setColors

public void setColors(int gray,
                      int alpha)
Paints all vertices with the specified gray tone and alpha value.

Parameters:
gray - int
alpha - int

setColors

public void setColors(int rgb,
                      float alpha)
Paints all vertices with the specified rgb color and alpha value.

Parameters:
rgb - int
alpha - float

setColors

public void setColors(float gray,
                      float alpha)
Paints all vertices with the specified gray tone and alpha value.

Parameters:
gray - float
alpha - float

setColors

public void setColors(int x,
                      int y,
                      int z)
Paints all vertices with the specified color components.

Parameters:
x - int
y - int
z - int

setColors

public void setColors(float x,
                      float y,
                      float z)
Paints all vertices with the specified color components.

Parameters:
x - float
y - float
z - float

setColors

public void setColors(int x,
                      int y,
                      int z,
                      int a)
Paints all vertices with the specified color components and alpha component.

Parameters:
x - int
y - int
z - int
a - int

setColors

public void setColors(float x,
                      float y,
                      float z,
                      float a)
Paints all vertices with the specified color components and alpha component.

Parameters:
x - float
y - float
z - float
a - float

updateColors

public void updateColors(float[] colArray)

updateColors

public void updateColors(java.util.ArrayList<float[]> colArrayList)

beginUpdateTexCoords

public void beginUpdateTexCoords(int n)

updateTexCoord

public void updateTexCoord(int idx,
                           float s,
                           float t)

getTexCoords

public java.util.ArrayList<processing.core.PVector> getTexCoords(java.lang.String filename)
Returns array list with texture coordinates stored in binary file.

Parameters:
String - filename
Returns:
ArrayList

saveTexCoords

public void saveTexCoords(java.lang.String filename,
                          java.util.ArrayList<processing.core.PVector> itexCoords)
Saves texture coordinates in the given array list to binary file.

Parameters:
String - filename
ArrayList - icolors

loadTexCoords

public void loadTexCoords(int n,
                          java.lang.String filename)
Loads texture coordinates of nth texture from binary file into model.

Parameters:
n -
String - filename

saveTexCoords

public void saveTexCoords(int n,
                          java.lang.String filename)
Saves colors in the model to binary file.


displaceTexCoord

public void displaceTexCoord(int idx,
                             float ds,
                             float dt)

endUpdateTexCoords

public void endUpdateTexCoords()

updateTexCoords

public void updateTexCoords(int n,
                            float[] texCoordsArray)

updateTexCoords

public void updateTexCoords(int n,
                            java.util.ArrayList<processing.core.PVector> texCoordsArrayList)

beginUpdateNormals

public void beginUpdateNormals()

endUpdateNormals

public void endUpdateNormals()

getNormals

public java.util.ArrayList<processing.core.PVector> getNormals(java.lang.String filename)
Returns array list with normals stored in binary file.

Parameters:
String - filename
Returns:
ArrayList

saveNormals

public void saveNormals(java.lang.String filename,
                        java.util.ArrayList<processing.core.PVector> norms)
Saves normals in the given array list to binary file.

Parameters:
String - filename
ArrayList - verts

loadNormals

public void loadNormals(java.lang.String filename)
Loads normals from binary file into model.

Parameters:
String - filename

saveNormals

public void saveNormals(java.lang.String filename)
Saves normals in the model to binary file.


updateNormal

public void updateNormal(int idx,
                         float x,
                         float y)

updateNormal

public void updateNormal(int idx,
                         float x,
                         float y,
                         float z)

updateNormal

public void updateNormal(int idx,
                         float x,
                         float y,
                         float z,
                         float w)

displaceNormal

public void displaceNormal(int idx,
                           float dx,
                           float dy)

displaceNormal

public void displaceNormal(int idx,
                           float dx,
                           float dy,
                           float dz)

displaceNormal

public void displaceNormal(int idx,
                           float dx,
                           float dy,
                           float dz,
                           float dw)

updateNormals

public void updateNormals(float[] normArray)

updateNormals

public void updateNormals(java.util.ArrayList<processing.core.PVector> normArrayList)

beginUpdateAttributes

public void beginUpdateAttributes(int n)

endUpdateAttributes

public void endUpdateAttributes()

getAttributes

public java.util.ArrayList<float[]> getAttributes(java.lang.String filename,
                                                  int len)
Returns array list with attributes stored in binary file. Each attribute has size len.

Parameters:
String - filename
Returns:
int len

saveAttributes

public void saveAttributes(java.lang.String filename,
                           java.util.ArrayList<float[]> iattrib,
                           int len)
Saves attributes in the given array list to binary file. Each attribute has size len.

Parameters:
String - filename
ArrayList - iattrib

loadAttributes

public void loadAttributes(int n,
                           java.lang.String filename)
Loads attribute nth from binary file into model.

Parameters:
String - filename

saveAttributes

public void saveAttributes(int n,
                           java.lang.String filename)
Saves attribute n-th in the model to binary file.


updateAttribute

public void updateAttribute(int idx,
                            float x)

updateAttribute

public void updateAttribute(int idx,
                            float x,
                            float y)

updateAttribute

public void updateAttribute(int idx,
                            float x,
                            float y,
                            float z)

updateAttribute

public void updateAttribute(int idx,
                            float x,
                            float y,
                            float z,
                            float w)

updateAttribute

public void updateAttribute(int idx,
                            float[] values)

displaceAttribute

public void displaceAttribute(int idx,
                              float dx)

displaceAttribute

public void displaceAttribute(int idx,
                              float dx,
                              float dy)

displaceAttribute

public void displaceAttribute(int idx,
                              float x,
                              float y,
                              float z)

displaceAttribute

public void displaceAttribute(int idx,
                              float x,
                              float y,
                              float z,
                              float w)

displaceAttribute

public void displaceAttribute(int idx,
                              float[] dvalues)

updateAttributes

public void updateAttributes(int n,
                             float[] attributesArray)

updateAttributes

public void updateAttributes(int n,
                             java.util.ArrayList<float[]> vertAttribsArrayList)

setLineWidth

public void setLineWidth(float w)

setPointSize

public void setPointSize(float s)

getMaxPointSize

public float getMaxPointSize()

setMaxSpriteSize

public void setMaxSpriteSize(float s)
Sets the maximum sprite size (which is capped by the maximum point size).


setSpriteSize

public void setSpriteSize(float s)
Sets the sprite size to be constant and equal to s.


setSpriteSize

public void setSpriteSize(float s,
                          float d)
Sets the sprite distance attenuation function for sprites using quadratic dependence on the distance.


setSpriteSize

public void setSpriteSize(float s,
                          float d,
                          boolean quadratic)
Sets the sprite distance attenuation function for sprites such that the sprite size at distance d from the camera is exactly s. The dependence on the distance is quadratic (smax/(1+d^2)) or linear (smax/(1+d)) depending on the value of the argument quadratic. smax is the maximum sprite size.


noBlend

public void noBlend()
Disables blending.


setBlendMode

public void setBlendMode(int MODE)
Enables blending and sets the mode.

Parameters:
MODE - int

setTint

public void setTint(float gray)
Set the tint color to the specified gray tone.

Parameters:
gray - float

setTint

public void setTint(int gray,
                    int alpha)
Set the tint color to the specified gray tone and alpha value.

Parameters:
gray - int
alpha - int

setTint

public void setTint(int rgb,
                    float alpha)
Set the tint color to the specified rgb color and alpha value.

Parameters:
rgb - int
alpha - float

setTint

public void setTint(float gray,
                    float alpha)
Set the tint color to the specified gray tone and alpha value.

Parameters:
gray - float
alpha - float

setTint

public void setTint(int x,
                    int y,
                    int z)
Set the tint color to the specified color components.

Parameters:
x - int
y - int
z - int

setTint

public void setTint(float x,
                    float y,
                    float z)
Set the tint color to the specified color components.

Parameters:
x - float
y - float
z - float

setTint

public void setTint(int x,
                    int y,
                    int z,
                    int a)
Set the tint color to the specified color components and alpha component.

Parameters:
x - int
y - int
z - int
a - int

setTint

public void setTint(float x,
                    float y,
                    float z,
                    float a)
Set the tint color to the specified color components and alpha component.

Parameters:
x - float
y - float
z - float
a - float

noTint

public void noTint()
Set the tint color to solid white.


setReflection

public void setReflection(float gray)
Set the specular color to the specified gray tone.

Parameters:
gray - float

setReflection

public void setReflection(int gray,
                          int alpha)
Set the specular color to the specified gray tone and alpha value.

Parameters:
gray - int
alpha - int

setReflection

public void setReflection(int rgb,
                          float alpha)
Set the specular color to the specified rgb color and alpha value.

Parameters:
rgb - int
alpha - float

setReflection

public void setReflection(float gray,
                          float alpha)
Set the specular color to the specified gray tone and alpha value.

Parameters:
gray - float
alpha - float

setReflection

public void setReflection(int x,
                          int y,
                          int z)
Set the specular color to the specified color components.

Parameters:
x - int
y - int
z - int

setReflection

public void setReflection(float x,
                          float y,
                          float z)
Set the specular color to the specified color components.

Parameters:
x - float
y - float
z - float

setReflection

public void setReflection(int x,
                          int y,
                          int z,
                          int a)
Set the specular color to the specified color components and alpha component.

Parameters:
x - int
y - int
z - int
a - int

setReflection

public void setReflection(float x,
                          float y,
                          float z,
                          float a)
Set the specular color to the specified color components and alpha component.

Parameters:
x - float
y - float
z - float
a - float

setEmission

public void setEmission(float gray)
Set the emissive color to the specified gray tone.

Parameters:
gray - float

setEmission

public void setEmission(int gray,
                        int alpha)
Set the emissive color to the specified gray tone and alpha value.

Parameters:
gray - int
alpha - int

setEmission

public void setEmission(int rgb,
                        float alpha)
Set the emissive color to the specified rgb color and alpha value.

Parameters:
rgb - int
alpha - float

setEmission

public void setEmission(float gray,
                        float alpha)
Set the emissive color to the specified gray tone and alpha value.

Parameters:
gray - float
alpha - float

setEmission

public void setEmission(int x,
                        int y,
                        int z)
Set the emissive color to the specified color components.

Parameters:
x - int
y - int
z - int

setEmission

public void setEmission(float x,
                        float y,
                        float z)
Set the emissive color to the specified color components.

Parameters:
x - float
y - float
z - float

setEmission

public void setEmission(int x,
                        int y,
                        int z,
                        int a)
Set the emissive color to the specified color components and alpha component.

Parameters:
x - int
y - int
z - int
a - int

setEmission

public void setEmission(float x,
                        float y,
                        float z,
                        float a)
Set the emissive color to the specified color components and alpha component.

Parameters:
x - float
y - float
z - float
a - float

setShininess

public void setShininess(float val)

render

public void render()

render

public void render(GLModelEffect effect)

render

public void render(int first,
                   int last)

render

public void render(int first,
                   int last,
                   GLModelEffect effect)


processing library GLGraphics by Andres Colubri. (c) 2008-2011