j3d.org Code

org.j3d.terrain
Class AbstractFreeFormTerrainData

java.lang.Object
  extended by org.j3d.terrain.AbstractTerrainData
      extended by org.j3d.terrain.AbstractFreeFormTerrainData
All Implemented Interfaces:
FreeFormTerrainData, TerrainData, HeightDataSource

public abstract class AbstractFreeFormTerrainData
extends AbstractTerrainData
implements FreeFormTerrainData

Abstract representation of free-form terrain data.

This implementation provides the ability to also use an external providers of texture information.

Version:
$Revision: 1.2 $
Author:
Justin Couch

Field Summary
protected  int gridDepth
          The number of grid points per tile in depth
protected  int gridWidth
          The number of grid points per tile in width
protected  TextureTileGenerator tileGenerator
          Reference to the currently set texture tile generator
 
Fields inherited from class org.j3d.terrain.AbstractTerrainData
colorAvailable, gridStepX, gridStepY, textureAvailable
 
Fields inherited from interface org.j3d.terrain.TerrainData
FREEFORM_DATA, STATIC_DATA, TILED_DATA
 
Constructor Summary
protected AbstractFreeFormTerrainData()
          Create a new instance.of this data class with all flags set to false.
 
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.
 void setTextureTileGenerator(TextureTileGenerator gen)
          Set the texture tile geneattor instance to the new value.
 
Methods inherited from class org.j3d.terrain.AbstractTerrainData
getGridXStep, getGridYStep, getSourceDataType, hasColor, hasTexture
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
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
 

Field Detail

tileGenerator

protected TextureTileGenerator tileGenerator
Reference to the currently set texture tile generator


gridWidth

protected int gridWidth
The number of grid points per tile in width


gridDepth

protected int gridDepth
The number of grid points per tile in depth

Constructor Detail

AbstractFreeFormTerrainData

protected AbstractFreeFormTerrainData()
Create a new instance.of this data class with all flags set to false.

Method Detail

getGridWidth

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

Specified by:
getGridWidth in interface FreeFormTerrainData
Returns:
The number of points in the width if the grid

getGridDepth

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

Specified by:
getGridDepth in interface FreeFormTerrainData
Returns:
The number of points in the depth of the grid

getTexture

public 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.

Specified by:
getTexture in interface FreeFormTerrainData
Parameters:
bounds - The bounds of the region based on the grid positions
Returns:
The texture object suitable for that bounds or null

setTextureTileGenerator

public void setTextureTileGenerator(TextureTileGenerator gen)
Set the texture tile geneattor instance to the new value. Setting a value of null will clear the current instance. Calling this method with a non-null generator instance does not automatically set the has texture flag.

Parameters:
gen - The new generator instance to use

j3d.org Code

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