MiltonApp Class Reference

Main entrypoint for Qt-based frontend which comes bundled with Milton (including a non-graphical 'nox' mode for remote / batch rendering). More...

#include <MiltonApp.h>

List of all members.

Miscellaneous

virtual void printUsage (int argc=0, char **argv=NULL, const char *errorMsg=NULL)
 Prints an explanation of MiltonApp commandline usage to stderr via std::cerr, including an optional error message.
virtual bool _initializeParams (int argc, char **argv, MiltonParams &params)
 Fills in params by parsing commandline arguments.
virtual RenderOutput_getOutput (MiltonParams &params)

Public Member Functions

Constructors
 MiltonApp (int argc, char **argv, const std::string &title="Milton Renderer", bool enableGui=true)
 Constructs a MiltonApp from the commandline parameters given.
virtual ~MiltonApp ()
Initialization
virtual bool loadCommandlineParams ()
 Loads / initializes canvases and renderer jobs specified on the commandline (which was given to MiltonApp's constructor).
virtual void addCanvas (Canvas *canvas, const std::string &name="")
 Adds the given canvas to this MiltonApp, optionally specifying its subwindow's title name.
virtual void addRenderer (Renderer *renderer)
 Adds a non-graphical render job to this MiltonApp, whose render method will be called in a new thread upon calling MiltonApp's exec.
Main usage interface
virtual bool exec ()
 Enters Milton's main rendering loop, blocking the calling thread until it completes. If Gui mode is enabled, this will initiate any non-deferred renders and enter the underlying QApplication's main loop (renders may be deferred via the -pause commandline flag, in which case you must hit 'render' in the Gui to initiate rendering). If Gui mode is disabled, this will begin rendering all batch jobs which have been added to this app, either implicitly via the commandline or explicitly via addRenderer.
Accessors
bool isGuiEnabled () const
virtual MiltonParamsgetParams ()
virtual const MiltonParamsgetParams () const
virtual GuigetGui ()
virtual const GuigetGui () const
virtual QApplication * getQApplication ()
virtual const QApplication * getQApplication () const
virtual RendererList & getRenderers ()
virtual const RendererList & getRenderers () const
virtual CanvasList & getCanvases ()
virtual const CanvasList & getCanvases () const

Protected Attributes

MiltonParams m_params
std::string m_title
RendererList m_renderers
CanvasList m_canvases
QApplication * m_qApplication
Guim_gui


Detailed Description

Main entrypoint for Qt-based frontend which comes bundled with Milton (including a non-graphical 'nox' mode for remote / batch rendering).

Author:
Travis Fischer (fisch0920@gmail.com)

Matthew Jacobs (jacobs.mh@gmail.com)

Date:
Fall 2008
Note:
MiltonApp constructs an underlying QApplication, which must be initialized before any other Qt user-interface objects are created. For this reason, initializing MiltonApp should generally be at the very beginning of your program's mainline.

MiltonApp is a singleton class and is only meant to be instantiated once per program (generally the first line of main)

Definition at line 36 of file MiltonApp.h.


Constructor & Destructor Documentation

MiltonApp::MiltonApp ( int  argc,
char **  argv,
const std::string &  title = "Milton Renderer",
bool  enableGui = true 
)

Constructs a MiltonApp from the commandline parameters given.

Parameters:
title denotes the main titlebar of the Gui when it is enabled
enableGui denotes whether or not to default to having a Qt Gui (enableGui may be overridden via the '-nox' commandline flag which indicates a strict non-graphical mode)
Note:
Gui mode may be disabled implicitly if the current environment or platform does not support QtGui or graphics in general (eg. no X-server)

Definition at line 34 of file MiltonApp.cpp.

MiltonApp::~MiltonApp (  )  [virtual]

Definition at line 58 of file MiltonApp.cpp.


Member Function Documentation

bool MiltonApp::loadCommandlineParams (  )  [virtual]

Loads / initializes canvases and renderer jobs specified on the commandline (which was given to MiltonApp's constructor).

Note:
Invoking this method is completely optional and only provided for convenience; a MiltonApp can disregard its commandline input and construct a single OpenGLCanvas, for example, and still utilize the underlying Milton framework without actually rendering anything.
Returns:
whether or not initialization was successful (will fail if commandline contained invalid arguments or if a scenefile that was specified fails to load)

Definition at line 76 of file MiltonApp.cpp.

void MiltonApp::addCanvas ( Canvas canvas,
const std::string &  name = "" 
) [virtual]

Adds the given canvas to this MiltonApp, optionally specifying its subwindow's title name.

Definition at line 154 of file MiltonApp.cpp.

void MiltonApp::addRenderer ( Renderer renderer  )  [virtual]

Adds a non-graphical render job to this MiltonApp, whose render method will be called in a new thread upon calling MiltonApp's exec.

Definition at line 170 of file MiltonApp.cpp.

bool MiltonApp::exec (  )  [virtual]

Enters Milton's main rendering loop, blocking the calling thread until it completes. If Gui mode is enabled, this will initiate any non-deferred renders and enter the underlying QApplication's main loop (renders may be deferred via the -pause commandline flag, in which case you must hit 'render' in the Gui to initiate rendering). If Gui mode is disabled, this will begin rendering all batch jobs which have been added to this app, either implicitly via the commandline or explicitly via addRenderer.

Note:
If Gui mode is disabled, the -pause commandline flag has no effect, and all renders are initiated right away upon entering exec

exec blocks the calling thread until execution completes

Returns:
whether or not execution was successful
See also:
isGuiEnabled

Definition at line 177 of file MiltonApp.cpp.

bool MiltonApp::isGuiEnabled (  )  const [inline]

Returns:
whether or not the Qt frontend and connection to the underlying X-server is enabled
Note:
Gui mode will be disabled if the underlying runtime environment doesn't support Qt graphics or if the '-nox' flag was passed to MiltonApp via the commandline

Definition at line 140 of file MiltonApp.h.

virtual MiltonParams& MiltonApp::getParams (  )  [inline, virtual]

Returns:
the underlying parameters used by loadCommandlineParams to parse and load scenefiles

Definition at line 148 of file MiltonApp.h.

virtual const MiltonParams& MiltonApp::getParams (  )  const [inline, virtual]

Returns:
the underlying parameters used by loadCommandlineParams to parse and load scenefiles

Definition at line 156 of file MiltonApp.h.

virtual Gui* MiltonApp::getGui (  )  [inline, virtual]

Returns:
the underlying Qt Gui (for convenience only)

Definition at line 163 of file MiltonApp.h.

virtual const Gui* MiltonApp::getGui (  )  const [inline, virtual]

Returns:
the underlying Qt Gui (for convenience only)

Definition at line 170 of file MiltonApp.h.

virtual QApplication* MiltonApp::getQApplication (  )  [inline, virtual]

Returns:
the underlying Qt QApplication (for convenience only)

Definition at line 177 of file MiltonApp.h.

virtual const QApplication* MiltonApp::getQApplication (  )  const [inline, virtual]

Returns:
the underlying Qt QApplication (for convenience only)

Definition at line 184 of file MiltonApp.h.

virtual RendererList& MiltonApp::getRenderers (  )  [inline, virtual]

Returns:
an std::vector of non-graphical renderer jobs which have been added to this MiltonApp via addRenderer

Definition at line 192 of file MiltonApp.h.

virtual const RendererList& MiltonApp::getRenderers (  )  const [inline, virtual]

Returns:
an std::vector of non-graphical renderer jobs which have been added to this MiltonApp via addRenderer

Definition at line 200 of file MiltonApp.h.

virtual CanvasList& MiltonApp::getCanvases (  )  [inline, virtual]

Returns:
an std::vector of Canvases which have been added to this MiltonApp via addCanvas

Definition at line 208 of file MiltonApp.h.

virtual const CanvasList& MiltonApp::getCanvases (  )  const [inline, virtual]

Returns:
an std::vector of Canvases which have been added to this MiltonApp via addCanvas

Definition at line 216 of file MiltonApp.h.

void MiltonApp::printUsage ( int  argc = 0,
char **  argv = NULL,
const char *  errorMsg = NULL 
) [virtual]

Prints an explanation of MiltonApp commandline usage to stderr via std::cerr, including an optional error message.

Definition at line 214 of file MiltonApp.cpp.

bool MiltonApp::_initializeParams ( int  argc,
char **  argv,
MiltonParams params 
) [protected, virtual]

Fills in params by parsing commandline arguments.

Returns:
whether or not parsing was successful

Definition at line 255 of file MiltonApp.cpp.

RenderOutput * MiltonApp::_getOutput ( MiltonParams params  )  [protected, virtual]

Returns:
RenderOutput parsed from params.output

Definition at line 332 of file MiltonApp.cpp.


Member Data Documentation

Definition at line 252 of file MiltonApp.h.

std::string MiltonApp::m_title [protected]

Definition at line 253 of file MiltonApp.h.

RendererList MiltonApp::m_renderers [protected]

Definition at line 255 of file MiltonApp.h.

CanvasList MiltonApp::m_canvases [protected]

Definition at line 256 of file MiltonApp.h.

QApplication* MiltonApp::m_qApplication [protected]

Definition at line 258 of file MiltonApp.h.

Gui* MiltonApp::m_gui [protected]

Definition at line 259 of file MiltonApp.h.


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

Generated on 28 Feb 2009 for Milton by doxygen 1.5.6