PagedGeometry
1.3.0
|
A 2D greyscale image that is assigned to a certain region of your world to represent color levels. More...
#include <PropertyMaps.h>
Public Member Functions | |
void | unload () |
void | setFilter (MapFilter filter) |
Sets the filtering mode used for this color map. More... | |
MapFilter | getFilter () |
Returns the filtering mode being used for this color map. | |
Ogre::PixelBox | getPixelBox () |
Gets a pointer to the pixel data of the color map. More... | |
Ogre::uint32 | getColorAt (Ogre::Real x, Ogre::Real z, const Ogre::RealRect &mapBounds) |
Gets the color value at the specified position. More... | |
Ogre::ColourValue | getColorAt_Unpacked (Ogre::Real x, Ogre::Real z, const Ogre::RealRect &mapBounds) |
Gets the color value at the specified position. More... | |
Static Public Member Functions | |
static ColorMap * | load (const Ogre::String &fileName, MapChannel channel=CHANNEL_COLOR) |
static ColorMap * | load (Ogre::TexturePtr texture, MapChannel channel=CHANNEL_COLOR) |
A 2D greyscale image that is assigned to a certain region of your world to represent color levels.
This class is used by various PagedLoader's internally, so it's not necessary to learn anything about this class. However, you can achieve more advanced effects through the ColorMap class interface than you can with the standard GrassLayer color map functions, for example.
Probably the most useful function in this class is getPixelBox(), which you can use to directly manipulate the color map pixels in real-time.
|
inline |
Sets the filtering mode used for this color map.
This function can be used to set the filtering mode used for your color map. By default, bilinear filtering is used (MAPFILTER_BILINEAR). If you disable filtering by using MAPFILTER_NONE, the resulting coloration may appear slightly pixelated, depending on the resolution of the map.
MAPFILTER_NONE is slightly faster than MAPFILTER_BILINEAR, so use it if you don't notice any considerable pixelation.
Referenced by Forests::TreeLoader2D::setColorMapFilter(), and Forests::TreeLoader3D::setColorMapFilter().
|
inline |
Gets a pointer to the pixel data of the color map.
You can use this function to access the pixel data of the color map. The PixelBox returned is an image in PF_A8R8G8B8 format when running with DirectX, and PF_A8B8G8R8 when running with OpenGL. You can modify this image any way you like in real-time, so long as you do not change the byte format.
This function is useful in editors where the color map needs to be changed dynamically. Note that although you can change this map in real-time, the changes won't be uploaded to your video card until you call PagedGeometry::reloadGeometry(). If you don't, the grass you see will remain unchanged.
References Ogre::Image::getPixelBox().
|
inline |
Gets the color value at the specified position.
A RenderSystem-specific 32-bit packed color value is used, so it can be fed directly to the video card.
The boundary given defines the area where this color map takes effect. Normally this is set to your terrain's bounds so the color map is aligned to your heightmap, but you could apply it anywhere you want.
|
inline |
Gets the color value at the specified position.
The unpacks the 32-bit color value into an Ogre::ColourValue and returns it.