HIRO_DRAW
Computer Graphics Structures library
hiro::draw::ImageRenderer Class Reference

Image image which can have individual pixels set. More...

Inheritance diagram for hiro::draw::ImageRenderer:
[legend]

Public Member Functions

 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
 
virtual glm::uvec2 GetResolution () const
 Returns the current Image resolution.
 
glm::mat4 GetImageToPixelTransform (const ImageStyle &style, const hiro::draw::ProjectionParams &params) const
 Returns transformation from image texels to screen pixels.
 
glm::mat4 GetImageToViewportPixelTransform (const ImageStyle &style, const hiro::draw::ProjectionParams &params) 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 Style *style) override
 Test whether specified style is compatible with object.
 
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
 

Protected Attributes

glw::PTexture2D texture_buffer_ { nullptr }
 Texture buffer for the Image.
 

Detailed Description

Image 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.