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
           
 
Constructor Summary
HeightMapSampler(float[][] map)
           
HeightMapSampler(GridResourceSpec<GridSampler> spec)
           
HeightMapSampler(int sDim, int tDim)
           
HeightMapSampler(java.net.URL resource)
           
HeightMapSampler(java.net.URL resource, int sDim, int tDim)
           
HeightMapSampler(java.net.URL resource, int sDim, int tDim, HeightMapSampler.Type type)
           
 
Method Summary
 float[][] getMap()
          Returns the backing two dimensional float array for direct manipulation.
 float getOffset()
           
 float getS1()
           
 float getS2()
           
 float getScale()
           
 int getSDim()
           
 float getT1()
           
 float getT2()
           
 int getTDim()
           
 void release()
           
 org.openmali.vecmath2.Vector3f sampleBinormal(float s, float t)
          Samples a binormal vector from the grid
 float sampleHeight(float s, float t)
          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
 void setOffset(float offset)
           
 void setS1(float s1)
           
 void setS2(float s2)
           
 void setScale(float scale)
           
 void setT1(float t1)
           
 void setT2(float t2)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 sDim,
                        int tDim)
                 throws java.io.IOException
Throws:
java.io.IOException

HeightMapSampler

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

HeightMapSampler

public HeightMapSampler(float[][] map)

HeightMapSampler

public HeightMapSampler(int sDim,
                        int tDim)

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 s,
                          float t)
Description copied from interface: GridSampler
Samples a height value from the grid

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

getMap

public float[][] getMap()
Returns the backing two dimensional float array for direct manipulation.

Returns:
The backing two dimensional float array

getSDim

public int getSDim()

getTDim

public int getTDim()

getOffset

public float getOffset()

setOffset

public void setOffset(float offset)

getScale

public float getScale()

setScale

public void setScale(float scale)

getS1

public float getS1()

setS1

public void setS1(float s1)

getS2

public float getS2()

setS2

public void setS2(float s2)

getT1

public float getT1()

setT1

public void setT1(float t1)

getT2

public float getT2()

setT2

public void setT2(float t2)

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