Hi,

If I understand correctly the Mesh class contains all the info needed to create
the geometry.  You could do one of two things:

        1. Let the Mesh class implement GeometryUpdater.  The Mesh class then
needs to have the following method

               public void updateData(Geometry geometry)
               {
                    // update the data in the array
                }

            which updates the array data.  The Mesh class would also have the
following method

                public void updateMesh()
                {
                    geometryArray.updateData(this);
                }

            which you would call when your mesh needed to be updated.

        2. Inside the Mesh class create an inner class that implements
GeometryUpdater:

                class Updater implements GeometryUpdater
               {
                    public void updateData(Geometry geometry)
                    {
                        // update the data in the array
                    }
                }

            You then create an instance of this class in the Mesh class. The
updateMesh method in case 1 above
            will be changed as follows:

                public void updateMesh()
                {
                    geometryArray.updateData(updaterInstance);
                }

            This works because an inner class has access to the enclosing classes
variables - weights and transformIndices in your case.

Hope this helps
--Renoir


> [ Java3D API DOC ]
> Data in any array that is referenced by a live or compiled GeometryArray
> object may ONLY be modified via the updateData method (subject to the
> ALLOW_REF_DATA_WRITE capability bit). Applications must exercise care not to
> violate this rule. If any referenced geometry data is modified outside of the
> updateData method, the results are undefined.
> [/ Java3D API DOC ]
>
> one of my problems was that with the upadateDate(Geometry) method i only have
> access to the GeometryArray, but often i need more data for updating, in the
> follwing case weights and transformIndices for every vertex.  so i'VE done a
> quick code abstract, to which i have two questions:
> - is this code right, and save for future Java3D version and plattforms ?
> - is there a more efficient/flexible way to achive the same results ?
>
> the code goes here:
> ---------------------------------------
> ---------------------------------------
> public interface MeshUpdater extends javax.media.j3d.GeometryUpdater
> {
>   void updateData(Mesh mesh);
> }
> ---------------------------------------
> public class Mesh
> {
>   GeometryArray geometryArray;
>
>   float[][] weights;
>   int[][]     transformIndices;
>
>   public Mesh(){}
>
>   public void updateData(MeshUpdater meshUpdater)
>   {
>       meshUpdater.updateData(this);
>   }
>
>   //set and get methods:..
> }
> ---------------------------------------
> public class Skeleton implements MeshUpdater
> {
>    Transform3D[] transforms;
>
>   //mesh attributs needed for updating
>   float[][] weights;
>   int[][] transformIndices;
>
>   public Skeleton() {}
>
>   public void updateData(Geometry geometry)
>   {
>   //now i can use the weights und transformIndices for manipulart..
>   }
>
>  public void updateData(Mesh mesh)
>  {
>     weights = mesh.weights;
>     transformIndices = mesh.transformIndices;
>     mesh.geometryArray.updateData(this);
>  }
> }
> ---------------------------------------
> ---------------------------------------
>
> greetings
> Michael Nischt
> e-mail: [EMAIL PROTECTED]
>
> ===========================================================================
> 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".

--
Renoir Sewjee
Software Engineer
ISS International (Welkom)
Tel: +27 (0)57 912 2702
Fax: +27 (0)57 912 2652
--

===========================================================================
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