raisim::HeightMapVisual
struct · #include <raisim/server/Visuals.hpp>
Visual-only height map (no physics) streamed by RaisimServer. Create with RaisimServer::addVisualHeightMap(); the server owns it. The constructors forward their arguments to the matching raisim::HeightMap constructor.
Constructors & destructor
HeightMapVisual
HeightMapVisual(const std::string &fileName, double centerX, double centerY)Parameters
| Parameter | Description |
|---|---|
fileName (in) | raisim height-map text file |
centerX (in) | x coordinate of the center |
centerY (in) | y coordinate of the center |
HeightMapVisual(
const std::string &pngFileName,
double centerX,
double centerY,
double xScale,
double yScale,
double heightScale,
double heightOffset)Parameters
| Parameter | Description |
|---|---|
pngFileName (in) | png image whose pixel values define the heights |
centerX (in) | x coordinate of the center |
centerY (in) | y coordinate of the center |
xScale (in) | size along x |
yScale (in) | size along y |
heightScale (in) | scale from pixel value to height |
heightOffset (in) | height of the 0-value pixel |
HeightMapVisual(
double centerX,
double centerY,
TerrainProperties &terrainProperties)Parameters
| Parameter | Description |
|---|---|
centerX (in) | x coordinate of the center |
centerY (in) | y coordinate of the center |
terrainProperties (in) | procedural terrain parameters |
HeightMapVisual(
size_t xSamples,
size_t ysamples,
double xSize,
double ySize,
double centerX,
double centerY,
const std::vector<double> &heightIn)Parameters
| Parameter | Description |
|---|---|
xSamples (in) | number of samples along x |
ysamples (in) | number of samples along y |
xSize (in) | size along x |
ySize (in) | size along y |
centerX (in) | x coordinate of the center |
centerY (in) | y coordinate of the center |
heightIn (in) | heights, xSamples * ysamples values |
~HeightMapVisual
~HeightMapVisual() = defaultPublic member functions
setColor
void setColor(double r, double g, double b, double a)Parameters
| Parameter | Description |
|---|---|
r (in) | red value (max=1) |
g (in) | green value (max=1) |
b (in) | blue value (max=1) |
a (in) | alpha value (max=1) Store an RGBA color in color. Note: the server currently does not transmit color for height maps, so this has no visible effect; use the per-vertex overload instead. |
void setColor(const std::vector<raisim::ColorRGB> &color)Set per-vertex colors (forwards to HeightMap::setColor()). An empty vector disables them.
Parameters
| Parameter | Description |
|---|---|
color (in) | one color per height sample, or empty |
update
void update(
double centerX,
double centerY,
double sizeX,
double sizeY,
const std::vector<double> &height)Replace the heights and placement (forwards to HeightMap::update()). The sample counts must not change.
Parameters
| Parameter | Description |
|---|---|
centerX (in) | x coordinate of the center |
centerY (in) | y coordinate of the center |
sizeX (in) | size along x |
sizeY (in) | size along y |
height (in) | new heights (row-major), same count as before |
lockMutex
void lockMutex()Lock this height map's mutex. The server holds it while serializing this height map, so lock it while modifying the height map from another thread. Same as lock().
lock
void lock()Lock the mutex (BasicLockable interface for std::lock_guard / std::unique_lock).
try_lock
bool try_lock()Returns true if the mutex was acquired without blocking (Lockable interface).
unlockMutex
void unlockMutex()Unlock the mutex locked by lockMutex(). Same as unlock().
unlock
void unlock()Unlock the mutex (BasicLockable interface).
Public attributes
color
raisim::Vec<4> colorRGBA color set by addVisualHeightMap()/setColor(). Currently not transmitted to the visualizer.
obj
raisim::HeightMap objHeight map object used for visualization.