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://zero.monoid.net/public/j3d/VertexUpdater.zip ):


 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 )


 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);

 }

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to