public abstract class Ilv3DTile extends Object
IlvTileElevationProvider
that provides elevation values to
build the terrain mesh.
Three abstract methods must be implemented in a concrete subclass :
- loadDem()
, which is responsible for setting up the elevation provider on this tile. This must be called
once by the user after tile creation.
- drawImageData(..)
, which is responsible for setting up the OpenGL texture that is used to
draw the terrain.
- loadImg(..)
, which is responsible for actually generating the image used as a texture given the current
tile subsampling level. This method is dynamically called by the rendering loop as the camera gets closer or farther from
the terrainConstructor and Description |
---|
Ilv3DTile(int minDEMHeight)
Constructs an
Ilv3DTile . |
Modifier and Type | Method and Description |
---|---|
abstract void |
drawImageData(com.jogamp.opengl.GL2 gl,
int width,
int height)
Method responsible for setting up the OpenGL texture that is used to draw the terrain.
|
void |
drawTile(int filletMask,
Ilv3DLinearCoordinateConverter coordConverter,
IlvBufferSliceManager geomBuf,
Ilv3DCamera camera,
com.jogamp.opengl.GL2 gl,
boolean isBilinearFiltering)
Renders the tile in the specified OpenGL context at the current DEM and image level.
|
void |
drawTile(int filletMask,
Ilv3DLinearCoordinateConverter coordConverter,
IlvBufferSliceManager geomBuf,
Ilv3DCamera camera,
com.jogamp.opengl.GL2 gl,
Ilv3DView view,
boolean isBilinearFiltering)
Renders the tile in the specified OpenGL context at the current DEM and image level.
|
float[] |
getApparentAreaFactors()
Returns the apparent areas at different levels.
|
Ilv3DDoubleVector |
getCenter()
Return the center point of this tile, in 3D space coordinates
|
double |
getGroundHeightAt(double x,
double z)
Computes and returns the elevation (above ground) at the specified location in 3D space coordinates.
|
int |
getTextureHeight()
Returns the height of the texture applied to this tile.
|
int |
getTextureWidth()
Returns the width of the texture applied to this tile.
|
IlvTileElevationProvider |
getTileElevationProvider()
Returns the associated
IlvTileElevationProvider used by this tile to fetch elevation values when
building the terrain mesh. |
float |
getTileHeight()
Return the height of this tile (in 3D space coordinates)
|
float |
getTileWidth()
Return the width of this tile (in 3D space coordinates)
|
boolean |
isKeepElevationDataCache()
Returns whether the tile should keep a copy of downsampled elevation data (depending on the camera position), or rather compute it at rendering time.
|
abstract void |
loadDEM()
Method responsible for loading and setting up the underlying
IlvTileElevationProvider . |
abstract void |
loadImg(int imageLevel,
IlvThreadedTaskProcessor.ThreadedTask task)
This method is responsible for generating the texture for the specified image level.
|
void |
regenerateTexture()
Forces a texture map generation at the next display.
|
protected void |
setImageSize(int width,
int height)
Sets the size of the texture as created by the
drawImageData method. |
void |
setKeepElevationDataCache(boolean keepElevationDataCache)
Sets whether the tile should keep a copy of downsampled elevation data (depending on the camera position), or rather compute it at rendering time.
|
protected void |
setSize(Ilv3DDoubleVector center,
float tileWidth,
float tileHeight)
Sets the bounds of this
Ilv3DTile |
void |
setTextureHeight(int textureHeight)
Sets the height of the texture applied to this tile.
|
void |
setTextureWidth(int textureWidth)
Sets the width of the texture applied to this tile.
|
protected void |
setTileElevationProvider(IlvTileElevationProvider provider)
Sets the associated
IlvTileElevationProvider used by this tile to fetch elevation values when
building the terrain mesh. |
void |
setupDEMLevel(int demLevel)
Sets the downsampling factor for the geometry of this tile.
|
void |
setupImgLevel(int imageLevel,
Ilv3DView view)
Sets the downsampling factor for the texture of this tile.
|
public Ilv3DTile(int minDEMHeight)
Ilv3DTile
.minDEMHeight
- The minimum accepted value for elevation values. Any value below this one
will be raised to this one.public float getTileWidth()
public float getTileHeight()
public Ilv3DDoubleVector getCenter()
public void regenerateTexture()
public float[] getApparentAreaFactors()
public double getGroundHeightAt(double x, double z)
x
- The X coordinate of the point, in 3D model space.z
- The Z coordinate of the point, in 3D model space.public void setupDEMLevel(int demLevel)
demLevel
- The downsampling factor.public void drawTile(int filletMask, Ilv3DLinearCoordinateConverter coordConverter, IlvBufferSliceManager geomBuf, Ilv3DCamera camera, com.jogamp.opengl.GL2 gl, boolean isBilinearFiltering)
filletMask
- A flag specifying the fillets that should be drawn for this tile (north,south, east,west).coordConverter
- The current Ilv3DCoordinateConverter
of the view.geomBuf
- A BufferSliceManager
that manages buffer slices used by this tile for rendering.camera
- The Ilv3DCamera
object through which this tile is viewed.gl
- The OpenGL context to render into.isBilinearFiltering
- A boolean specifying that rendering should use bilinear filtering of textures.public void drawTile(int filletMask, Ilv3DLinearCoordinateConverter coordConverter, IlvBufferSliceManager geomBuf, Ilv3DCamera camera, com.jogamp.opengl.GL2 gl, Ilv3DView view, boolean isBilinearFiltering)
filletMask
- A flag specifying the fillets that should be drawn for this tile (north,south, east,west).coordConverter
- The current Ilv3DCoordinateConverter
of the view.geomBuf
- ABufferSliceManager
that manages buffer slices used by this tile for rendering.camera
- The Ilv3DCamera
object through which this tile is viewed.gl
- The OpenGL context to render into.view
- The Ilv3DView
where this tile is being drawn.isBilinearFiltering
- A boolean specifying that rendering should use bilinear filtering of textures.public abstract void loadDEM() throws IOException
IlvTileElevationProvider
.IOException
- if loading encounters an exceptionpublic abstract void drawImageData(com.jogamp.opengl.GL2 gl, int width, int height)
loadImg()
method.gl
- The OpenGL context to set the texture onto.width
- The width of the texture image.height
- The height of the texture image.public void setupImgLevel(int imageLevel, Ilv3DView view)
imageLevel
- The downsampling factor.view
- The Ilv3DView to be refreshed when the asynchronous image loading is finished.protected void setImageSize(int width, int height)
drawImageData
method.width
- The texture width.height
- The texture height.public abstract void loadImg(int imageLevel, IlvThreadedTaskProcessor.ThreadedTask task) throws IOException
drawImageData()
method.imageLevel
- The downsampling level for image to generate.task
- The threaded task that is calling this method.IOException
- if an exception is thrown when generating the image.protected void setTileElevationProvider(IlvTileElevationProvider provider)
IlvTileElevationProvider
used by this tile to fetch elevation values when
building the terrain mesh.provider
- The IlvTileElevationProvider
this tile is based upon.public IlvTileElevationProvider getTileElevationProvider()
IlvTileElevationProvider
used by this tile to fetch elevation values when
building the terrain mesh.IlvTileElevationProvider
this tile is based upon.protected void setSize(Ilv3DDoubleVector center, float tileWidth, float tileHeight)
Ilv3DTile
center
- The center of this tile.tileWidth
- This tile's width, in 3D space coordinates.tileHeight
- This tile's height, in 3D space coordinates.public boolean isKeepElevationDataCache()
true
, the higher the frame rate of the view, but also the bigger the memory usage (as part
of the elevation data is duplicated).true
if the tile caches its elevation data.public void setKeepElevationDataCache(boolean keepElevationDataCache)
true
, the higher the frame rate of the view, but also the bigger the memory usage (as part
of the elevation data is duplicated).keepElevationDataCache
- true
if the tile caches its elevation data.public int getTextureHeight()
public void setTextureHeight(int textureHeight)
textureHeight
- The texture height.public int getTextureWidth()
public void setTextureWidth(int textureWidth)
textureWidth
- The texture width.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.