org.xith3d.terrain
Class TextureSurface

java.lang.Object
  extended by org.xith3d.terrain.TextureSurface
All Implemented Interfaces:
GridResource, GridSurface

public class TextureSurface
extends java.lang.Object
implements GridSurface

This is a basic example GridShader implementation to show, how to improve terrain rendering by utilizing a detail texture.


Constructor Summary
TextureSurface(GridResourceSpec<GridSurface> spec)
           
TextureSurface(java.net.URL mainTexture)
          Constructs a GridShader with a single texture.
TextureSurface(java.net.URL mainTexture, Material material)
          Constructs a GridShader with a single texture.
TextureSurface(java.net.URL mainTexture, java.net.URL detailTexture, float detailRepeat, org.jagatoo.opengl.enums.TextureMode blendMode)
          Constructs a GridShader with detail texture support.
TextureSurface(java.net.URL mainTexture, java.net.URL detailTexture, float detailRepeat, org.jagatoo.opengl.enums.TextureMode blendMode, Material material)
          Constructs a GridShader with detail texture support.
 
Method Summary
 Appearance getAppearance()
          We only set up one appearance for our grid.
 int getTextureUnits()
          Will be called to return the amount of texture units needed.
 org.openmali.vecmath2.TexCoord2f map(float s, float t, int unit)
          Maps the passed grid coordinates to texture coordinates.
 void release()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextureSurface

public TextureSurface(java.net.URL mainTexture)
Constructs a GridShader with a single texture.

Parameters:
colorTexture - the name/path of the main color texture for the grid.

TextureSurface

public TextureSurface(java.net.URL mainTexture,
                      Material material)
Constructs a GridShader with a single texture.

Parameters:
colorTexture - the name/path of the main color texture for the grid.
material - the material properties of this surface

TextureSurface

public TextureSurface(GridResourceSpec<GridSurface> spec)

TextureSurface

public TextureSurface(java.net.URL mainTexture,
                      java.net.URL detailTexture,
                      float detailRepeat,
                      org.jagatoo.opengl.enums.TextureMode blendMode)
Constructs a GridShader with detail texture support.

Parameters:
mainTexture - the name/path of the main color texture for the grid.
detailTexture - the name/path of the repeating detail texture.
detailRepeat - the amount of repetitions (per side) of the detail texture
blendMode - the blend mode of the detail texture (see TextureAttributes)

TextureSurface

public TextureSurface(java.net.URL mainTexture,
                      java.net.URL detailTexture,
                      float detailRepeat,
                      org.jagatoo.opengl.enums.TextureMode blendMode,
                      Material material)
Constructs a GridShader with detail texture support.

Parameters:
mainTexture - the name/path of the main color texture for the grid.
detailTexture - the name/path of the repeating detail texture.
detailRepeat - the amount of repetitions (per side) of the detail texture
blendMode - the blend mode of the detail texture (see TextureAttributes)
material - the material properties of this surface
Method Detail

release

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

getAppearance

public Appearance getAppearance()
We only set up one appearance for our grid.

Specified by:
getAppearance in interface GridSurface

getTextureUnits

public int getTextureUnits()
Description copied from interface: GridSurface
Will be called to return the amount of texture units needed.

Specified by:
getTextureUnits in interface GridSurface
Returns:
the number of texture units

map

public org.openmali.vecmath2.TexCoord2f map(float s,
                                            float t,
                                            int unit)
Description copied from interface: GridSurface
Maps the passed grid coordinates to texture coordinates.

Specified by:
map in interface GridSurface
Parameters:
s - the "longitude" coordinate of the grid
t - the "latitude" coordinate of the grid
unit - the texture unit for which the coordinates have to be calculated.
Returns:
a texture coordinate