![]() |
Rigs of Rods 2026.01
Soft-body Physics Simulation
|
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.
Definition at line 54 of file PropertyMaps.h.
Public Member Functions | |
| void | unload () |
| void | setFilter (MapFilter filter) |
| MapFilter | getFilter () |
| Ogre::PixelBox | getPixelBox () |
| Ogre::Real | getDensityAt (Ogre::Real x, Ogre::Real z, const Ogre::TRect< Ogre::Real > &mapBounds) |
| Ogre::Real | _getDensityAt_Unfiltered (Ogre::Real x, Ogre::Real z, const Ogre::TRect< Ogre::Real > &mapBounds) |
| Ogre::Real | _getDensityAt_Bilinear (Ogre::Real x, Ogre::Real z, const Ogre::TRect< Ogre::Real > &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) |
Private Member Functions | |
| DensityMap (Ogre::TexturePtr texture, MapChannel channel) | |
| ~DensityMap () | |
Private Attributes | |
| Ogre::String | selfKey |
| Ogre::uint32 | refCount |
| MapFilter | filter |
| Ogre::PixelBox * | pixels |
Static Private Attributes | |
| static std::map< Ogre::String, DensityMap * > | selfList |
|
private |
Definition at line 73 of file PropertyMaps.cpp.
|
private |
Definition at line 63 of file PropertyMaps.cpp.
| Ogre::Real Forests::DensityMap::_getDensityAt_Bilinear | ( | Ogre::Real | x, |
| Ogre::Real | z, | ||
| const Ogre::TRect< Ogre::Real > & | mapBounds | ||
| ) |
Definition at line 154 of file PropertyMaps.cpp.
| Ogre::Real Forests::DensityMap::_getDensityAt_Unfiltered | ( | Ogre::Real | x, |
| Ogre::Real | z, | ||
| const Ogre::TRect< Ogre::Real > & | mapBounds | ||
| ) |
Definition at line 127 of file PropertyMaps.cpp.
|
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.
Definition at line 96 of file PropertyMaps.h.
|
inline |
Returns the filtering mode being used for this density map.
Definition at line 73 of file PropertyMaps.h.
|
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.
Definition at line 85 of file PropertyMaps.h.
|
static |
|
static |
|
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.
Definition at line 70 of file PropertyMaps.h.
| void Forests::DensityMap::unload | ( | ) |
Definition at line 56 of file PropertyMaps.cpp.
|
private |
Definition at line 115 of file PropertyMaps.h.
|
private |
Definition at line 116 of file PropertyMaps.h.
|
private |
Definition at line 113 of file PropertyMaps.h.
|
private |
Definition at line 112 of file PropertyMaps.h.
|
staticprivate |
Definition at line 111 of file PropertyMaps.h.