|
The Vish Visualization Shell 0.3
Vish
|
Abstract object for elementary render objects. More...
#include <ocean/Anemonia/Anemone.hpp>
Classes | |
| class | SpecializedTentacle |
| Base class for Tentacles that are specialized for a specific purpose. More... | |
| class | Tentacle |
| Base class for components that need to be attached to an Anemone to make it visible. More... | |
| struct | TentacleIterator |
| Tentacle iterator base class. More... | |
Public Types | |
| enum | TentacleClass { MinTentacleClass = -32000 , Timer = -16384 , Status = -8192 , Renderbuffer = -2048 , Framebuffer = -1024 , Program = 0 , Variables = 1024 , Arraybuffer = 2048 , Vertex = Arraybuffer , VertexArray = Vertex , EdgeArray = Vertex + 1 , FaceArray = Vertex + 2 , VoxelArray = Vertex + 3 , EdgeSetArray = EdgeArray + 16 , FaceSetArray = FaceArray + 16 , VoxelSetArray = VoxelArray + 16 , Elements = 4096 , FieldArrayClassBase = 8192 , Storage = 8192 + 4096 , Texture = 16384 , LastArraybufferClass = Texture - 1 , Painter = Texture + 4096 , DisplayLists = Painter + 4096 , MaxTentacleClass = 32000 } |
| Types of tentacles that are attached at an Anemone. More... | |
Public Types inherited from MemCore::Cacheable | |
| using | cachecounter_t = unsigned long |
| The type to store repeated accesses to a cached object. | |
Public Types inherited from MemCore::ReferenceBase< Cacheable > | |
| using | reference_domain_t = Cacheable |
| The type of the base class. | |
| using | SelfPtr_t = WeakPtr< Cacheable, Cacheable > |
| Type for a pointer to this object itself. | |
Public Member Functions | |
| Anemone (const MemCore::WeakPtr< MemCore::Creature > &theCreator=MemCore::NullPtr()) | |
| Constructor, optionally specify a Creator. | |
| void | clear () |
| Ripp off all tentacles from this Anemone. | |
| MemCore::memsize_t | computeMemsize () const |
| Compute the current memory size as occupied by the tentacles referenced here. | |
| bool | empty () const |
| Check whether there are any tentacles on this Anemone. | |
| bool | erase (const MemCore::RefPtr< Tentacle > &T) |
| Remove a Tentacle. | |
| bool | eraseTentacle (const MemCore::RefPtr< Tentacle > &T) |
| Remove a Tentacle. | |
| MemCore::RefPtr< SpecializedTentacle< Program > > | getProgram (Activity_t theActivity=~0) const |
| Get the shader program that is stored in this Anemone. | |
| MemCore::WeakPtr< Tentacle > | insert (const MemCore::WeakPtr< Tentacle > &T, int OrderDeviation=0) |
| Insert a specialized Tentacle to this Anemone, returns pointer to the given tentacle if insertion was successful (which is likely). | |
| bool | insertTentacle (int TentacleOrder, const MemCore::RefPtr< Tentacle > &T) |
| Append a generic Tentacle to this Anemone Return false if there was no valid Tentacle given. | |
| size_t | iterate (const TentacleIterator_t &TI) const |
| Iterate over all tentacle categories. | |
| size_t | iterate (const TentacleIterator_t &TI, int TentacleClass) const |
| Iterate over one specific tentacle category. | |
| size_t | iterate (const TentacleIterator_t &TI, int TentacleOrderStart, int TentacleOrderEnd) const |
| Iterate over a range of tentacle classes. | |
| size_t | iterate (TentacleIterator &TI) const |
| Iterate over all tentacle categories. | |
| size_t | iterate (TentacleIterator &TI, int TentacleClass) const |
| Iterate over one specific tentacle category. | |
| size_t | iterate (TentacleIterator &TI, int TentacleOrderStart, int TentacleOrderEnd) const |
| Iterate over a range of tentacle classes. | |
| size_t | NumberOfElements (int TentacleOrderStart, int TentacleOrderEnd) const |
| Get the number of elements for a range of tentacle types. | |
| size_t | NumberOfElements (int TentacleOrderStart=Vertex) const |
| Tell the number of elements of a certain class of Tentacles. | |
| size_t | NumberOfShaderPrograms (Activity_t theActivity=~0) const |
| Count how many shader programs are attached here. | |
| size_t | NumberOfTentacles (int TentacleClass, Activity_t theActivity=~0) const |
| Counts the number of tentacles for one specific class of tentacles. | |
| size_t | NumberOfTentacles (int TentacleOrderStart, int TentacleOrderEnd, Activity_t theActivity=~0) const |
| Counts the number of tentacles for the given range of tentacle categories. | |
| size_t | NumberOfVertices () const |
| Tell the number of vertices in this Anemone. | |
| bool | pull (const MemCore::RefPtr< Tentacle > &T) |
| Painfully remove a Tentacle. | |
| bool | remove (const MemCore::RefPtr< Tentacle > &T) |
| Remove a Tentacle. | |
| bool | updateValues (VRenderContext &Context) const |
| Update all tentacles with values relative to the given context. | |
| int | wave (Activity_t Activity=~0) const |
| Let the Anemone display its full glory by activating all its Tentacles. | |
| std::string | xml (const std::string &indent_prefix="") const |
| Provide some kind of XML description for this Anemone's content. | |
Public Member Functions inherited from MemCore::MutableCacheable | |
| void | adjustCurrentMemsize () |
| Call this function whenever the size has changed and memsize() function's result shall be synchronized with the computeMemsize() function. | |
| memsize_t | memsize () const |
| Return the currently registered memory size. | |
| MutableCacheable (const WeakPtr< Creature > &C) | |
| Constructor. | |
Public Member Functions inherited from MemCore::Cacheable | |
| Cacheable (const WeakPtr< Creature > &C) | |
| Constructor. | |
| virtual void | DeferredConstructor () |
| A virtual function that is called on the first strong referencing of a Cacheable object. | |
| bool | isCached () const |
| Check whether this object is managed by a cache queue. | |
| bool | isUncached () const |
| Check whether this object is managed by a cache queue. | |
| bool | markAsUsed () |
| Mark this data object as being recently used. | |
| WeakPtr< CacheBase > | myCache () const |
| Return the associated Cache object as known from the associated Creator, if any. | |
| const WeakPtr< Creature > & | myCreator () const |
| Return the associated Creator, if any. | |
| int | NumberOfListEntries () const |
| Count the number of entries here. | |
| void | PreDestructor () |
| This class uses a predestructor to remove itself's size from the cache queue. | |
| void | push_back (CacheQueue &Q) |
| Put the current item onto the BACK of the given cache queue. | |
| void | push_front (CacheQueue &Q) |
| Put the current item onto the FRONT of the given cache queue. | |
| void | setCreator (const WeakPtr< Creature > &C) |
| Set and the creator. | |
Public Member Functions inherited from MemCore::ReferenceBase< Cacheable > | |
| auto | getObjectCountID () const noexcept |
| Get a unique ID for this object in the given domain. | |
| bool | isIdentical (const WeakPtr< Cacheable, Cacheable > &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 (Cacheable *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. | |
Public Attributes | |
| unsigned | num_views = 1 |
Protected Member Functions | |
| virtual | ~Anemone () |
| Destructor is protected because Anemone objects must always be created as dynamic objects. | |
Protected Member Functions inherited from MemCore::MutableCacheable | |
| ~MutableCacheable () | |
| Destructor. | |
Protected Member Functions inherited from MemCore::Cacheable | |
| void | adjustCacheableSize (memsize_t memDiff) |
| In case this object changes its size after insertion to the CacheQueue, call this function to adjust. | |
| ~Cacheable () | |
| Destructor. | |
Protected Member Functions inherited from MemCore::ReferenceBase< Cacheable > | |
| 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. | |
Abstract object for elementary render objects.
The Anemone allows to attach basic components, "Tentacles", which cover a certain property of the rendering instance, such as vertex arrays. Once constructed, the Anemone provides a basic instance of a renderable objects. How it is actually done will depend on the implementation of the tentacles, which might be OpenGL, OpenGL-ES, WebGL or whatever. The concrete form of the Tentacles is deferred to another instance. The Anemone provides just management of those Tentacles.
Types of tentacles that are attached at an Anemone.
The numerical value of these classes determines the order in which a Tentacle's activate()/deactivate() function is called. Smaller values come first, higher values come later. The possible tentacles used are not limited to the given enums, arbitrary user-defined values are supported as well. Having tentacles of same value is no problem as long as the order of their operations does not matter (i.e. is commutative).
| Enumerator | |
|---|---|
| MinTentacleClass | Minimal tentacle class. |
| Timer | Timer, measures execution time of this Anemone. |
| Status | Status Flags (glEnable/glDisable), including pushattribs and matrix. |
| Renderbuffer | Renderbuffer objects. |
| Framebuffer | Framebuffer objects. |
| Program | Shader programs. |
| Variables | Global shader variables (user-defined uniforms) |
| Arraybuffer | array buffers |
| Vertex | Vertex array buffers. |
| Elements | Element buffers. |
| Texture | no specific reason for this value so far Textures (are enabled after array buffers to allow for Texture Buffers where a buffer is enabled and then bound to a texture. |
| Painter | Calls to drawElements, performing the actual actions. |
| DisplayLists | OpenGL Display lists (deprecated, should not be used) |
| MaxTentacleClass | Maximal tentacle class. |
| Wizt::Anemone::Anemone | ( | const MemCore::WeakPtr< MemCore::Creature > & | theCreator = MemCore::NullPtr() | ) |
Constructor, optionally specify a Creator.
A Creator may be used to classify how to cache Anemones, since all Anemones related to the same \i type of Creators (their typeid) are clustered into the same pool of Anemones. If memory runs short, Anemones of the same creator type will be cleaned up first.
|
virtual |
Compute the current memory size as occupied by the tentacles referenced here.
This may not be the same as the current memsize() since tentacles may change their size later.
Implements MemCore::MutableCacheable.
References Wizt::Anemone::Tentacle::memsize().
Referenced by wave(), and ~Anemone().
| RefPtr< Anemone::SpecializedTentacle< Anemone::Program > > Wizt::Anemone::getProgram | ( | Activity_t | theActivity = ~0 | ) | const |
Get the shader program that is stored in this Anemone.
Returns the first tentacle found to be of TentacleClass "Program".
References Program, and Variables.
Referenced by Wizt::UniformVertexAttribute::activate(), Wizt::RenderBasin::Painter::activate(), Wizt::VertexAttribArray< Type >::activate(), and Wizt::VertexAttribArray< Type >::deactivate().
|
inline |
Insert a specialized Tentacle to this Anemone, returns pointer to the given tentacle if insertion was successful (which is likely).
There will be a strong reference pointer to the tentacle at this point.
| OrderDeviation | optional deviation for the order number at which the tentacle is inserted relative to the actual order as specified by the tentacle. |
Referenced by Wizt::RenderBasin::bindStorageBuffer(), and Wizt::operator>>().
| bool Wizt::Anemone::insertTentacle | ( | int | TentacleOrder, |
| const MemCore::RefPtr< Tentacle > & | T | ||
| ) |
Append a generic Tentacle to this Anemone Return false if there was no valid Tentacle given.
Note: could also just query the tentacle's size here.
References MemCore::VerboseStream::MemString(), NumberOfElements(), and Vertex.
|
inline |
Count how many shader programs are attached here.
Same as calling NumberOfTentacles(Program).
Referenced by Wizt::RenderBasin::Painter::activate(), and Wizt::VertexBuffer::activate().
|
inline |
| bool Wizt::Anemone::updateValues | ( | VRenderContext & | Context | ) | const |
Update all tentacles with values relative to the given context.
This usually only makes sense for render parameters that have been associated with the input slots of some VObject. The function will return true if and only if all tentacles could be updated successfully.
| int Wizt::Anemone::wave | ( | Activity_t | Activity = ~0 | ) | const |
Let the Anemone display its full glory by activating all its Tentacles.
This call executes the tentacles stored in the Anemone and does the actual rendering.
References computeMemsize(), and MemCore::MutableCacheable::memsize().
| std::string Wizt::Anemone::xml | ( | const std::string & | indent_prefix = "" | ) | const |
Provide some kind of XML description for this Anemone's content.
Good for debugging.
|
mutable |
For Multiview rendering:
The number of views supported by the current state of the Anemone.
GLSL shaders that support multiview rendering must define a layout with the number of views as in:
If that number of views does not match the actual views, as they may have changed, then the next draw command such as glDrawArrays will issue an INVALID_OPERATION error:
Thus, Anemone management code must check for validity of this value. It is actually a shader-related value and each shader could have different values, but that does not really make sense in practice and it is easier to check this consistence at the Anemone level. However, this may be subject of revision if the need arises and this value may be moved to the Program tentacle instead, or added there as well (which would make validity checks more effortsome).
Referenced by Wizt::LayeredMultiViews::isValid().