about updateData

I have method UpdateMyData, where I use external data from another class for updating geom[i]. I call it from another class. But the result is bad - only one surface updates. What is wrong from your point of view?

For clearness:

So, I call method:


...
for(int s =0; s<ldr.listOfSurfaces.size();s++) sh3d.UpdateMyData(s, ldr.getCoordsFace(), ldr.getCoordsFaceXYZ());
view.renderOnce();
...

The body of method is:


public void UpdateMyData(int getSurface, int[] getCoordsFace,int[][][] faces) {

System.out.println("Updating data...");

final int TMPsurff/*getSurface*/ = getSurface;
final int[] TMPgetCoordsFace = getCoordsFace;
final int[][][]TMPfaces = faces;

geom[TMPsurff].updateData(new GeometryUpdater() {

public void updateData(Geometry geometry) {

System.out.println("Surff is: " + TMPsurff+" ");

//проходим через все фейсы
for(int ff = 0; ff<(TMPgetCoordsFace[TMPsurff]); ff++){

//point
geom[TMPsurff].setCoordinate((ff*3)+2,
new Point3f(
((float[])(((ArrayList)listOfSurff.get(TMPsurff)).get(TMPfaces[TMPsurff][ff][0])))[0],
((float[])(((ArrayList)listOfSurff.get(TMPsurff)).get(TMPfaces[TMPsurff][ff][0])))[1],
((float[])(((ArrayList)listOfSurff.get(TMPsurff)).get(TMPfaces[TMPsurff][ff][0])))[2]));

geom[TMPsurff].setCoordinate((ff*3)+1,
new Point3f(
((float[])(((ArrayList)listOfSurff.get(TMPsurff)).get(TMPfaces[TMPsurff][ff][1])))[0],
((float[])(((ArrayList)listOfSurff.get(TMPsurff)).get(TMPfaces[TMPsurff][ff][1])))[1],
((float[])(((ArrayList)listOfSurff.get(TMPsurff)).get(TMPfaces[TMPsurff][ff][1])))[2]));

geom[TMPsurff].setCoordinate((ff*3)+0,
new Point3f(
((float[])(((ArrayList)listOfSurff.get(TMPsurff)).get(TMPfaces[TMPsurff][ff][2])))[0],
((float[])(((ArrayList)listOfSurff.get(TMPsurff)).get(TMPfaces[TMPsurff][ff][2])))[1],
((float[])(((ArrayList)listOfSurff.get(TMPsurff)).get(TMPfaces[TMPsurff][ff][2])))[2]));

}

}
});

}


public void updateData(Geometry geometry) {

// only for:The type shape3dcreator must implement the inherited abstract method GeometryUpdater.updateData(Geometry)

}

Im not sure about how the update should/could be made but have you tried the GeomDataInterface for setting the floats in the geometry.
If you check this http://xith.org/tutes/GettingStarted/html/more_fun_with_textures.html tutorial you see how its done in that way.
Its updating textureCoordinates, but im sure it works for all geometry data, at least all that i have tried ( coordinates, colors ).

So i geuss that instead of doing this
`
//point
geom[TMPsurff].setCoordinate((ff*3)+2,
new Point3f(
((float[])(((ArrayList)listOfSurff.get(TMPsurff)).get(TMPfaces[TMPsurff][ff][0])))[0],
((float[])(((ArrayList)listOfSurff.get(TMPsurff)).get(TMPfaces[TMPsurff][ff][0])))[1],
((float[])(((ArrayList)listOfSurff.get(TMPsurff)).get(TMPfaces[TMPsurff][ff][0])))[2]));

geom[TMPsurff].setCoordinate((ff*3)+1,…

geom[TMPsurff].setCoordinate((ff3)+0,…

you could try doing this
//point
GeomDataInterface coords = ((GeometryArray)geom[TMPsurff]).getCoordinateData(0);
coords.setFloats((ff
3)+6,
((float[])(((ArrayList)listOfSurff.get(TMPsurff)).get(TMPfaces[TMPsurff][ff][0])))[0],
((float[])(((ArrayList)listOfSurff.get(TMPsurff)).get(TMPfaces[TMPsurff][ff][0])))[1],
((float[])(((ArrayList)listOfSurff.get(TMPsurff)).get(TMPfaces[TMPsurff][ff][0])))[2]);

coords.setFloats((ff*3)+3,…

coords.setFloats((ff*3)+0,…

`

Hope it works :slight_smile:

It disfigures geometry. :frowning:

I will try to look at Xith docs closely. But the main problem is: it updates ONLY the last geom, that was loaded thought I pass all geoms.