![]() |
Radium Engine
1.5.0
|
#include <Headless/CLIViewer.hpp>
Public Member Functions | |
const Engine::RadiumEngine * | getEngine () const |
To have the same API to access Engine than in Qt based application. | |
CLIViewer (std::unique_ptr< OpenGLContext > context) | |
Construct the viewer using an OpenGL context of the given version. More... | |
virtual | ~CLIViewer () |
Base destructor. | |
int | init (int argc, const char *argv[]) override |
Application initialization method. More... | |
int | oneFrame (float timeStep=1.f/60.f) |
void | setRenderer (Ra::Engine::Rendering::Renderer *renderer) |
void | addDataFileLoader (Ra::Core::Asset::FileLoaderInterface *loader) |
void | loadScene () |
void | compileScene () |
void | openGlAddOns (std::function< void()> f) |
void | bindOpenGLContext (bool on=true) |
void | setCamera (Ra::Core::Utils::Index camIdx=0) |
void | setImageNamePrefix (std::string s) |
const ViewerParameters & | getCommandLineParameters () const |
std::unique_ptr< unsigned char[]> | grabFrame (size_t &w, size_t &h) const |
void | showWindow (bool on=true, OpenGLContext::EventMode mode=OpenGLContext::EventMode::POLL, float delay=1.f/60.f) |
OpenGLContext & | getWindow () |
Gives access to the window to add event processing callbacks. More... | |
void | renderLoop (std::function< void(float)> render) |
std::string | getDataFileName () const |
void | setDataFileName (std::string filename) |
![]() | |
CLIBaseApplication ()=default | |
Base constructor. | |
virtual | ~CLIBaseApplication ()=default |
Base destructor. | |
template<typename... Args> | |
CLI::Option * | addOption (Args &&... args) |
template<typename... Args> | |
CLI::Option * | addFlag (Args &&... args) |
Public Attributes | |
Ra::Engine::RadiumEngine * | m_engine |
Instance of the radium engine. | |
Protected Member Functions | |
void | resize (int width, int height) |
Observer of the resize event on the OpenGLContext. | |
Additional Inherited Members | |
![]() | |
CLI::App | m_cmdLineParser |
Base class for radium based cmdline application.
This is the Headless pendant of the Ra::Gui::Viewer class, with only a very little interaction capabilities.
Definition at line 34 of file CLIViewer.hpp.
|
explicit |
Construct the viewer using an OpenGL context of the given version.
glVersion |
Definition at line 23 of file CLIViewer.cpp.
void Ra::Headless::CLIViewer::addDataFileLoader | ( | Ra::Core::Asset::FileLoaderInterface * | loader | ) |
Add a data loader to the engine
Definition at line 129 of file CLIViewer.cpp.
void Ra::Headless::CLIViewer::bindOpenGLContext | ( | bool | on = true | ) |
Activate/deactivate the OpenGL context
Definition at line 156 of file CLIViewer.cpp.
void Ra::Headless::CLIViewer::compileScene | ( | ) |
Instantiate the scene and prepare the rendering. This method prepare all render techniques for the active renderer.
Definition at line 137 of file CLIViewer.cpp.
const CLIViewer::ViewerParameters & Ra::Headless::CLIViewer::getCommandLineParameters | ( | ) | const |
Get the current viewer command line parameters parameters
Definition at line 42 of file CLIViewer.cpp.
|
inline |
Get the filename given using the option –file <filename> or -f <filename>
Definition at line 185 of file CLIViewer.hpp.
|
inline |
Gives access to the window to add event processing callbacks.
example :
Definition at line 193 of file CLIViewer.hpp.
std::unique_ptr< unsigned char[]> Ra::Headless::CLIViewer::grabFrame | ( | size_t & | w, |
size_t & | h | ||
) | const |
grab the last rendered frame
Definition at line 116 of file CLIViewer.cpp.
|
overridevirtual |
Application initialization method.
This method is called by the main function to initialize the app giving its parameters.
argc | number of parameter |
argv | array of string representing the parameters |
Supported command line parameters are –help and –file <filename> from CLIRadiumApplication and the following parameters :
Reimplemented from Ra::Headless::CLIBaseApplication.
Definition at line 46 of file CLIViewer.cpp.
void Ra::Headless::CLIViewer::loadScene | ( | ) |
Loads the scene from the datafile given at the command line or set using setDataFileName using the available loader (if any).
Definition at line 133 of file CLIViewer.cpp.
int Ra::Headless::CLIViewer::oneFrame | ( | float | timeStep = 1.f / 60.f | ) |
Render one frame of the scene attached to the engine for the given time stamp.
Definition at line 94 of file CLIViewer.cpp.
void Ra::Headless::CLIViewer::openGlAddOns | ( | std::function< void()> | f | ) |
Register OpenGL addons The given functor will be called with the OpenGL context bound
Definition at line 150 of file CLIViewer.cpp.
void Ra::Headless::CLIViewer::renderLoop | ( | std::function< void(float)> | render | ) |
If a window is shown, launch the interactive render loop
Definition at line 205 of file CLIViewer.cpp.
void Ra::Headless::CLIViewer::setCamera | ( | Ra::Core::Utils::Index | camIdx = 0 | ) |
Define the cq;erq to be used for rendering. This method set the camera either using default camera or using the first one (at index 0) from the engine's camera manager and
Definition at line 161 of file CLIViewer.cpp.
|
inline |
Set the filename given using the option –file <filename> or -f <filename>
Definition at line 189 of file CLIViewer.hpp.
void Ra::Headless::CLIViewer::setImageNamePrefix | ( | std::string | s | ) |
Set the image prefix ("frame" by default)
Definition at line 192 of file CLIViewer.cpp.
void Ra::Headless::CLIViewer::setRenderer | ( | Ra::Engine::Rendering::Renderer * | renderer | ) |
Set the renderer to use to compute an image The app takes ownership of the give pointer.
Definition at line 120 of file CLIViewer.cpp.
void Ra::Headless::CLIViewer::showWindow | ( | bool | on = true , |
OpenGLContext::EventMode | mode = OpenGLContext::EventMode::POLL , |
||
float | delay = 1.f / 60.f |
||
) |
show/hide the opengl window
Definition at line 196 of file CLIViewer.cpp.