-
Notifications
You must be signed in to change notification settings - Fork 0
Rendered Dependents
Rendered Nodes for the system to utilize them need to be setup with a trio of classes inherited from RenderedPlan - RenderedDependent - Renderer.
Subclass of ObservedPlan.
Subclass of Observed.
Subclass of Observer{T} where T is a subclass of RenderedDependet.
Let's look at this example:
The above picture shows the callstack frame-by-frame when addition happens to the Dependency graph for functions added! and addedAll!
added! is basically called, so that the Renderer knows how to assign a RenderedDependent to itself, maybe give it some view into a big buffer.
addedAll! exists, so that the Renderer knows when no more RenderedDependents are assigned to it, so it can prepare itself for Rendering.
Syncing works the same way as it does for Observed - Observers.
So only one Source node can be evaluated per frame, so sync! is called for a reachable (or Source node) Observed and their Observer pair only once per frame and syncAll! is also called once per frame if there was at least one reachable Node with this Observer, or the Source node had this Observer.
Note that RenderedDependent - Renderer building is defined like this:
function build!(self::App, plan::RenderedPlanDNA)
renderer,observed = buildFromPlan!(plan,self._graph,self._opengl)
setRenderedID!(renderer,observed,getGraphID(observed) + ID_LOWER_BOUND)
return renderer
endSo setRenderedID! needs to be defined for RenderedDependent - Renderer pairs accordingly.