vtdata library
Public Member Functions | Public Attributes | Protected Attributes | List of all members
ColorMap Class Reference

Public Member Functions

bool Save (const char *fname) const
bool Load (const char *fname)
void Add (float elev, const RGBi &color)
float Elev (int index) const
const RGBiColor (int index) const
void SetColor (int index, const RGBi &rgb)
void RemoveAt (int num)
void Clear ()
int Num () const
void GenerateColorTable (int iTableSize, float fMin, float fMax)
const RGBiColorFromTable (float fElev) const

Public Attributes

std::vector< RGBim_table
float m_fMin
float m_fMax
float m_fRange
int m_iTableSize
bool m_bBlend
bool m_bRelative

Protected Attributes

std::vector< float > m_elev
std::vector< RGBim_color

Detailed Description

This small class describes how to map elevation (as from a heightfield) onto a set of colors.

Member Function Documentation

void ColorMap::Add ( float  elev,
const RGBi color 

Add a color entry, keeping the elevation values sorted.

void ColorMap::GenerateColorTable ( int  iTableSize,
float  fMin,
float  fMax 

Tell this ColorMap to generate an internal table of interpolated colors. This sets it up to use ColorFromTable().

iTableSizeThe desired number of elements in the table.
fMin,fMaxThe elevation range to interpolate over.