org.xith3d.terrain
Class DefaultGridResourceProvider

java.lang.Object
  extended by org.xith3d.terrain.DefaultGridResourceProvider
All Implemented Interfaces:
GridResourceProvider
Direct Known Subclasses:
L3DTResourceProvider

public class DefaultGridResourceProvider
extends java.lang.Object
implements GridResourceProvider


Constructor Summary
protected DefaultGridResourceProvider()
           
  DefaultGridResourceProvider(java.util.List<GridResourceSpec<GridSampler>> samplerSpecs, java.util.List<GridResourceSpec<GridSurface>> surfaceSpecs)
           
 
Method Summary
protected  GridSampler createSampler(GridResourceSpec<GridSampler> spec)
           
protected  GridSurface createSurface(GridResourceSpec<GridSurface> spec)
           
protected  GridResourceSpec findResourceSpec(java.util.List<GridResourceSpec> specs, float s1, float t1, float s2, float t2, int detail)
           
 GridSampler findSampler(float s1, float t1, float s2, float t2, int detail)
          Will be called by the terrain subsystem to retrieve a sampler, that holds the data for the area sampled next.
 GridSurface findSurface(float s1, float t1, float s2, float t2, int detail)
          Will be called by the terrain subsystem to retrieve a surface of the specfied detail level.
 void releaseSampler(GridSampler sampler)
           
 void releaseSurface(GridSurface surface)
           
protected  void setSamplerSpecs(java.util.List<GridResourceSpec> samplerSpecs)
           
protected  void setSurfaceSpecs(java.util.List<GridResourceSpec> surfaceSpecs)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultGridResourceProvider

protected DefaultGridResourceProvider()

DefaultGridResourceProvider

public DefaultGridResourceProvider(java.util.List<GridResourceSpec<GridSampler>> samplerSpecs,
                                   java.util.List<GridResourceSpec<GridSurface>> surfaceSpecs)
Method Detail

setSamplerSpecs

protected void setSamplerSpecs(java.util.List<GridResourceSpec> samplerSpecs)

setSurfaceSpecs

protected void setSurfaceSpecs(java.util.List<GridResourceSpec> surfaceSpecs)

findSampler

public final GridSampler findSampler(float s1,
                                     float t1,
                                     float s2,
                                     float t2,
                                     int detail)
Description copied from interface: GridResourceProvider
Will be called by the terrain subsystem to retrieve a sampler, that holds the data for the area sampled next.

Specified by:
findSampler in interface GridResourceProvider
Parameters:
s1 - the "longitude" corner coordinate of the grid tile sampled next.
t1 - the "latitude" corner coordinate of the grid tile sampled next.
s2 - the opposite corners "longitude" coordinate of the grid tile sampled next.
t2 - the opposite corners "latitude" coordinate of the grid tile sampled next.
detail - the detail level of the grid tile sampled next. If '-1' the best already initialized sampler is returned.
Returns:
a GridSampler implementation to provide the height and local coordinate values

releaseSampler

public void releaseSampler(GridSampler sampler)
Specified by:
releaseSampler in interface GridResourceProvider

findSurface

public final GridSurface findSurface(float s1,
                                     float t1,
                                     float s2,
                                     float t2,
                                     int detail)
Description copied from interface: GridResourceProvider
Will be called by the terrain subsystem to retrieve a surface of the specfied detail level.

Specified by:
findSurface in interface GridResourceProvider
Parameters:
s1 - the "longitude" corner coordinate of the grid tile sampled next.
t1 - the "latitude" corner coordinate of the grid tile sampled next.
s2 - the opposite corners "longitude" coordinate of the grid tile sampled next.
t2 - the opposite corners "latitude" coordinate of the grid tile sampled next.
detail - the detail level of the grid tile textured next. If '-1' the best already initialized surface is returned.
Returns:
a GridSurface implementation that provides the appearance texture coordinate infos.

releaseSurface

public void releaseSurface(GridSurface surface)
Specified by:
releaseSurface in interface GridResourceProvider

findResourceSpec

protected GridResourceSpec findResourceSpec(java.util.List<GridResourceSpec> specs,
                                            float s1,
                                            float t1,
                                            float s2,
                                            float t2,
                                            int detail)

createSampler

protected GridSampler createSampler(GridResourceSpec<GridSampler> spec)

createSurface

protected GridSurface createSurface(GridResourceSpec<GridSurface> spec)