2 #include <Headless/CLIBaseApplication.hpp>
3 #include <Headless/OpenGLContext/OpenGLContext.hpp>
5 #include <Core/Utils/Index.hpp>
9 #include <glbinding/Version.h>
14 class FileLoaderInterface;
37 struct ViewerParameters {
39 bool m_animationEnable {
false };
41 std::array<int, 2> m_size { { 512, 512 } };
43 std::string m_imgPrefix {
"frame" };
45 std::string m_dataFile = {
"" };
57 std::unique_ptr<OpenGLContext> m_glContext;
60 std::shared_ptr<Ra::Engine::Rendering::Renderer> m_renderer;
66 ViewerParameters m_parameters;
69 bool m_engineInitialized {
false };
72 bool m_exposedWindow {
false };
79 explicit CLIViewer( std::unique_ptr<OpenGLContext> context );
98 int init(
int argc,
const char* argv[] )
override;
107 int oneFrame(
float timeStep = 1.f / 60.f );
118 void addDataFileLoader( Ra::Core::Asset::FileLoaderInterface* loader );
134 void openGlAddOns( std::function<
void()> f );
137 void bindOpenGLContext(
bool on =
true );
142 void setCamera( Ra::Core::Utils::Index camIdx = 0 );
145 void setImageNamePrefix( std::string s );
148 const ViewerParameters& getCommandLineParameters()
const;
151 std::unique_ptr<unsigned char[]> grabFrame(
size_t& w,
size_t& h )
const;
154 void showWindow(
bool on =
true,
156 float delay = 1.f / 60.f );
165 inline OpenGLContext& getWindow();
168 void renderLoop( std::function<
void(
float )> render );
173 inline std::string getDataFileName()
const;
178 inline void setDataFileName( std::string filename );
182 void resize(
int width,
int height );
186 return m_parameters.m_dataFile;
190 m_parameters.m_dataFile = std::move( filename );
Camera class storing the Camera frame and the projection properties The view direction is -z in camer...
const Engine::RadiumEngine * getEngine() const
To have the same API to access Engine than in Qt based application.
Ra::Engine::RadiumEngine * m_engine
Instance of the radium engine.
std::string getDataFileName() const
void setDataFileName(std::string filename)
OpenGLContext & getWindow()
Gives access to the window to add event processing callbacks.