gramods
|
The ImageTexture reads image data from a specified file to populate its texture data. More...
#include <ImageTexture.hh>
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... | |
![]() | |
virtual std::string | getDefaultKey () override |
Returns the default key, in Configuration, for the Object. More... | |
![]() | |
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... | |
![]() | |
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 | |
![]() | |
typedef std::chrono::steady_clock | clock |
![]() | |
static void | updateAll (clock::time_point t=clock::now(), std::optional< size_t > frame=std::nullopt) |
Updates all currently instanciated updateable objects. More... | |
The ImageTexture reads image data from a specified file to populate its texture data.
std::filesystem::path gramods::gmGraphics::ImageTexture::getFile | ( | ) |
Returns the currently set file path or pattern.
|
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.
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.
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
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
void gramods::gmGraphics::ImageTexture::setLogProgress | ( | bool | on | ) |
void gramods::gmGraphics::ImageTexture::setLoop | ( | bool | on | ) |
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
|
overridevirtual |
Called by Updateable::updateAll to increment the frame counter.
Implements gramods::gmCore::Updateable.
|
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.
frame_number | The current frame being rendered. This number should increment by one for each frame, however it may wrap around and start over at zero. |
eye | Eye for which the texture is requested. An implementation may use different textures for different eyes or may reuse the same texture for all eyes. |
Implements gramods::gmGraphics::TextureInterface.