#include
Inherits ICryUnknown.
Inherited by ICryUserAnalyticsPlugin.
Public Types | |
enum | EUpdateStep : uint8 { BeforeSystem = 1 << 0, BeforePhysics = 1 << 1, MainUpdate = 1 << 2, BeforeFinalizeCamera = 1 << 3, BeforeRender = 1 << 4, AfterRender = 1 << 5, AfterRenderSubmit = 1 << 6, Count = 7 } |
Public Member Functions | |
CRYINTERFACE_DECLARE_GUID (IEnginePlugin, "f491a0db-3863-4fca-b6e6-bcfe2d98eea2"_cry_guid) | |
virtual const char * | GetName () const |
Used to check the name of the plug-in, by default returns the string specified with CRYGENERATE_CLASS_GUID or CRYGENERATE_SINGLETONCLASS_GUID. | |
virtual const char * | GetCategory () const |
Used to check what category this plug-in belongs to. | |
virtual bool | Initialize (SSystemGlobalEnvironment &env, const SSystemInitParams &initParams)=0 |
Called shortly after plug-in load when the plug-in is expected to initialize all its systems. | |
virtual void | UpdateBeforeSystem () |
virtual void | UpdateBeforePhysics () |
virtual void | MainUpdate (float frameTime) |
virtual void | UpdateBeforeFinalizeCamera () |
virtual void | UpdateBeforeRender () |
virtual void | UpdateAfterRender () |
virtual void | UpdateAfterRenderSubmit () |
virtual bool | RegisterFlowNodes () |
virtual bool | UnregisterFlowNodes () |
Protected Member Functions | |
void | EnableUpdate (EUpdateStep step, bool enable) |
Represents an engine plug-in that can be loaded as a dynamic library, or statically linked in. Plug-ins are loaded from JSON in your .cryproject file on engine startup. For a fully functional example, see Code.
#include
// Minimal plug-in implementation example, initializing and receiving per-frame Update callbacks
class CMyPlugin final : public Cry::IEnginePlugin
{
// Start declaring the inheritance hierarchy for this plug-in
// This is followed by any number of CRYINTERFACE_ADD, passing an interface implementing ICryUnknown that has declared its own GUID using CRYINTERFACE_DECLARE_GUID
CRYINTERFACE_BEGIN()
// Indicate that we implement Cry::IEnginePlugin, this is mandatory in order for the plug-in instance to be detected after the plug-in has been loaded
CRYINTERFACE_ADD(Cry::IEnginePlugin)
// End the declaration of inheritance hierarchy
CRYINTERFACE_END()
// Set the GUID for our plug-in, this should be unique across all used plug-ins
// Can be generated in Visual Studio under Tools -> Create GUID
CRYGENERATE_SINGLETONCLASS_GUID(CMyPlugin, "MyPluginName", "{0C7B8742-5FBF-4C48-AE7C-6E70308538EC}"_cry_guid)
// Called shortly after loading the plug-in from disk
// This is usually where you would initialize any third-party APIs and custom code
virtual bool Initialize(SSystemGlobalEnvironment& env, const SSystemInitParams& initParams) override
{
/* Initialize plug-in here */
// Make sure that we receive per-frame call to MainUpdate
EnableUpdate(IEnginePlugin::EUpdateStep::MainUpdate, true);
return true;
}
virtual void MainUpdate(float frameTime) override
{
/* Perform update here */
}
};
// Register the factory that can create this plug-in instance
// Note that this has to be done in a source file that is not included anywhere else.
CRYREGISTER_SINGLETON_CLASS(CMyPlugin)
|
strong |
Used to determine what type of updates a plug-in interested in, treated as bit flags This enumeration is ordered in the same order as the functions are called each frame
|
inline protected |
Enables a particular update step to be called each frame on this plug-in
#include
// Minimal plug-in implementation example, initializing and receiving per-frame Update callbacks
class CMyPlugin final : public Cry::IEnginePlugin
{
// Start declaring the inheritance hierarchy for this plug-in
// This is followed by any number of CRYINTERFACE_ADD, passing an interface implementing ICryUnknown that has declared its own GUID using CRYINTERFACE_DECLARE_GUID
CRYINTERFACE_BEGIN()
// Indicate that we implement Cry::IEnginePlugin, this is mandatory in order for the plug-in instance to be detected after the plug-in has been loaded
CRYINTERFACE_ADD(Cry::IEnginePlugin)
// End the declaration of inheritance hierarchy
CRYINTERFACE_END()
// Set the GUID for our plug-in, this should be unique across all used plug-ins
// Can be generated in Visual Studio under Tools -> Create GUID
CRYGENERATE_SINGLETONCLASS_GUID(CMyPlugin, "MyPluginName", "{0C7B8742-5FBF-4C48-AE7C-6E70308538EC}"_cry_guid)
// Called shortly after loading the plug-in from disk
// This is usually where you would initialize any third-party APIs and custom code
virtual bool Initialize(SSystemGlobalEnvironment& env, const SSystemInitParams& initParams) override
{
/* Initialize plug-in here */
// Make sure that we receive per-frame call to MainUpdate
EnableUpdate(IEnginePlugin::EUpdateStep::MainUpdate, true);
return true;
}
virtual void MainUpdate(float frameTime) override
{
/* Perform update here */
}
};
// Register the factory that can create this plug-in instance
// Note that this has to be done in a source file that is not included anywhere else.
CRYREGISTER_SINGLETON_CLASS(CMyPlugin)
|
inline virtual |
Called after ISystem has been updated, this is the main update where most game logic is expected to occur This is the default update that should be preferred if you don't need any special behavior Called on a plug-in if it has called EnableUpdate(EUpdateStep::MainUpdate, true)
|
inline virtual |
Called when the plug-in should register all its flow nodes Automated version can be enabled using the PLUGIN_FLOWNODE_REGISTER macro
|
inline virtual |
Called when the plug-in should unregister all its flow nodes Automated version can be enabled using the PLUGIN_FLOWNODE_UNREGISTER macro
|
inline virtual |
Called after we have submitted the render request to the render thread Called on a plug-in if it has called EnableUpdate(EUpdateStep::AfterRender, true)
|
inline virtual |
Called after the renderer has submitted the frame to the output device Called on a plug-in if it has called EnableUpdate(EUpdateStep::AfterRenderSubmit, true)
|
inline virtual |
Called immediately before the camera is considered finalized and passed on to occlusion culling Called on a plug-in if it has called EnableUpdate(EUpdateStep::BeforeFinalizeCamera, true)
|
inline virtual |
Called before physics is updated for the new frame, best point for queuing physics jobs Called on a plug-in if it has called EnableUpdate(EUpdateStep::BeforePhysics, true)
|
inline virtual |
Called before we begin rendering the scene Called on a plug-in if it has called EnableUpdate(EUpdateStep::BeforeRender, true)
|
inline virtual |
Earliest point of update in a frame, before ISystem itself is updated Called on a plug-in if it has called EnableUpdate(EUpdateStep::BeforeSystem, true)