j3d.org Code

org.j3d.terrain
Interface FreeFormTerrainData

All Superinterfaces:
HeightDataSource, TerrainData
All Known Implementing Classes:
AbstractFreeFormTerrainData

public interface FreeFormTerrainData
extends TerrainData

A source of terrain data that has no fixed requirements for its access.

The source data provided by this dataset is assumed to contain a large amount of some form of memory-managed data. The nanagement routines do not really care about how the terrain is accessed. However, the implementation can expect some form of locality of reference access to the data. Terrain rendering algorithms don't randomly access the data, so it is safe to assume that at least some form of caching can be done and expect near neighbouts to be probably accessed very shortly.

Textures are assumed to be tiled, but that is really up to the implementation. If the implementation does not tile the textures then for each call to getTexture() just return the same instance each time. Also, make sure that the texture coordinates returned from the various getCoordinateX() methods are all coorect for the type of texture you are using.

TerrainData.getSourceDataType() always returns TerrainData.FREEFORM_DATA.

Version:
$Revision: 1.2 $
Author:
Justin Couch

Field Summary
 
Fields inherited from interface org.j3d.terrain.TerrainData
FREEFORM_DATA, STATIC_DATA, TILED_DATA
 
Method Summary
 int getGridDepth()
          Get the total depth (number of points on the X axis) of the grid.
 int getGridWidth()
          Get the total width (number of points on the Y axis) of the grid.
 java.awt.image.BufferedImage getTexture(java.awt.Rectangle bounds)
          Fetch the texture or part of a texture that can be applied to the sub-region of the overall object.
 
Methods inherited from interface org.j3d.terrain.TerrainData
getCoordinate, getCoordinate, getCoordinateWithColor, getCoordinateWithTexture, getGridXStep, getGridYStep, getHeightFromGrid, getSourceDataType, hasColor, hasTexture
 
Methods inherited from interface org.j3d.ui.navigation.HeightDataSource
getHeight
 

Method Detail

getTexture

java.awt.image.BufferedImage getTexture(java.awt.Rectangle bounds)
Fetch the texture or part of a texture that can be applied to the sub-region of the overall object. This is to allow for texture tiling of very large texture images or terrain items. If there is no texture or no texture for that region, then this should return null.

If the texture object only covers parts of the bounds, that is fine. Just return the full object and make sure the texture coordinates and texture attributes are correctly set up.

Parameters:
bounds - The bounds of the region based on the grid positions
Returns:
The texture object suitable for that bounds or null

getGridWidth

int getGridWidth()
Get the total width (number of points on the Y axis) of the grid. Assumes the total max width is known.

Returns:
The number of points in the width if the grid

getGridDepth

int getGridDepth()
Get the total depth (number of points on the X axis) of the grid. Assumes the total max width is known.

Returns:
The number of points in the depth of the grid

j3d.org Code

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