![]() |
HIRO_DRAW
Computer Graphics Structures library
|
Raster image which can have individual pixels set. More...
Public Member Functions | |
| glm::uvec2 | GetResolution () const override |
| Sets current raster dimensions. | |
| void | SetResolution (const glm::uvec2 &resolution, const cogs::Color3b &clearcolor=cogs::color::BLACK) |
| Sets the raster dimensions and clear it to the clearcolor. | |
| const cogs::Color3b & | GetPixel (size_t x, size_t y) const |
| Gets the pixel at given pixel coordinates. | |
| void | SetPixel (size_t x, size_t y, const cogs::Color3b &color) |
| Sets a pixel in a working buffer at a given position to the given color. | |
| void | Clear (const cogs::Color3b &color=cogs::color::BLACK) |
| Clears the working pixel buffer to the defined color. | |
| void | SyncRastersIfNeeded () |
| When sync flag is set, copies data from working to display raster and resets the flag. | |
Public Member Functions inherited from hiro::draw::ImageRenderer | |
| ImageRenderer (const glw::PTexture2D &image_texture) | |
| ImageRenderer (const std::string &image_file) | |
| void | SetImage (const glw::PTexture2D &image_texture) |
| void | LoadImageFile (const std::string &image_file) |
| glw::PTexture2D | GetTexture () const |
| glm::mat4 | GetImageToPixelTransform (const ImageStyle &style, const hiro::draw::ProjectionParams ¶ms) const |
| Returns transformation from image texels to screen pixels. | |
| glm::mat4 | GetImageToViewportPixelTransform (const ImageStyle &style, const hiro::draw::ProjectionParams ¶ms) const |
| Returns transformation from image texels to viewport screen pixels. | |
Protected Member Functions | |
| void | Render2D (const std::string &program) override |
| Describes rendering behavior in 2D rendering pass. | |
| bool | IsCompatibileWithStyle (const hiro::draw::Style *style) override |
| Test whether specified style is compatible with object. | |
Protected Member Functions inherited from hiro::draw::ImageRenderer | |
| void | LoadRequiredShaderPrograms (glw::ProgramList *programs) override |
| Loads shader programs required by this renderer. | |
| virtual void | FillTextRenderer (hiro::draw::TextRenderer *t_renderer) override |
| Override this method to define texts to be rendered. | |
| void | SetupFiltering () |
| Sets the texture filtering based on the style preference. | |
Protected Member Functions inherited from hiro::draw::Renderer | |
| virtual void | Render (const std::string &program) |
| Override this method to specify custom rendering behavior in 3D rendering pass. | |
| virtual void | OnRenderSimple () |
| Provides the possibility to render shapes using a simple color shader. More... | |
| virtual void | OnRenderSimple2D () |
| Provides the possibility to render shapes using a simple color shader. More... | |
| template<typename StyleType > | |
| const StyleType * | GetStyle () const |
| Obtain currently set object style of specific type. Can be used only in Update-Render stage! | |
| const Scene * | GetScene () const |
Additional Inherited Members | |
Protected Attributes inherited from hiro::draw::ImageRenderer | |
| glw::PTexture2D | texture_buffer_ { nullptr } |
| Texture buffer for the Image. | |
Raster image which can have individual pixels set.
Default resolution is 1x1, the default pixel color is black. If one of the dimensions provided to resolution is 0, nothing is rendered.
Internally the renderer uses two buffers - texture buffer and work buffer. Texture buffer is used for rendering and it is located in the video memory. Work buffer is stored in RAM. When user manipulates with the pixels/resolution, the work buffer is changed and texture buffer invalidated. Before the rendering, if a texture buffer is invalid, the changes from work buffer are automatically introduced to the texture buffer.