Clarisse 5.0 SP8 SDK
5.0.5.8.0
|
Clarisse SDK provides a special static library clarisse_engine
which allows to embed Clarisse in custom C++ applications. Embedding Clarisse engine can be very useful if you are looking manage scenes or to launch renders, for example, in external application.
Creating a Clarisse Engine instance requires a free CNode license. If no CNode license is available, your application will fail to create a ClarisseEngine instance. Moreover, you should note that embedding Clarisse Engine in 3rd party applications requires a special license agreement. For more information, please contact suppo. rt@i sotro pix. com
To embed Clarisse, you must link your application or plugin to clarisse_engine
static library which is provided with Clarisse SDK files. To use Clarisse Engine you must include the file clarisse_engine.h
which defines both ClarisseEngine and ClarisseEngineHandler classes.
An instance of Clarisse Engine is an interface to a Clarisse application running in a background thread attached to the running process. Due to the massively parallel nature of Clarisse core, Clarisse Engine comes with the limitation of not being able to make directly fully safe Clarisse API calls within the execution of your main process. To make your Clarisse API calls you must provide a ClarisseEngineCallback and use ClarisseEngineHandler::execute which handles synchronicity issues.
Depending on your needs, ClarisseEngineHandler::execute provides two modes of execution: one synchronous (which means the call is blocking) and a second asynchronous one.
The first thing you must do is to create an instance of ClarisseEngine by calling ClarisseEngine::create. Note that there can't be multiple instances of ClarisseEngine per application. Once the instance of Clarisse Engine has been created, the pointer to the running Clarisse Engine can be retrieved using ClarisseEngine::get_engine.
Please also note that once the instance of ClarisseEngine is created it must be used throughout the lifetime of the host process as an application can only create a single single instance of Clarisse Engine. This means that calling ClarisseEngineHandler::quit will prevent you of any further use of ClarisseEngine in your application.
The following example creates a Clarisse Engine instance and loads a project:
As we could see on the previous example, working exclusively with callbacks could be somewhat daunting for developers because of its lack of visibility. What we recommend you is to organize your code differently by creating a API handling callback wrapping to write clearer code specially if you have to share your code with others. In the next example we will: