Java3D VertexUpdater

hi all,

you probably all know the Java3D GeometryUpdater for modifying GeometryArrays at runtime. Being sick of writng simple updaters twice for the diffrent subclasses of GeometryArray and its vertexFormats, I wrote one to handle all ( http://games-net.de/files/zero_java3d_gvu.zip ):


class GeometryVertexUpdater implements GeometryUpdater {

    public VertexUpdater getVertexUpdater();
    
    public void setVertexUpdater(VertexUpdater vertexUpdater):

    public void updateData(Geometry geometry);

}

loops through all vertices and calls the implented method of:


public interface VertexUpdater {
    
    public void updateVertex(int index, Vertex vertex);
    
}

in this method you can modify the data of the Vertex:


public class Vertex {
    public final static int COORDINATE;
    public final static int NORMAL;
    public final static int COLOR_3;
    public final static int COLOR_4;
    public final static int TEXTURE_COORDINATE_2;
    public final static int TEXTURE_COORDINATE_3;
    public final static int TEXTURE_COORDINATE_4;
    
    
    public Vertex(int vertexFormat);

    public Vertex(int vertexFormat, int texCoordSetCount);
    
    public int getVertexFormat();
    
    public int getTexCoordSetCount();
    
    public float[] getCoordinate();
    
    public float[] getNormal();
    
    public float[] getColor();
    
    public float[] getTextureCoordinate(int texCoordSet);

}

Note:
be sure to have set the Capabilities ALLOW_COUNT_READ, ALLOW_FORMAT_READ and READ/WRITE ones for the vertexFormat.

of course the isn’t a performant as writing and updater only for a special type of Geometry, but hey you can use it only as a algorithm tester, …

I would be happy receiving feedback, improvement ideas, or about my mistakes (hacked it today, no time for testing ;))