class RFK::TutorialApplication
This class defines a set of functions to quickly build RED-based applications. More...
#include <RFKTutorialApplication.h>
Public static functions:
static RED_RC | AddCommand ( int iUIID, int iCommandID ) |
static RED_RC | AddFrameTracingImages ( RED::Object * iColorImage, RED::Object * iDepthImage, RED::Object * iViewpoint ) |
static RED_RC | AddMenu ( int & oUIID, const RED::String & iLabel, int iParentID = -1 ) |
static RED_RC | AddSeparator ( int iUIID ) |
static RED_RC | AddStringsMap ( const RED::Map< unsigned int, RED::String > & iStringsMap ) |
static RED_RC | AddToolBar ( int & oUIID, const RED::String & iLabel ) |
static CHOICE | Ask ( const RED::String & iQuestion ) |
static RED_RC | ClearFrameTracingImages ( ) |
static RED_RC | Close ( int iCommand = 0 ) |
static RED_RC | CreateCommand ( int & oCommandID, const RED::String & iDescription, const RED::String & iIconPath, const RED::String & iShortCut, RFK::COMMAND_CALLBACK iDo, RFK::COMMAND_CALLBACK iUndo = NULL, int iFlags = 0 ) |
static RED_RC | DeleteCommand ( int iCommandID ) |
static void | DisplayError ( RED_RC iRC, const char * iCaller, const void * iObject, const char * iExpression, const char * iInfo ) |
static void | DisplayError ( RED_RC iRC, const char * iFile, int iLine ) |
static void | DisplayError ( const RED::String & iHeader, const RED::String & iMessage ) |
static void | DisplayMessage ( const RED::String & iHeader, const RED::String & iMessage ) |
static void | EnableUI ( bool iEnabled ) |
static int | GetCommandState ( int iCommandID ) |
static void | GetContentPosition ( int & oTop, int & oLeft ) |
static void | GetContentSize ( int & oWidth, int & oHeight ) |
static RED::String | GetCurrentExecutablePath ( ) |
static RFK::EVENT_CALLBACK | GetEventCallback ( RFK::EVENT iEvent, void ** iParam = NULL ) |
static RED::String | GetFilePath ( const RED::String & iExtensions ) |
static RED_RC | GetInspectedObject ( RED::Object *& oObject, RFK::INSPECTOR iInspector ) |
static LOOP_MODE | GetLoopMode ( ) |
static void | GetMouseCursorPosition ( int & oX, int & oY ) |
static const RED::Vector< RED::String > & | GetRecentFiles ( ) |
static float | GetREDTimeElapsed ( ) |
static RED::Object * | GetResourceManager ( ) |
static RED::String | GetStringFromID ( unsigned int iID ) |
static const RED::Map< unsigned int, RED::String > & | GetStringsMap ( ) |
static float | GetTime ( ) |
static void | GetUserVariables ( RED::Vector< RFK::UserVariable > & oUserVariables ) |
static RED::Object * | GetViewpoint ( ) |
static RED::Object * | GetWindow ( ) |
static void | HideInspector ( RFK::INSPECTOR iInspector ) |
static void | HideMouseCursor ( ) |
static RED_RC | Invalidate ( ) |
static bool | IsInspectorVisible ( RFK::INSPECTOR iInspector ) |
static RED_RC | LoadFBXFile ( RED::Object *& oCamera, unsigned int & oDataContext, const RED::String & iPath, const RED::LayerSet * iRealTimeLayerSet, const RED::LayerSet * iPhotorealisticLayerSet ) |
static RED_RC | LoadREDFile ( RED::Object *& oCamera, unsigned int & oDataContext, RED::FileInfo * oFileInfo, const RED::String & iPath, RED::StreamingPolicy * iPolicy = NULL ) |
static int | MainLoop ( const RED::String & iTitle, RFK::LOOP_MODE iLoopMode = RFK::LM_PASSIVE, double iFeedbackInterval = 500.0, RED::WindowRenderInfo * iWindowRenderInfo = NULL, bool iUseHybridREDsdk = true ) |
static RED_RC | OpenFileDialog ( RED::Vector< RED::String > & oFilesList, const RED::String & iCaption, const RED::String & iDirectory, const RED::String & iFilter ) |
static RED_RC | OpenURL ( const RED::String & iURL ) |
static RED_RC | Redraw ( ) |
static RED_RC | RefreshInspector ( RFK::INSPECTOR iInspector ) |
static RED_RC | RemoveCommand ( int iCommandID, int iUIID = -1 ) |
static RED_RC | RemoveFrameTracingImages ( RED::Object * iColorImage, RED::Object * iDepthImage, RED::Object * iViewpoint ) |
static RED_RC | RemoveUIComponent ( int iUIID ) |
static void | ResizeWindow ( int iWidth, int iHeight ) |
static RED_RC | RunCommand ( int iCommandID ) |
static RED_RC | SaveContent ( const RED::String & iFile ) |
static bool | SaveImageStamp ( const RED::String & iFilePath, unsigned char * iRGBA, int iWidth, int iHeight, RED::String iText ) |
static RED_RC | SendEvent ( RFK::EVENT iEvent, RFK::EventInfo & iEventInfo ) |
static RED_RC | SetBackgroundColor ( const RED::Color & iColor ) |
static void | SetCommandState ( int iCommandID, int iFlags ) |
static void | SetCustomLicense ( const RED::String & iLicenseKey, unsigned int iCustomerID ) |
static void | SetEventCallback ( RFK::EVENT iEvent, RFK::EVENT_CALLBACK iCallback, void * iParam = NULL ) |
static RED_RC | SetInspectedObject ( RFK::INSPECTOR iInspector, RED::Object * iObject, const RED::Map< unsigned int, RED::String > * iIDToNames = NULL ) |
static RED_RC | SetLoopMode ( RFK::LOOP_MODE iLoopMode ) |
static void | SetMessage ( const RED::String & iMessage ) |
static void | SetMouseCursorPosition ( int iX, int iY ) |
static RED_RC | SetRecentFiles ( const RED::Vector< RED::String > & iRecentFiles ) |
static RED_RC | SetSelectedItem ( RFK::INSPECTOR iInspector, const RED::ShapePath & iItem ) |
static RED_RC | SetUserVariables ( const RED::Vector< RFK::UserVariable > & iUserVariables ) |
static RED_RC | SetViewpoint ( RED::Object * iViewpoint ) |
static void | ShowFPS ( bool iShow ) |
static RED_RC | ShowInspector ( RFK::INSPECTOR iInspector, RED::Object * iObject = NULL, bool iClosable = true, const RED::Map< unsigned int, RED::String > * iIDToNames = NULL ) |
static void | ShowMouseCursor ( ) |
static void | ShowProgressBar ( bool iShow ) |
static void | ShowResolution ( bool iShow ) |
static RED_RC | ShowSystemInformation ( int iCommand = 0 ) |
static RED_RC | StopFrameTracingIfNeeded ( ) |
static RED_RC | TakeSnapshot ( int iCommand = 0 ) |
static void | UpdateFPSCounter ( float iFrameTime ) |
static void | UpdateProgressBar ( float iValue, bool iForceRefresh = false ) |
static void | UpdateUserVariable ( const RFK::UserVariable & iUserVariable ) |
static void | UpdateUserVariables ( const RED::Vector< RFK::UserVariable > & iUserVariables ) |
Detailed description:
This class defines a set of functions to quickly build RED-based applications.
This class is the entry point of most of the Redsdk tutorials as it provides packed and easy accesses to modern UI, cross-platform applications. You can use it to quickly prototype your own concepts in a very short time.
The framework owns the application main loop and automatically handles every UI and interaction events. The user has just to register custom callbacks on the events he wants to hear about. He also can customize the application look and functionalities by creating UI components and application commands.
Creating an application with the framework usually starts with the registration of one or several callbacks and then a call to RFK::TutorialApplication::MainLoop:
// Set the program callbacks.
RFK::TutorialApplication::SetEventCallback( RFK::EVT_INIT, OnInit );
RFK::TutorialApplication::SetEventCallback( RFK::EVT_MOUSE, DefaultOnMouse );
// Run the application.
return RFK::TutorialApplication::MainLoop( "Tutorial - First application" );
In the code above, the OnInit callback is called once the application is ready to enter its message loop while the OnMouse callback gets called on every user mouse interaction. It's then up to the developer to decide what actions to perform on each event.
Additionaly, commands can be created and registered to the application. Those appear as toolbar buttons and/or menu entries depending on where the user insert them.
Finally high-level UI components are provided for convenience like a geometry inspector or a customizable variables editor.
See the First App tutorial for a simple illustration of using the RFK::TutorialApplication.
Functions documentation
public static RED_RC RFK::TutorialApplication::AddCommand | ( | int | iUIID, |
int | iCommandID | ||
) |
Adds a command to a UI component.
The new command is added at the end of the already existing UI component commands. The same command can't be added twice to the same UI component.
Parameters:
iUIID | ID of the UI component to which the command must be added. |
iCommandID | ID of the command to add. |
Returns:
public static RED_RC RFK::TutorialApplication::AddFrameTracingImages | ( | RED::Object * | iColorImage, |
RED::Object * | iDepthImage, | ||
RED::Object * | iViewpoint | ||
) |
Adds images and viewpoint to use during a RED::IWindow::FrameTracingImages.
When the RFK::LOOP_MODE is software (i.e. RFK::LM_SOFTWARE_BY_BLOCKS, RFK::LM_SOFTWARE_BY_SURFACE or RFK::LM_SOFTWARE_PATH_TRACING) the framework loop normally calls the RED::IWindow::FrameTracing function. After calling this function, the loop call is replaced by RED::IWindow::FrameTracingImages. This allows for instance to apply post processes on the images. See the page A tone mapping only rendering loop.
Two 2D images created by RED::IResourceManager::CreateImage2D must be supplied. Each image must be empty at the time of the call or set with a RED::TGT_TEX_RECT target.
Parameters:
iColorImage | the image to fill with the color result. |
iDepthImage | the image to fill with the depth result. |
iViewpoint | the viewpoint for which raw images are requested. |
Returns:
public static RED_RC RFK::TutorialApplication::AddMenu | ( | int & | oUIID, |
const RED::String & | iLabel, | ||
int | iParentID = -1 | ||
) |
Adds a new menu to the application.
A menu can be added only after a call to MainLoop. To do so, you can set the application layout from within a user-defined callback set on the EVT_INIT event.
A menu can be added to another menu and then becomes a sub-menu. You can do that by specifying the UI component ID of the menu parent. This ID must be a valid menu ID (obtained from a previous call to AddMenu) or -1 otherwise an error is returned.
Parameters:
oUIID | the returned ID of the menu on success. |
iLabel | label of the menu. |
iParentID | UI component ID of the menu parent for a sub-menu (optional; default is -1 for no parent, meaning a root menu displayed in the menu bar). |
Returns:
public static RED_RC RFK::TutorialApplication::AddSeparator | ( | int | iUIID | ) |
public static RED_RC RFK::TutorialApplication::AddStringsMap | ( | const RED::Map< unsigned int, RED::String > & | iStringsMap | ) |
Adds a map of correspondence between RED::Object IDs and strings.
This will be used by the inspector to display a name for each known RED::Object.
Parameters:
iStringsMap | map of correspondence between RED::Object IDs and strings. |
Returns:
public static RED_RC RFK::TutorialApplication::AddToolBar | ( | int & | oUIID, |
const RED::String & | iLabel | ||
) |
Adds a new toolbar to the application.
A toolbar can be added only after a call to MainLoop. To do so, you can set the application layout from within a user-defined callback set on the EVT_INIT event.
Parameters:
oUIID | the returned ID of the toolbar on success. |
iLabel | label of the toolbar. |
Returns:
public static CHOICE RFK::TutorialApplication::Ask | ( | const RED::String & | iQuestion | ) |
Opens a Yes/No dialog with the given text.
Parameters:
iQuestion | the text to display. |
Returns:
public static RED_RC RFK::TutorialApplication::ClearFrameTracingImages | ( | ) |
Removes all the images and viewpoint used during a RED::IWindow::FrameTracingImages.
See RFK::TutorialApplication::AddFrameTracingImages for more details about the frame tracing images.
Returns:
public static RED_RC RFK::TutorialApplication::Close | ( | int | iCommand = 0 | ) |
public static RED_RC RFK::TutorialApplication::CreateCommand | ( | int & | oCommandID, |
const RED::String & | iDescription, | ||
const RED::String & | iIconPath, | ||
const RED::String & | iShortCut, | ||
RFK::COMMAND_CALLBACK | iDo, | ||
RFK::COMMAND_CALLBACK | iUndo = NULL, | ||
int | iFlags = 0 | ||
) |
Creates a command to be added to a UI component (toolbar, menu...).
A command can be created only after a call to MainLoop. To do so, you can create your commands from within a user-defined callback set on the EVT_INIT event.
Parameters:
oCommandID | the returned command ID on success. |
iDescription | of the command. |
iIconPath | path to the command icon file (can be PNG or JPG). |
iShortCut | command shortcut (e.g "CTRL+O") or empty string if no shortcut. |
iDo | callback called on command activation. |
iUndo | optional callback called on command undo. |
iFlags | bitwise combination of command flags. The 16 leftmost bits are reserved to store the ID of a command group (if different from 0). All the checkable commands (CMD_FLAG_CHECKABLE flag set) belonging to the same command group are mutually exclusive, meaning that only one of the group commands can be checked at a given time. |
Returns:
public static RED_RC RFK::TutorialApplication::DeleteCommand | ( | int | iCommandID | ) |
public static void RFK::TutorialApplication::DisplayError | ( | RED_RC | iRC, |
const char * | iCaller, | ||
const void * | iObject, | ||
const char * | iExpression, | ||
const char * | iInfo | ||
) |
Displays a message box describing a RED_RC with its code location.
This method is aimed to be called after the RED error callback: RED::REDSDK_ERROR_CALLBACK. This callback can be set with RED::IResourceManager::SetErrorCallback.
Once the message box is closed by the user, the application exits immediately.
Parameters:
iRC | Error code. |
iCaller | Name of the calling method or function. |
iObject | Relevant object address for the error. |
iExpression | Called source expression string. |
iInfo | Extra information string. |
public static void RFK::TutorialApplication::DisplayError | ( | RED_RC | iRC, |
const char * | iFile, | ||
int | iLine | ||
) |
Displays a message box describing a RED_RC with its code location.
Once the message box is closed by the user, the application exits immediately.
Parameters:
iRC | the error code. |
iFile | name of the file where the error occured. |
iLine | line in the file where the error occured. |
public static void RFK::TutorialApplication::DisplayError | ( | const RED::String & | iHeader, |
const RED::String & | iMessage | ||
) |
Displays a message box with an error message.
Once the message box is closed by the user, the application exits immediately.
Parameters:
iHeader: | Title of the message box. |
iMessage: | Message text body. |
public static void RFK::TutorialApplication::DisplayMessage | ( | const RED::String & | iHeader, |
const RED::String & | iMessage | ||
) |
Displays a message box with an error message.
The application resumes after the box is closed by the user.
Parameters:
iHeader: | Title of the message box. |
iMessage: | Message text body. |
public static void RFK::TutorialApplication::EnableUI | ( | bool | iEnabled | ) |
Enables/Disables the UI.
Parameters:
iEnabled | true to enable the UI, false otherwise. |
public static int RFK::TutorialApplication::GetCommandState | ( | int | iCommandID | ) |
Gets the current state of a command as a bitwise combination of command flags.
Parameters:
iCommandID | ID of the command to access. |
Returns:
public static void RFK::TutorialApplication::GetContentPosition | ( | int & | oTop, |
int & | oLeft | ||
) |
Gets the position of the window contents (the 3d viewport).
Parameters:
oTop | output top position. |
oLeft | output left position. |
public static void RFK::TutorialApplication::GetContentSize | ( | int & | oWidth, |
int & | oHeight | ||
) |
Gets the size of the window contents (the 3d viewport).
Parameters:
oWidth | output width. |
oHeight | output height. |
public static RED::String RFK::TutorialApplication::GetCurrentExecutablePath | ( | ) |
Returns:
public static RFK::EVENT_CALLBACK RFK::TutorialApplication::GetEventCallback | ( | RFK::EVENT | iEvent, |
void ** | iParam = NULL | ||
) |
Gets the user callback for the given application event.
Parameters:
iEvent | event to check for. |
iParam | pointer to the optional parameter set to 'iCallback'. |
Returns:
public static RED::String RFK::TutorialApplication::GetFilePath | ( | const RED::String & | iExtensions | ) |
Opens a file dialog and lets the user choose a file of a given extension.
Parameters:
iExtensions | allowed file extensions (can be "Images (*.png *.jpg)" for example to allow the selection of PNG or JPG files). |
Returns:
public static RED_RC RFK::TutorialApplication::GetInspectedObject | ( | RED::Object *& | oObject, |
RFK::INSPECTOR | iInspector | ||
) |
public static LOOP_MODE RFK::TutorialApplication::GetLoopMode | ( | ) |
Returns the loop mode.
Returns:
public static void RFK::TutorialApplication::GetMouseCursorPosition | ( | int & | oX, |
int & | oY | ||
) |
Access the current mouse cursor position. The origin is at the lower left window corner.
Parameters:
oX: | Mouse coordinate. |
oY: | Mouse coordinate. |
public static const RED::Vector< RED::String > & RFK::TutorialApplication::GetRecentFiles | ( | ) |
Returns:
public static float RFK::TutorialApplication::GetREDTimeElapsed | ( | ) |
public static RED::Object * RFK::TutorialApplication::GetResourceManager | ( | ) |
public static RED::String RFK::TutorialApplication::GetStringFromID | ( | unsigned int | iID | ) |
Gets a string from a RED::Object ID.
ID <-> string correspondences are recorded using AddStringsMap.
If the given ID is unknown, the "unknown" string is returned.
Parameters:
iID: | ID of the requested string. |
Returns:
public static const RED::Map< unsigned int, RED::String > & RFK::TutorialApplication::GetStringsMap | ( | ) |
Gets the map of correspondence between RED::Object IDs and strings.
Returns:
public static float RFK::TutorialApplication::GetTime | ( | ) |
Gets the current time in milliseconds.
The time measurement starts on the first call to this method. Then, the method returns, in milliseconds, the total time elapsed since that first call has occurred.
Returns:
public static void RFK::TutorialApplication::GetUserVariables | ( | RED::Vector< RFK::UserVariable > & | oUserVariables | ) |
Gets the list of user variables.
The returned list reflect the latest changes in user variables values.
Parameters:
oUserVariables | the list of user variables. |
public static RED::Object * RFK::TutorialApplication::GetViewpoint | ( | ) |
public static RED::Object * RFK::TutorialApplication::GetWindow | ( | ) |
public static void RFK::TutorialApplication::HideInspector | ( | RFK::INSPECTOR | iInspector | ) |
Hides an inspector.
Parameters:
iInspector | type of the inspector to hide. |
public static void RFK::TutorialApplication::HideMouseCursor | ( | ) |
Hides the mouse cursor.
public static RED_RC RFK::TutorialApplication::Invalidate | ( | ) |
Invalidates the content of the window.
This method needs to be called when changes have been applied to the data and those changes must be taken into account in the next rendering operation.
Prior to calling Redraw, this method closes the current transaction. After the redraw operation of the window, a new transaction is opened.
Returns:
public static bool RFK::TutorialApplication::IsInspectorVisible | ( | RFK::INSPECTOR | iInspector | ) |
Tests if an inspector is visible.
Parameters:
iInspector | type of the inspector to test. |
public static RED_RC RFK::TutorialApplication::LoadFBXFile | ( | RED::Object *& | oCamera, |
unsigned int & | oDataContext, | ||
const RED::String & | iPath, | ||
const RED::LayerSet * | iRealTimeLayerSet, | ||
const RED::LayerSet * | iPhotorealisticLayerSet | ||
) |
Loads a FBX file.
This method loads a FBX file. If at least one camera is found, all the file DAG roots are linked to the returned camera. If no camera is found, oCamera is NULL and the DAG is not linked to any camera.
See Input-Output API if you need to implement your own FBX file loader.
The function loads all the content of a FBX file (RED::IOOT_ALL) and creates generic materials. The system unit is centimeter (RED::IOSU_CM).
Parameters:
oCamera | pointer to the loaded camera. |
oDataContext | value of the context handling the data in the RED::IDataManager . |
iPath | RED file path. |
iRealTimeLayerSet: | Layerset used for real time generic material. |
iPhotorealisticLayerSet: | Layerset used for photorealistic generic material. |
Returns:
public static RED_RC RFK::TutorialApplication::LoadREDFile | ( | RED::Object *& | oCamera, |
unsigned int & | oDataContext, | ||
RED::FileInfo * | oFileInfo, | ||
const RED::String & | iPath, | ||
RED::StreamingPolicy * | iPolicy = NULL | ||
) |
Loads a RED file.
This method loads a RED file. If at least one camera is found, all the file DAG roots are linked to the returned camera. If no camera is found, oCamera is NULL and the DAG is not linked to any camera.
See Loading a .red file if you need to implement your own RED file loader.
If a RED::FileInfo is present in the file, the returned camera is the one with its ID equal to RED::FileInfo::GetDefaultViewID (if it exists; the method fails otherwise). If no RED::FileInfo is present, the camera returned is the first one.
Parameters:
oCamera | pointer to the loaded camera. |
oDataContext | value of the context handling the data in the RED::IDataManager . |
oFileInfo | optional output file info. Can be NULL. |
iPath | RED file path. |
iPolicy: | Optional file streaming policy that can be specified. |
Returns:
public static int RFK::TutorialApplication::MainLoop | ( | const RED::String & | iTitle, |
RFK::LOOP_MODE | iLoopMode = RFK::LM_PASSIVE, | ||
double | iFeedbackInterval = 500.0, | ||
RED::WindowRenderInfo * | iWindowRenderInfo = NULL, | ||
bool | iUseHybridREDsdk = true | ||
) |
Runs the application main loop.
The call exits when the application gets closed.
If the application requires some additional file dependencies, the full list can be passed to the call. Each dependency will be checked and a download operation will be launched for every missing one upon user acceptance. If any dependency is not satisfied (due to user cancellation or download failure), a RFK::EVT_ERROR event is sent but the application still enters the main loop.
It sends a RFK::EVT_INIT event after the initialization and the dependencies check but before entering the loop.
Parameters:
iTitle | title of the application window. |
iLoopMode | loop mode. |
iFeedbackInterval | feedback interval in the case of a software rendering. |
iWindowRenderInfo | optional pointer to the window render info. |
iUseHybridREDsdk: | If true, REDsdk is operated in hybrid mode (see RED::OPTIONS_RAY_ENABLE_SOFT_TRACER). |
Returns:
1 in case of a critical Qt initialization error (no panel popup),
1 in case of a critical error (after an error panel popup),
RED_RC enumeration values cast into (int).
public static RED_RC RFK::TutorialApplication::OpenFileDialog | ( | RED::Vector< RED::String > & | oFilesList, |
const RED::String & | iCaption, | ||
const RED::String & | iDirectory, | ||
const RED::String & | iFilter | ||
) |
Open a file selection dialog.
Parameters:
oFilesList: | List of selected files. |
iCaption: | Information text. |
iDirectory: | Dialog starting directory. |
iFilter: | File selection filter. |
Returns:
public static RED_RC RFK::TutorialApplication::OpenURL | ( | const RED::String & | iURL | ) |
public static RED_RC RFK::TutorialApplication::Redraw | ( | ) |
public static RED_RC RFK::TutorialApplication::RefreshInspector | ( | RFK::INSPECTOR | iInspector | ) |
public static RED_RC RFK::TutorialApplication::RemoveCommand | ( | int | iCommandID, |
int | iUIID = -1 | ||
) |
public static RED_RC RFK::TutorialApplication::RemoveFrameTracingImages | ( | RED::Object * | iColorImage, |
RED::Object * | iDepthImage, | ||
RED::Object * | iViewpoint | ||
) |
Removes images and viewpoint used during a RED::IWindow::FrameTracingImages.
See RFK::TutorialApplication::AddFrameTracingImages for more details about the frame tracing images.
The tuple [color image, depth image, viewpoint] must be the same as the one defined in the previously called RFK::TutorialApplication::AddFrameTracingImages function.
Parameters:
iColorImage | the color image to remove. |
iDepthImage | the depth image to remove. |
iViewpoint | the viewpoint to remove. |
Returns:
public static RED_RC RFK::TutorialApplication::RemoveUIComponent | ( | int | iUIID | ) |
public static void RFK::TutorialApplication::ResizeWindow | ( | int | iWidth, |
int | iHeight | ||
) |
Resizes the window.
Parameters:
iWidth | window width. |
iHeight | window height. |
public static RED_RC RFK::TutorialApplication::RunCommand | ( | int | iCommandID | ) |
public static RED_RC RFK::TutorialApplication::SaveContent | ( | const RED::String & | iFile | ) |
public static bool RFK::TutorialApplication::SaveImageStamp | ( | const RED::String & | iFilePath, |
unsigned char * | iRGBA, | ||
int | iWidth, | ||
int | iHeight, | ||
RED::String | iText | ||
) |
Saves an image with a stamp string written at the bottom of it.
This is used to print important information over an image before saving it. Please, note that this method only works for RGBA encoded images.
Parameters:
iFilePath | the file path of the saved image. |
iRGBA | pointer to pixels in char RGBA format (32bit per pixel). |
iWidth | width of the image. |
iHeight | height of the image. |
iText | string to print over the image. |
public static RED_RC RFK::TutorialApplication::SendEvent | ( | RFK::EVENT | iEvent, |
RFK::EventInfo & | iEventInfo | ||
) |
public static RED_RC RFK::TutorialApplication::SetBackgroundColor | ( | const RED::Color & | iColor | ) |
public static void RFK::TutorialApplication::SetCommandState | ( | int | iCommandID, |
int | iFlags | ||
) |
Sets the current state of a command as a bitwise combination of command flags.
All flags relative to the command should be specified in iFlags, and not only one flag that needs to be modified for instance. For instance a SetCommandState( CMD_FLAG_CHECKED ) will turn on the checked property of the command, but at the same time CMD_FLAG_CHECKABLE should be specified too otherwise the command won't be checkable after the call.
The group of the command can't be modified through this method.
Parameters:
iCommandID: | The ID of the command to modify. |
iFlags: | The bitwise combination of flags that describe the new state of the command. |
public static void RFK::TutorialApplication::SetCustomLicense | ( | const RED::String & | iLicenseKey, |
unsigned int | iCustomerID | ||
) |
Defines a custom license.
When set, this license disables the free license with the 1h limit.
This function must be called before the call to RFK::TutorialApplication::MainLoop.
Parameters:
iLicenseKey | the license key. |
iCustomerID | the customer ID. |
public static void RFK::TutorialApplication::SetEventCallback | ( | RFK::EVENT | iEvent, |
RFK::EVENT_CALLBACK | iCallback, | ||
void * | iParam = NULL | ||
) |
Sets a user callback for a given application event.
Parameters:
iEvent | event to check for. |
iCallback | callback to call on event 'iEvent'. |
iParam | pointer to an optional parameter to be passed to 'iCallback'. |
public static RED_RC RFK::TutorialApplication::SetInspectedObject | ( | RFK::INSPECTOR | iInspector, |
RED::Object * | iObject, | ||
const RED::Map< unsigned int, RED::String > * | iIDToNames = NULL | ||
) |
Sets the currently inspected object for a given inspector.
The passed 'iObject' must be of a compatible type with the selected inspector, otherwise a RED_BAD_PARAM value is returned.
Parameters:
iInspector | type of the inspector. |
iObject | pointer to the object to inspect. |
iIDToNames: | Auxiliary correspondance table between RED::Object IDs and names that can be displayed by the inspector. |
Returns:
public static RED_RC RFK::TutorialApplication::SetLoopMode | ( | RFK::LOOP_MODE | iLoopMode | ) |
public static void RFK::TutorialApplication::SetMessage | ( | const RED::String & | iMessage | ) |
Sets the message displayed in the application status bar.
Parameters:
iMessage | message to display. |
public static void RFK::TutorialApplication::SetMouseCursorPosition | ( | int | iX, |
int | iY | ||
) |
Sets the current mouse cursor position. The origin is at the lower left window corner.
Parameters:
iX: | Mouse coordinate. |
iY: | Mouse coordinate. |
public static RED_RC RFK::TutorialApplication::SetRecentFiles | ( | const RED::Vector< RED::String > & | iRecentFiles | ) |
Sets the list of recent files.
This list is automatically saved to the system when the application exits and restored next time the application is launched.
The application doesn't display the content of the list in the UI. It's the user responsibility to decide if he wants or not to use this list and how it should displayed.
Parameters:
iRecentFiles | list of the recent files. |
Returns:
public static RED_RC RFK::TutorialApplication::SetSelectedItem | ( | RFK::INSPECTOR | iInspector, |
const RED::ShapePath & | iItem | ||
) |
public static RED_RC RFK::TutorialApplication::SetUserVariables | ( | const RED::Vector< RFK::UserVariable > & | iUserVariables | ) |
Sets a list of user variables.
The user variables are displayed in their own window. Depending on its type, each user variable receives a dedicated control to let the user modify its value.
Each time one of those variables is modified, a EVT_UVAR event is send.
The updated list of user variables can be obtained by calling GetUserVariables.
Parameters:
iUserVariables | The user variables list. |
Returns:
public static RED_RC RFK::TutorialApplication::SetViewpoint | ( | RED::Object * | iViewpoint | ) |
Sets the viewpoint rendered in the application window.
Pass a NULL viewpoint to stop rendering data.
If a viewpoint has already been set, it's removed through a call to RemoveViewpoint before the new one is set instead.
Parameters:
iViewpoint | pointer to the viewpoint. |
Returns:
public static void RFK::TutorialApplication::ShowFPS | ( | bool | iShow | ) |
Displays or not the FPS widget.
Parameters:
iShow | do we show the FPS? |
public static RED_RC RFK::TutorialApplication::ShowInspector | ( | RFK::INSPECTOR | iInspector, |
RED::Object * | iObject = NULL, | ||
bool | iClosable = true, | ||
const RED::Map< unsigned int, RED::String > * | iIDToNames = NULL | ||
) |
Shows an object inspector.
An inspector can be shown only if the MainLoop method has been called.
If the given inspector is already shown, the call will set the optional 'iObject' as the inspected object and return.
Parameters:
iInspector | type of the inspector to show. |
iObject | pointer to the inspected object. |
iClosable | is the inspector closable? |
iIDToNames: | Auxiliary correspondance table between RED::Object IDs and names that can be displayed by the inspector. This table must remain alive for the entire duration of the inspector display. |
Returns:
public static void RFK::TutorialApplication::ShowMouseCursor | ( | ) |
Shows the mouse cursor.
public static void RFK::TutorialApplication::ShowProgressBar | ( | bool | iShow | ) |
Displays or not the progress bar widget.
Parameters:
iShow | do we show the progress bar? |
public static void RFK::TutorialApplication::ShowResolution | ( | bool | iShow | ) |
Displays or not the resolution widget.
Parameters:
iShow | do we show the resolution? |
public static RED_RC RFK::TutorialApplication::ShowSystemInformation | ( | int | iCommand = 0 | ) |
Shows system information.
Opens a dialog showing the current software & hardware graphics configuration and recommendations.
This method can be used as a callback target in a call to CreateCommand.
Parameters:
iCommand | ignored parameter. |
Returns:
public static RED_RC RFK::TutorialApplication::StopFrameTracingIfNeeded | ( | ) |
public static RED_RC RFK::TutorialApplication::TakeSnapshot | ( | int | iCommand = 0 | ) |
Takes a snapshot fo the application.
The snapshot is saved in the application directory under the name "snapshot_h_m_s.png" where h is hours, m is minutes and s is seconds.
This method can be used as a callback target in a call to CreateCommand.
Parameters:
iCommand | ignored parameter. |
Returns:
public static void RFK::TutorialApplication::UpdateFPSCounter | ( | float | iFrameTime | ) |
Updates the Frames Per Second counter.
Parameters:
iFrameTime | time taken to render the last frame. |
public static void RFK::TutorialApplication::UpdateProgressBar | ( | float | iValue, |
bool | iForceRefresh = false | ||
) |
Updates the progress bar.
Parameters:
iValue | the value to set to the progress bar between 0.0 and 1.0. |
iForceRefresh | true to force the refresh of the application's UI, false to let the application refresh ASAP (default is false). |
public static void RFK::TutorialApplication::UpdateUserVariable | ( | const RFK::UserVariable & | iUserVariable | ) |
Update the value of a view only user variable.
This method changes the value of a RFK::UserVariable that has been sent to the user variable inspector using RFK::TutorialApplication::SetUserVariables first, and whose display uses the RFK::UVW_EDIT type. Those variables are not meant to be edited, just viewed.
Parameters:
iUserVariable: | The user variable to change. |
public static void RFK::TutorialApplication::UpdateUserVariables | ( | const RED::Vector< RFK::UserVariable > & | iUserVariables | ) |
Update the value of all the user variables.
This method changes the value of the RFK::UserVariable that has been sent to the user variable inspector using RFK::TutorialApplication::SetUserVariables first. All the user variables are updated from the iUserVariables array of variables. The matching is done on type and name of the variables.
Parameters:
iUserVariables: | The user variables to change. |
Returns: