class
CoreObject
Provides a standardized way to initialize/destroy objects, a unique runtime ID for each object, and a way to specify dependant CoreObjects.
Optionally it may also be used to create render proxy objects for use by the render thread.
Public
Methods
Destroy
Frees all the data held by this object.
If the object has a render proxy, the internal reference to the render proxy will be released, but the proxy will not be destroyed unless this was the last reference. If render proxy destruction does happen, it is not immediate, but rather queued for destruction on the render thread.
Initialize
Initializes all the internal data of this object.
Must be called right after construction for new objects, or after deserialization for deserialized objects. If requested, render proxy is created and queued for initialization on the render thread.
IsInitialized
Returns true if the object has been initialized.
Non-initialized object should not be used.
IsDestroyed
Returns true if the object has been destroyed.
Destroyed object should not be used.
BlockUntilRenderProxyInitialized
Blocks the current thread until the render proxy is fully initialized on the render thread.
GetInternalId
Returns an unique identifier for this object.
GetRenderProxy
Returns an object that contains render thread specific implementation of this CoreObject.
Null is a valid return value in case object requires no render thread implementation.
SyncToRenderProxy
Ensures all dirty syncable data is send to the render proxy (if any).
Internal
Methods
Protected
Constructors
CoreObject
Constructs a new core object.
- createRenderProxy
- Set to true if the object requires a RenderProxy counter-part. Render proxies allow the object to be used from the render thread, using data syncing from the main thread object to keep up to date. If true, you class should override CreateRenderProxy() to create the proxy, and CreateRenderProxySyncPacket() to provide the data for synchronization between the objects. MarkRenderProxyDataDirty() should be used to notify the system data is dirty and render proxy needs updating.
Methods
~CoreObject
CreateRenderProxy
Creates an object that contains render thread specific data and methods for this object.
Can be null if such object is not required.
MarkRenderProxyDataDirty
Marks the render proxy data as dirty.
This causes the SyncToRenderProxy() method to trigger the next time objects are synced to the render thread.
- flags
- Flags in case you want to signal that only part of the internal data is dirty. SyncToRenderProxy() will be called regardless and it's up to the implementation to read the flags value if needed.
MarkRenderProxyDataUpToDate
Marks the render proxy data as up to date.
Normally called right after new data has been synced to the render thread.
MarkDependenciesDirty
Notifies the core object manager that this object is dependant on some other CoreObject(s), and the dependencies changed since the last call to this method.
This will trigger a call to GetCoreDependencies() to collect the new dependencies.
IsRenderProxyDataOutOfDate
Returns true if the render proxy has out of date data and required a new data sync to be up to date.
GetRenderProxyDirtyFlags
Returns flags that specify which portion of the render proxy is out of date with this object.
CreateRenderProxySyncPacket
Creates a data packet that will be used for syncing the core object with it's render proxy.
Caller must free the retrieved packet using the provided allocator when done using it.
GetCoreDependencies
Populates the provided array with all core objects that this core object depends upon.
Dependencies are required for syncing to the render thread, so the system can be aware to update the dependant objects if a dependency is marked as dirty (for example updating a camera's viewport should also trigger an update on camera so it has a chance to potentially update its data).
OnDependencyDirty
Gets called on an object when one of the dependencies (as returned from GetCoreDependencies()) is marked as dirty.
It gives the dependant object a chance to determine should it mark itself as dirty due to the dependency change. Dirty flags of the dependency object can be examined for more information on what part of the dependency was modified.