|
The Vish Visualization Shell 0.3
Vish
|
When dealing with Render Anemones, it is frequent that the Anemone does not need to be re-created with each change of inputs. More...
#include <ocean/Anemonia/VRenderOptionUpdater.hpp>
Public Member Functions | |
| bool | updateValue (VRenderContext &Context, RenderBasin::RenderParameter &RP) override |
| Virtual update function that is called from Anemone::updateValues(). | |
Public Member Functions inherited from MemCore::ReferenceBase< Updater > | |
| auto | getObjectCountID () const noexcept |
| Get a unique ID for this object in the given domain. | |
| bool | isIdentical (const WeakPtr< Updater, Updater > &PossibleSelf) const noexcept |
| Check if this object is identical to the one used by the given pointer. | |
| void | mkAutoDestructive () |
| Marks this object as being automatically destructed, e.g. | |
| refcount_t | refcount () const noexcept |
| The strong reference count. | |
| ReferenceBase (Updater *that) noexcept | |
| Constructor, initializes reference counter to zero. | |
| const auto & | self () const |
| Return weak pointer to the object self. | |
| refcount_t | wrefcount () const noexcept |
| The weak reference count. | |
Additional Inherited Members | |
Public Types inherited from MemCore::ReferenceBase< Updater > | |
| using | reference_domain_t = Updater |
| The type of the base class. | |
| using | SelfPtr_t = WeakPtr< Updater, Updater > |
| Type for a pointer to this object itself. | |
Protected Member Functions inherited from MemCore::ReferenceBase< Updater > | |
| virtual void | extremeUnction () |
| A virtual function that will be called just before the object is destroyed. | |
| ReferenceBase & | operator= (const ReferenceBase &R) |
| Protected assignment operator (should not be called). | |
| void | suicide () |
| Delete this. | |
| virtual | ~ReferenceBase () |
| Virtual destructor. | |
When dealing with Render Anemones, it is frequent that the Anemone does not need to be re-created with each change of inputs.
Some input parameters only need to modify part of the render anemone, for instance a uniform parameter or a rendering flag. Class RenderBasin::RenderParameter::Updater provides a mechanism to ease this process.
Each render tentacle can be equipped with an updater object, which are child classes of RenderBasin::RenderParameter::Updater implementing the virtual member function
Such child classes will usually host a copy of the input slot and call the render parameter's modify() member function.
Class VRenderOptionUpdater allows to modify render parameter depending on whether some flag is set in the options or not. The type of these render parametes is flexible and specified as the template parameters, the value of these parameters and the name of te flag to be tested is given in the constructor.
The following code is an example how to read a flag from some options and to schedule modification of the render anemone (used in Heightfield.cpp and elsewhere):
VRenderObject class member definition:
VRenderObject constructor:
Code fragment in the render() function, provided an Anemone:
Then, somewhere in the code elsewhere when an existing render anemone is retrieved and ready to be re-used, there needs to be a call to