dtTerrain::ImageUtils Class Reference

This class is a static class containing many methods for creating images procedurally, concatenating images, and building images from source height data. More...

#include <imageutils.h>

List of all members.

Static Public Member Functions

static void ImageStats (const osg::Image *image, std::string *imagename)
 Logs information about the given image.
static void LoadGeospecificLCCImage (ImageUtils::GeospecificImage &gslcc)
static dtCore::RefPtr< osg::Image > CreateDetailMap (unsigned int width, unsigned int height)
 
Parameters:
width The target width of the created image.

static unsigned short CalculateDetailNoise (int x, int y)
 Calculates a noise value for a given x,y pair.
static dtCore::RefPtr< osg::Image > CreateBaseGradientMap (const HeightField &hf, float scale)
 Generates a gradient map based on the given heightfield.
static dtCore::RefPtr< osg::Image > CreateDetailGradientMap (unsigned int width, unsigned int height, float scale)
 Generates a gradient map based on perlin noise.
static unsigned short CalculateScaleMapNoise (int x, int y)
static dtCore::RefPtr< osg::Image > CreateDetailScaleMap (unsigned int width, unsigned int height)
 Creates a perlin noise map which is useful for adding perturbing existing noise values in a random fashion.
static dtCore::RefPtr< osg::Image > MakeFilteredImage (const osg::Image &src_image, const osg::Vec3 &rgb_selected)
 Create smoothed grayscale map of the terrain by LCC type Uses weighted next nearest neighbor to "fuzzy"-up the LCCImage data.
static dtCore::RefPtr< osg::Image > ApplyMask (const osg::Image &src_image, const osg::Image &mask_image)
 Use an image to mask-out vegetation probability (set probability to 0%) Useful for masking-out bodies of water or user-created urban models.
static dtCore::RefPtr< osg::Image > MakeSlopeAspectImage (const HeightField &hf)
 Create a slope map.
static dtCore::RefPtr< osg::Image > MakeRelativeElevationImage (const HeightField &hf, float scale)
 Creates a relative elevation map.
static dtCore::RefPtr< osg::Image > MakeBaseColor (const HeightField &hf, const ImageUtils::HeightColorMap &upperHeightColorMap, const ImageUtils::HeightColorMap &lowerHeightColorMap, float gamma=1.0f)
 Generates an image which maps the height value in the heightfield to a color value given by one of the two color maps.
static dtCore::RefPtr< osg::Image > EnsurePow2Image (const osg::Image *srcImage)
 Nearest neighbor geometric image manipulation.

Classes

struct  GeospecificImage
struct  HeightColorMap
 Maps height values to colors with interpolation/extrapolation. More...


Detailed Description

This class is a static class containing many methods for creating images procedurally, concatenating images, and building images from source height data.

Member Function Documentation

void dtTerrain::ImageUtils::ImageStats ( const osg::Image *  image,
std::string *  imagename 
) [static]

Logs information about the given image.

(LogLevel is INFO).

Parameters:
image the handle to the image you want to examine
imagename a descriptive name to call this image

void dtTerrain::ImageUtils::LoadGeospecificLCCImage ( ImageUtils::GeospecificImage gslcc  )  [static]

dtCore::RefPtr< osg::Image > dtTerrain::ImageUtils::CreateDetailMap ( unsigned int  width,
unsigned int  height 
) [static]

Parameters:
width The target width of the created image.

Parameters:
eight The target height of the created image.

unsigned short dtTerrain::ImageUtils::CalculateDetailNoise ( int  x,
int  y 
) [static]

Calculates a noise value for a given x,y pair.

Parameters:
x The x value.
y The y value.

dtCore::RefPtr< osg::Image > dtTerrain::ImageUtils::CreateBaseGradientMap ( const HeightField hf,
float  scale 
) [static]

Generates a gradient map based on the given heightfield.

Parameters:
hf The source heightfield.
scale The scale value to apply to the resulting gradient calculations.
Returns:
An RGB image encoded with gradient values cooresponding to the specified heightfield.

dtCore::RefPtr< osg::Image > dtTerrain::ImageUtils::CreateDetailGradientMap ( unsigned int  width,
unsigned int  height,
float  scale 
) [static]

Generates a gradient map based on perlin noise.

This can be used to procedurally add lighting detail to surfaces.

Parameters:
width The width of the image.
height The height of the image.
float Scale value with with to scale the resulting gradient values.
Returns:
Image containing the gradient map.

unsigned short dtTerrain::ImageUtils::CalculateScaleMapNoise ( int  x,
int  y 
) [static]

dtCore::RefPtr< osg::Image > dtTerrain::ImageUtils::CreateDetailScaleMap ( unsigned int  width,
unsigned int  height 
) [static]

Creates a perlin noise map which is useful for adding perturbing existing noise values in a random fashion.

Parameters:
width Width of the image.
height Height of the image.
Returns:
An image containing perlin noise based scale values.

dtCore::RefPtr< osg::Image > dtTerrain::ImageUtils::MakeFilteredImage ( const osg::Image &  src_image,
const osg::Vec3 &  rgb_selected 
) [static]

Create smoothed grayscale map of the terrain by LCC type Uses weighted next nearest neighbor to "fuzzy"-up the LCCImage data.

Parameters:
src_image the black/white LCC Image by LCC type
rgb_selected the RGB color of the points to smooth (always 0,0,0 - black)
Returns:
the newly created image

dtCore::RefPtr< osg::Image > dtTerrain::ImageUtils::ApplyMask ( const osg::Image &  src_image,
const osg::Image &  mask_image 
) [static]

Use an image to mask-out vegetation probability (set probability to 0%) Useful for masking-out bodies of water or user-created urban models.

Parameters:
src_image the black/white LCC Image by LCC type
mask_image the black/white - using LCC type 11 as default
Returns:
the modified filtered image

dtCore::RefPtr< osg::Image > dtTerrain::ImageUtils::MakeSlopeAspectImage ( const HeightField hf  )  [static]

Create a slope map.

Parameters:
hf The heightfield heightfield
Returns:
the newly created image

dtCore::RefPtr< osg::Image > dtTerrain::ImageUtils::MakeRelativeElevationImage ( const HeightField hf,
float  scale 
) [static]

Creates a relative elevation map.

Parameters:
hf The heightfield with which to build the elevation map.
scale The amount to scale the resulting values by.
Returns:
the newly created image

dtCore::RefPtr< osg::Image > dtTerrain::ImageUtils::MakeBaseColor ( const HeightField hf,
const ImageUtils::HeightColorMap upperHeightColorMap,
const ImageUtils::HeightColorMap lowerHeightColorMap,
float  gamma = 1.0f 
) [static]

Generates an image which maps the height value in the heightfield to a color value given by one of the two color maps.

Parameters:
hf The heightfield with which to map colors.
upperHeightColorMap The color values to map the height values which are above 0 (sea-level).
lowerHeightColorMap The color values to map the height values which are are below or equal to zero.
gamma Gamma correction value. Greater than 1.0 to brighten, less than 1.0 to darken.

dtCore::RefPtr< osg::Image > dtTerrain::ImageUtils::EnsurePow2Image ( const osg::Image *  srcImage  )  [static]

Nearest neighbor geometric image manipulation.

This assumes that the original image is nxn square.

Parameters:
srcImage The image to scale.
Returns:
Destination image with the correct power of 2 dimensions.


http://www.delta3d.org
2.0.0 generated 14 Feb 2008