gramods
Classes | Public Member Functions | Static Public Attributes | List of all members
gramods::gmGraphics::ImageTexture Class Reference

The ImageTexture reads image data from a specified file to populate its texture data. More...

#include <ImageTexture.hh>

Inheritance diagram for gramods::gmGraphics::ImageTexture:
Inheritance graph
[legend]
Collaboration diagram for gramods::gmGraphics::ImageTexture:
Collaboration graph
[legend]

Classes

struct  Impl
 

Public Member Functions

void initialize () override
 Called to initialize the Object. More...
 
void update (clock::time_point t, size_t) override
 Called by Updateable::updateAll to increment the frame counter. More...
 
GLuint updateTexture (size_t frame_number, Eye eye) override
 Updates the texture and returns the ID of the associated GL texture object. More...
 
void setFile (std::filesystem::path file)
 Set the file to read image data from. More...
 
std::filesystem::path getFile ()
 Returns the currently set file path or pattern. More...
 
void setRange (gmCore::size2 range)
 Sets the range (inclusive) of frames to read. More...
 
void setAutoRange (bool on)
 Activates auto range, with which the range of images is guessed based on the available files with the specified name pattern. More...
 
void setLoop (bool on)
 Activates or deactivates looping the animation. More...
 
void setLogProgress (bool on)
 Activates or deactivates logging progress information. More...
 
void setExit (bool on)
 Activates or deactivates automatic exit when the specified range has been covered. More...
 
- Public Member Functions inherited from gramods::gmGraphics::Texture
virtual std::string getDefaultKey () override
 Returns the default key, in Configuration, for the Object. More...
 
- Public Member Functions inherited from gramods::gmCore::Object
 Object ()
 Initializes internal data. More...
 
virtual ~Object ()
 Cleaning up internal data. More...
 
virtual void accept (Visitor *visitor)
 Calls the visitors apply method with this as argument. More...
 
virtual void traverse (Visitor *visitor)
 Calls the child Object's accept method, if such exist. More...
 
bool isInitialized ()
 Returns true if the Object is initialized. More...
 
- Public Member Functions inherited from gramods::gmCore::Updateable
 Updateable (int priority=0)
 Configures the Updateable properties to the specified priority. More...
 

Static Public Attributes

static gramods::gmCore::OFactory::OFactoryInformation _gm_ofi
 

Additional Inherited Members

- Public Types inherited from gramods::gmCore::Updateable
typedef std::chrono::steady_clock clock
 
- Static Public Member Functions inherited from gramods::gmCore::Updateable
static void updateAll (clock::time_point t=clock::now(), std::optional< size_t > frame=std::nullopt)
 Updates all currently instanciated updateable objects. More...
 

Detailed Description

The ImageTexture reads image data from a specified file to populate its texture data.

Member Function Documentation

◆ getFile()

std::filesystem::path gramods::gmGraphics::ImageTexture::getFile ( )

Returns the currently set file path or pattern.

◆ initialize()

void gramods::gmGraphics::ImageTexture::initialize ( )
overridevirtual

Called to initialize the Object.

This should be called once only!

Sub classes should override this method to make use of set parameter data. They should also always call its base class' implementation as well.

Reimplemented from gramods::gmCore::Object.

◆ setAutoRange()

void gramods::gmGraphics::ImageTexture::setAutoRange ( bool  on)

Activates auto range, with which the range of images is guessed based on the available files with the specified name pattern.

◆ setExit()

void gramods::gmGraphics::ImageTexture::setExit ( bool  on)

Activates or deactivates automatic exit when the specified range has been covered.

Default is false. Loop has to be false for this to work.

XML-attribute: exit

◆ setFile()

void gramods::gmGraphics::ImageTexture::setFile ( std::filesystem::path  file)

Set the file to read image data from.

If a sequence of image files should be read, set this as a fprint formatted template and use setRange to specify the range. For example if file is set to "image_%05d.png" and range is set to 1-199, then images from "image_00000.png" to "image_00199.png" will be read.

XML-attribute: file

◆ setLogProgress()

void gramods::gmGraphics::ImageTexture::setLogProgress ( bool  on)

Activates or deactivates logging progress information.

Default is false.

XML-attribute: logProgress

◆ setLoop()

void gramods::gmGraphics::ImageTexture::setLoop ( bool  on)

Activates or deactivates looping the animation.

Default is false.

XML-attribute: loop

◆ setRange()

void gramods::gmGraphics::ImageTexture::setRange ( gmCore::size2  range)

Sets the range (inclusive) of frames to read.

This assumes that the file name specified with setFile is a printf formatted template.

XML-attribute: range

◆ update()

void gramods::gmGraphics::ImageTexture::update ( clock::time_point  t,
size_t   
)
overridevirtual

Called by Updateable::updateAll to increment the frame counter.

Implements gramods::gmCore::Updateable.

◆ updateTexture()

GLuint gramods::gmGraphics::ImageTexture::updateTexture ( size_t  frame_number,
Eye  eye 
)
overridevirtual

Updates the texture and returns the ID of the associated GL texture object.

Must be called with GL context. Observe also that this method may perform off-screen rendering.

Parameters
frame_numberThe current frame being rendered. This number should increment by one for each frame, however it may wrap around and start over at zero.
eyeEye for which the texture is requested. An implementation may use different textures for different eyes or may reuse the same texture for all eyes.
Returns
OpenGL texture ID of the updated texture

Implements gramods::gmGraphics::TextureInterface.


The documentation for this class was generated from the following files: