Public Types | |
typedef std::map< float, osg::Vec4 > | ColorMap |
Public Member Functions | |
TransferFunction1D () | |
TransferFunction1D (const TransferFunction1D &tf, const CopyOp ©op=CopyOp::SHALLOW_COPY) | |
META_Object (osg, TransferFunction1D) float getMinimum() const | |
float | getMaximum () const |
void | allocate (unsigned int numImageCells) |
void | clear (const osg::Vec4 &color=osg::Vec4(1.0f, 1.0f, 1.0f, 1.0f)) |
osg::Vec4 | getPixelValue (unsigned int i) const |
unsigned int | getNumberImageCells () const |
void | setColor (float v, const osg::Vec4 &color, bool updateImage=true) |
osg::Vec4 | getColor (float v) const |
ColorMap & | getColorMap () |
const ColorMap & | getColorMap () const |
void | assign (const ColorMap &vcm) |
void | updateImage () |
Protected Member Functions | |
void | assignToImage (float lower_v, const osg::Vec4 &lower_c, float upper_v, const osg::Vec4 &upper_c) |
Protected Attributes | |
ColorMap | _colorMap |
typedef std::map<float, osg::Vec4> osg::TransferFunction1D::ColorMap |
osg::TransferFunction1D::TransferFunction1D | ( | ) |
osg::TransferFunction1D::TransferFunction1D | ( | const TransferFunction1D & | tf, | |
const CopyOp & | copyop = CopyOp::SHALLOW_COPY | |||
) |
Copy constructor using CopyOp to manage deep vs shallow copy.
osg::TransferFunction1D::META_Object | ( | osg | , | |
TransferFunction1D | ||||
) | const [inline] |
Get the mnimum transfer function value.
float osg::TransferFunction1D::getMaximum | ( | ) | const [inline] |
Get the maximum transfer function value.
void osg::TransferFunction1D::allocate | ( | unsigned int | numImageCells | ) |
allocate the osg::Image with specified dimension. The Image tracks the color map, and is used to represent the transfer function when download to GPU.
Clear the whole range to just represet a single color.
osg::Vec4 osg::TransferFunction1D::getPixelValue | ( | unsigned int | i | ) | const [inline] |
Get pixel value from the image.
unsigned int osg::TransferFunction1D::getNumberImageCells | ( | ) | const [inline] |
Get the number of image cells that are assigned to the represent the transfer function when download to the GPU.
void osg::TransferFunction1D::setColor | ( | float | v, | |
const osg::Vec4 & | color, | |||
bool | updateImage = true | |||
) |
Set the color for a specified transfer function value. updateImage defaults to true, and tells the setColor function to update the associate osg::Image that tracks the color map. Pass in false as the updateImage parameter if you are setting up many values at once to avoid recomputating og the image data, then once all setColor calls are made explictly call updateImage() to bring the osg::Image back into sync with the color map.
osg::Vec4 osg::TransferFunction1D::getColor | ( | float | v | ) | const |
Get the color for a specified transfer function value, interpolating the value if no exact match is found.
ColorMap& osg::TransferFunction1D::getColorMap | ( | ) | [inline] |
Get the color map that stores the mapping between the the tranfser function value and the colour it maps to.
const ColorMap& osg::TransferFunction1D::getColorMap | ( | ) | const [inline] |
Get the const color map that stores the mapping between the the tranfser function value and the colour it maps to.
void osg::TransferFunction1D::assign | ( | const ColorMap & | vcm | ) |
Assign a color map and automatically update the image to make sure they are in sync.
void osg::TransferFunction1D::updateImage | ( | ) |
Manually update the associate osg::Image to represent the colors assigned in the color map.
void osg::TransferFunction1D::assignToImage | ( | float | lower_v, | |
const osg::Vec4 & | lower_c, | |||
float | upper_v, | |||
const osg::Vec4 & | upper_c | |||
) | [protected] |
ColorMap osg::TransferFunction1D::_colorMap [protected] |