j3d.org Code

org.j3d.terrain
Interface TextureTileGenerator


public interface TextureTileGenerator

Generator for supplying instances of texture objects as tiles for large-scale terrains.

The implementation of this interface is free to source the texture tiles however it wishes. The tiles may be sourced from one huge image (for example, using JAI) or it may be from multiple image files, stitched together on demand. So long as the generator is able to tell the caller the total size of the texture(s) in pixels, then the generator will get the correct dimensions for each tile.

Note that ideally the image size should be a power of two or exactly divisible by the number of grid cells in the terrain data to give power of two textures. The caller does not make any checks on the texture object returned or on the bounds values passed in on the request. It is up to the implementor to check and rescale the tile image to be the appropriate size before handing the tile back to the caller.

Version:
$Revision: 1.3 $
Author:
Justin Couch

Method Summary
 java.awt.Dimension getTextureSize()
          Get the total size of the underlying image in pixels.
 java.awt.image.BufferedImage getTextureTile(java.awt.Rectangle bounds)
          Fetch the texture tile for the given bounds, expresed in image pixel coordinates.
 

Method Detail

getTextureSize

java.awt.Dimension getTextureSize()
Get the total size of the underlying image in pixels. This should provide valid values (positive, non-zero) all the time as this is used as part of a conversion process so that correct image coordinates are passed when requested.


getTextureTile

java.awt.image.BufferedImage getTextureTile(java.awt.Rectangle bounds)
Fetch the texture tile for the given bounds, expresed in image pixel coordinates. The bounds are always guaranteed to be valid values and within the bounds expressed by the getTextureSize() method.

Parameters:
bounds - The bounds of the texture tile to supply
Returns:
The image to use for the texture corresponding to that bounds

j3d.org Code

Latest Info from http://code.j3d.org/
Copyright © 2001 - j3d.org