> I am interested in using the Java 3D API to produce map application.
> Ideally it would look very much like an atlas style standard map of the
> world, a two dimensional picture using colour to show the height at a point.
> These heights are to be specified by some function of x and y which I would
> know. I would like then to be able to use the API's functions to do things
> like light the map nicely, rotate it and all other sorts of things.
Hi Nik,
Are you sure you need the full power of the 3D API?
If your lighting and rotation effects can be achieved with a
2D filter or a 2D rotation, you may only need Java 2 (aka JDK 1.2).
For instance, see the WeatherLabs applet at:
http://java.sun.com/features/1998/07/weatherlabs.html
I believe they used Java2D image processing API, which is
included in Java 2, but even that may be more than what you need.
(And I doubt if their source code is available.)
If your app is only 2D, the first thing you will need to
do is fill an image with pixel data. See the documentation for
java.awt.image.MemoryImageSource for how to do this:
http://java.sun.com/products/jdk/1.2/docs/api/
java/awt/image/MemoryImageSource.html
Then, the java.awt.image.*Filter classes could be used to brighten,
darken, gray out, or map one color into another. You can also use
image transparency to overlay multiple images (see the Java AWT Reference
on this one). Image rotation can be accomplished using
java.awt.Graphics2D.rotate().
If your app needs the full power of Java3D, you will need to apply
texture mapping onto some primitive objects. I believe there is
a Texture Mapping demo bundled with Java3D.
I haven't messed with 3D texture mapping, but I would think the classes
to look at are javax.media.j3d.Texture, javax.media.j3d.ImageComponent,
and java.awt.image.BufferedImage. Filling the BufferedImage with
pixel data should be very similar to the process described in
MemoryImageSource, except that a few more "wrapper" classes are
involved, such as Raster and DataBuffer. Then all you need to do
is slap the texture onto some object in the scene graph
using javax.media.j3d.Appearance.setTexture().
Others on this list, please correct me if I'm wrong.
If the texture mapping demo is unclear, see any of the online tutorials
for details on how to set appearances.
-----
Craig Henderson
Graduate Student, MIT
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/