PagedGeometry
1.3.0
|
A 2D greyscale image that is assigned to a certain region of your world to represent density levels. More...
#include <PropertyMaps.h>
Public Member Functions | |
void | unload () |
void | setFilter (MapFilter filter) |
Sets the filtering mode used for this density map. More... | |
MapFilter | getFilter () |
Returns the filtering mode being used for this density map. | |
Ogre::PixelBox | getPixelBox () |
Gets a pointer to the pixel data of the density map. More... | |
Ogre::Real | getDensityAt (Ogre::Real x, Ogre::Real z, const Ogre::RealRect &mapBounds) |
Gets the density level at the specified position. More... | |
Ogre::Real | _getDensityAt_Unfiltered (Ogre::Real x, Ogre::Real z, const Ogre::RealRect &mapBounds) |
Ogre::Real | _getDensityAt_Bilinear (Ogre::Real x, Ogre::Real z, const Ogre::RealRect &mapBounds) |
Static Public Member Functions | |
static DensityMap * | load (const Ogre::String &fileName, MapChannel channel=CHANNEL_COLOR) |
static DensityMap * | load (Ogre::TexturePtr texture, MapChannel channel=CHANNEL_COLOR) |
A 2D greyscale image that is assigned to a certain region of your world to represent density 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 DensityMap class interface than you can with the standard GrassLayer density map functions, for example.
Probably the most useful function in this class is getPixelBox(), which you can use to directly manipulate the density map pixels in real-time.
|
inline |
Sets the filtering mode used for this density map.
This function can be used to set the filtering mode used for your density map. By default, bilinear filtering is used (MAPFILTER_BILINEAR). If you disable filtering by using MAPFILTER_NONE, the resulting effect of the density map may look square and blocky, 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 blockyness.
|
inline |
Gets a pointer to the pixel data of the density map.
You can use this function to access the pixel data of the density map. The PixelBox returned is an image in PF_BYTE_L (aka. PF_L8) byte format. 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 density 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 density level at the specified position.
The boundary given defines the area where this density map takes effect. Normally this is set to your terrain's bounds so the density map is aligned to your heightmap, but you could apply it anywhere you want.