org.xith3d.terrain
Class HeightMapSampler

java.lang.Object
  extended by org.xith3d.terrain.HeightMapSampler
All Implemented Interfaces:
GridResource, GridSampler

public class HeightMapSampler
extends java.lang.Object
implements GridSampler


Nested Class Summary
static class HeightMapSampler.Type
           
 
Field Summary
 float[][] map
           
 
Constructor Summary
HeightMapSampler(GridResourceSpec<GridSampler> spec)
           
HeightMapSampler(java.net.URL resource)
           
HeightMapSampler(java.net.URL resource, int xDim, int zDim)
           
HeightMapSampler(java.net.URL resource, int xDim, int zDim, HeightMapSampler.Type type)
           
 
Method Summary
 void release()
           
 org.openmali.vecmath2.Vector3f sampleBinormal(float s, float t)
          Samples a binormal vector from the grid
 float sampleHeight(float x, float z)
          Samples a height value from the grid
 org.openmali.vecmath2.Vector3f sampleNormal(float s, float t)
          Samples a normal vector from the grid
 org.openmali.vecmath2.Vector3f sampleTangent(float s, float t)
          Samples a tangent vector from the grid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

map

public float[][] map
Constructor Detail

HeightMapSampler

public HeightMapSampler(java.net.URL resource)
                 throws java.io.IOException
Throws:
java.io.IOException

HeightMapSampler

public HeightMapSampler(java.net.URL resource,
                        int xDim,
                        int zDim)
                 throws java.io.IOException
Throws:
java.io.IOException

HeightMapSampler

public HeightMapSampler(java.net.URL resource,
                        int xDim,
                        int zDim,
                        HeightMapSampler.Type type)
                 throws java.io.IOException
Throws:
java.io.IOException

HeightMapSampler

public HeightMapSampler(GridResourceSpec<GridSampler> spec)
                 throws java.io.IOException
Throws:
java.io.IOException
Method Detail

release

public void release()
Specified by:
release in interface GridResource
Specified by:
release in interface GridSampler

sampleHeight

public float sampleHeight(float x,
                          float z)
Description copied from interface: GridSampler
Samples a height value from the grid

Specified by:
sampleHeight in interface GridSampler
Parameters:
x - the "longitude" coordinate of the grid
z - the "latitude" coordinate of the grid
Returns:
a height value for the given [s,t] coordinate

sampleBinormal

public org.openmali.vecmath2.Vector3f sampleBinormal(float s,
                                                     float t)
Description copied from interface: GridSampler
Samples a binormal vector from the grid

Specified by:
sampleBinormal in interface GridSampler
Parameters:
s - the "longitude" coordinate of the grid
t - the "latitude" coordinate of the grid
Returns:
a binormal vector for the given [s,t] coordinate

sampleNormal

public org.openmali.vecmath2.Vector3f sampleNormal(float s,
                                                   float t)
Description copied from interface: GridSampler
Samples a normal vector from the grid

Specified by:
sampleNormal in interface GridSampler
Parameters:
s - the "longitude" coordinate of the grid
t - the "latitude" coordinate of the grid
Returns:
a normal vector for the given [s,t] coordinate

sampleTangent

public org.openmali.vecmath2.Vector3f sampleTangent(float s,
                                                    float t)
Description copied from interface: GridSampler
Samples a tangent vector from the grid

Specified by:
sampleTangent in interface GridSampler
Parameters:
s - the "longitude" coordinate of the grid
t - the "latitude" coordinate of the grid
Returns:
a tangent vector for the given [s,t] coordinate