NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
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 > >
visad
archives: