Thanks for your answer.
So I'll have to make a translationand a rotation for each planet on each
animation step...
I'll try to do this.
To locate my planets coordinates, there's a difference beetween J3D and
Data coordinates.
Is there a existing method to convert visad Coords in J3d Coords?
Laurent BEIGBEDER
GFI Informatique
Toulouse - FRANCE
Bill Hibbard <billh@xxxxxxxxxxxxx> le 22/08/2005 18:33:27
Veuillez répondre à billh@xxxxxxxxxxxxx
Pour : Laurent BEIGBEDER <lbeigbed@xxxxxx>
cc : visad@xxxxxxxxxxxxxxxx
Objet : Re: Apply a Texture on a shape?
Hi Laurent,
Unfortunately there are no current DataRenderers that support
textures on Shapes. You might do this by constructing a Java3D
Geometry (i.e., a TriangleStripArray instead of a
VisADTriangleStripArray) with a texture and adding it directly
to the VisAD scene graph. To do this, use:
DisplayRendererJ3D dr
(DisplayRendererJ3D) display.getDisplayRenderer();
TransformGroup trans = dr.getTrans();
Then add your Geometry(s) to a BranchGroup, and add it to
trans. Your Geometry(s) must be added to trans via a
BranchGroup, since trans is "live".
This is a bit tricky, since VisAD won't know about or manage
your Geometry(s). Being under trans they will rotate and zoom
with the rest of your Data depictions, but you will need to
manage scaling them according to the getRange() values from
your ScalarMaps to XAxis, YAxis and ZAxis.
Because VisAD won't know about your Geometry(s), it won't do
anything to animate them. One approach would be to put your
own TransformGroup between your BranchGroup and your Geometries,
and calls its setTransform() method to rotate your planets.
Good luck,
Bill
On Mon, 22 Aug 2005, Laurent BEIGBEDER wrote:
>
> Hi!
>
> I use VisAD to display some orbit stuff. I display planets with sphere
> shapes using:
>
> VisADTriangleStripArray vitsa = new VisADTriangleStripArray();
>
> Sphere sphere = new Sphere(1.0f,Sphere.GENERATE_NORMALS,30);
> GeometryArray ga = (GeometryArray)sphere.getShape().getGeometry
();
>
> GeometryInfo gInf = new GeometryInfo(ga);
>
> float[] fcoords = new float[gInf.getCoordinates().length*3];
> for(int i=0;i<gInf.getCoordinates().length;i++){
> fcoords[3*i] = gInf.getCoordinates()[i].x;
> fcoords[3*i+1] = gInf.getCoordinates()[i].y;
> fcoords[3*i+2] = gInf.getCoordinates()[i].z;
> }
> vitsa.coordinates=fcoords;
>
> float[] fnormals = new float[gInf.getNormals().length*3];
> for(int i=0;i<gInf.getNormals().length;i++){
> fnormals[3*i] = gInf.getNormals()[i].x;
> fnormals[3*i+1] = gInf.getNormals()[i].y;
> fnormals[3*i+2] = gInf.getNormals()[i].z;
> }
>
> vitsa.vertexFormat=ga.getVertexFormat();
> vitsa.normals=fnormals;
> vitsa.stripVertexCounts=gInf.getStripCounts();
> vitsa.vertexCount = vitsa.coordinates.length / 3;
>
>
> I would like to add texture to shapes but I can't find what renderer or
> shadow type I have to modify.
>
> Has somebody allready done that or know how to do it?
>
>
> I'm wondering also if there's a better way to set a shape rotating during
> animation.
> Currently, I use something like tupleType (x,y,z,color,shape) with shapes
> number = values number.
>
> A preview of actual rendering:(See attached file: rosetta_now.png)
>
> Thanks!
>
> Laurent BEIGBEDER
> GFI Informatique
> Toulouse - FRANCE
>
>