Noting with this function that Ogre::ColourValue return Ogre::ColourValue type with RGBA or what ever your image encoding method provides as normalized in value ranges between [0,1].
This means that if you want to properly configure the channels you need to use the channel bit multiplier accordingly, thus,
for the RGBA channel at 8 bits per channel with 256.0f different color ranges you'd have the following call in restoring the channels R value...assuming an Ogre::Image* image
OgreColourValue coln = img->getColourAt(x,y,z);
Ogre::ColourValue col = Ogre::ColourValue(256.0f*col.r, 256.0f*col.g, 256.0f*col.b, 256.0f*col.a);
where col provides the proper (non normalized color value according to your image type bit set.
A 16 bit channel would have a 256^2 channel multiplier
24 bit channel a 256^3 channel multiplier
and so forth.
The alternate method suggests something like
Ogre::PixelBox pixel_box = img->getPixelBox();
where you could use a getData call, but this requires you to do a little more pointer array work on the uchar* data set where you'd likely reverse the equation process found in a past posting of mine (namely inverting the getPixel process for the ImageBuffer class from ImageStuff.cpp)
Here's a picture on a running project. Basically loading my 32 bit RGBA heightmap.
The alternate method suggests something like
Ogre::PixelBox pixel_box = img->getPixelBox();
where you could use a getData call, but this requires you to do a little more pointer array work on the uchar* data set where you'd likely reverse the equation process found in a past posting of mine (namely inverting the getPixel process for the ImageBuffer class from ImageStuff.cpp)
Here's a picture on a running project. Basically loading my 32 bit RGBA heightmap.
No comments:
Post a Comment