iDynTree::ITexture class

The interface for an object that can be used as an additional target for the renderer.

This allows rendering the scene using dimensions and environment that are different from the main window. The camera is in common. Any camera change in the main window is also reflected in the other textures.

Constructors, destructors, conversion operators

~ITexture() pure virtual
Destructor.

Public functions

auto environment() -> IEnvironment& pure virtual
Return an interface to manipulate the texture environment.
auto getPixelColor(unsigned int width, unsigned int height) const -> ColorViz pure virtual
Get the color of the pixel at the given position in the additional texture.
auto getPixels(std::vector<PixelViz>& pixels) const -> bool pure virtual
Get the pixels of the texture.
auto drawToFile(const std::string filename = "iDynTreeVisualizerTextureScreenshot.png") const -> bool pure virtual
Draw the current texture to a image file.
void enableDraw(bool enabled = true) pure virtual
Enable/disable the drawing on the texture.
auto width() const -> int pure virtual
Get the texture width.
auto height() const -> int pure virtual
Get the texture height.
auto setSubDrawArea(int xOffsetFromTopLeft, int yOffsetFromTopLeft, int subImageWidth, int subImageHeight) -> bool pure virtual
Set the area used for drawing operations.

Function documentation

ColorViz iDynTree::ITexture::getPixelColor(unsigned int width, unsigned int height) const pure virtual

Get the color of the pixel at the given position in the additional texture.

Parameters
width The width of the pixel
height The height of the pixel
Returns The color of the pixel

Remember to call draw() first.

bool iDynTree::ITexture::getPixels(std::vector<PixelViz>& pixels) const pure virtual

Get the pixels of the texture.

Parameters
pixels The output pixels. The size of the vector will be equal to the total number of pixels of the rendered texture, i.e. width of the texture times its height. Both these two parameters can be set in the textureOptions passed to the method ITexturesHandler::add. The pixels are saved in col-major format.
Returns True in case of success, false otherwise

Remember to call draw() first.

bool iDynTree::ITexture::drawToFile(const std::string filename = "iDynTreeVisualizerTextureScreenshot.png") const pure virtual

Draw the current texture to a image file.

Returns true if all went ok, false otherwise.

The format of the image is desumed from the filename.

For more info on the process of writing the image, check irr::video::IVideoDriver::writeImageToFile irrlicht method.

void iDynTree::ITexture::enableDraw(bool enabled = true) pure virtual

Enable/disable the drawing on the texture.

Parameters
enabled If true (default), the visualizer will draw on the texture when calling draw();

bool iDynTree::ITexture::setSubDrawArea(int xOffsetFromTopLeft, int yOffsetFromTopLeft, int subImageWidth, int subImageHeight) pure virtual

Set the area used for drawing operations.

The entirety of the texture is cleared between two draw() calls. Use this in conjunction with subDraw() to draw on different parts of the same texture. Use call it with (0, 0, width(), height()) to draw on the full texture (this is done by default).