Fish - FiberLib for VISH 0.3
Fish - The Fiber Bundle API for the Vish Visualization Shell

A VertexField is a (abstract) gateway from RAM to GPU memory. More...

#include <VertexField.hpp>

Inheritance diagram for Wizt::VertexField:
MemCore::ReferenceBase< VertexField > Wizt::VBOField< NextType > Wizt::VBOField< LIST< TypedVertexAttribArray< Type >, NIL > > Wizt::VBOField< LIST< TypedVertexAttribArray< Type >, NextType > > Wizt::VBOField< LIST< VBOArrayType, NIL > > Wizt::VBOField< LIST< VBOArrayType, NextType > > Wizt::VBOField< TypedTexCoordArray< Type > > Wizt::VBOField< TypedVertexAttribArray< Type > > Wizt::VBOField< VBOArrayType > Wizt::VBOField< TypedTexCoordArray< Type > > Wizt::VBOField< TypedVertexAttribArray< Type > > Wizt::VBORGBAField Wizt::VBOTensorField

Classes

struct  Error
 Exception class. More...

Public Member Functions

 VertexField (VObject *what, const string &fieldname, bool ConvertToElements=true, int expertLevel=0)
 Constructor.
 ~VertexField ()
 Destructor.
virtual RefPtr< BufferArraycreateVBOArray (const RefPtr< Fiber::MemBase > &MB, const string &arrayname, const RefPtr< GLProgram > &Shader, const Fiber::MemBase::Creator_t &theCreator) const =0
 Virtual function to create a vertex array from a given memory array.
bool append (VBO &myVBO, const RefPtr< Fiber::CreativeArrayBase > &CAb, const string &arrayname, const RefPtr< GLProgram > &Shader) const
 Loading a given dataset as provided by the creator into a vertex array and append it to the given vertex buffer object.
virtual bool isOlderThan (const Ageable &A, const RefPtr< ValuePool > &Context) const
 Check if the parameters associated with this field are older than the given age.
virtual void updateAge (Ageable &A, const RefPtr< ValuePool > &Context) const
 Update the given age object with the age of the current field parameters.
Public Member Functions inherited from MemCore::ReferenceBase< VertexField >
auto getObjectCountID () const noexcept
bool isIdentical (const WeakPtr< Object, Object > &PossibleSelf) const noexcept
void mkAutoDestructive ()
refcount_t refcount () const noexcept
 ReferenceBase (Object *that) noexcept
const auto & self () const
refcount_t wrefcount () const noexcept

Public Attributes

TypedSlot< Fiber::FieldMyField
const bool ConvertToElements = false
 A flag telling whether the elements of memory arrays shall be converted into temporary explicit arrays, for the sake of loading into vertex arrays.

Additional Inherited Members

Public Types inherited from MemCore::ReferenceBase< VertexField >
typedef Object reference_domain_t
typedef WeakPtr< Object, Object > SelfPtr_t
Protected Member Functions inherited from MemCore::ReferenceBase< VertexField >
virtual void extremeUnction ()
ReferenceBaseoperator= (const ReferenceBase &R)
void suicide ()

Detailed Description

A VertexField is a (abstract) gateway from RAM to GPU memory.

It takes a data array in RAM (provided by the base class Fiber::MemBase) and transforms it into an OpenGL Buffer Array, e.g. to be used as a vertex attribute for some Shader program. It does so via the virtual function

virtual RefPtr< BufferArray > createVBOArray(const RefPtr< Fiber::MemBase > &MB, const string &arrayname, const RefPtr< GLProgram > &Shader, const Fiber::MemBase::Creator_t &theCreator) const =0
Virtual function to create a vertex array from a given memory array.
StrongPtr< Object, ObjectBase > RefPtr

which is implemented in child classes for the specific types that are to be transferred from CPU to GPU.

The member function VertexField::append() is then to be used in the rendering routine to add a certain vertex field to a vertex buffer object (VBO) for rendering.

Note that class VertexField does not deal with Fiber::Fields itself, but it provides a slot connecting to such. The class FragmentPainter provides the iterators to transform the various fragments of a Field into a sequence of VBO's, each with a collection of appropriate VertexField's attached. Be aware that a single Field may well consist of many fragments, and therefore be loaded as many BufferArray's through the same VertexField.

Constructor & Destructor Documentation

◆ VertexField()

Wizt::VertexField::VertexField ( VObject * what,
const string & fieldname,
bool ConvertToElements = true,
int expertLevel = 0 )

Constructor.

Parameters
whatThe VObject which will host all the field inputs.
fieldnameThe name under which the Field input slot will appear.
ConvertToElementsA flag telling whether procedural fields shall be converted to elements; this depends on the rendering method whether procedural fields are supported here or not. A derived class must decide in its constructor whether this is the case and set this flag accordingly.
expertLevelThe expert level of the Field input slot.

References MemCore::ReferenceBase< VertexField >::ReferenceBase(), VertexField(), and ConvertToElements.

Referenced by VertexField().

Member Function Documentation

◆ append()

bool Wizt::VertexField::append ( VBO & myVBO,
const RefPtr< Fiber::CreativeArrayBase > & CAb,
const string & arrayname,
const RefPtr< GLProgram > & Shader ) const

Loading a given dataset as provided by the creator into a vertex array and append it to the given vertex buffer object.

This function must be called within a valid OpenGL Context.

References Wizt::VBO::append(), createVBOArray(), Wizt::VActionNotifier::getNewProgressID(), MemCore::DynPtr< class Object, class ObjectBase >::getType(), Eagle::norm2(), Wizt::VActionNotifier::ProgressInfo(), std::vector< typename _Tp, typename _Alloc >::size(), Wizt::VBO::TranslationVector, and MemCore::Typename().

Referenced by createVBOArray().

◆ createVBOArray()

virtual RefPtr< BufferArray > Wizt::VertexField::createVBOArray ( const RefPtr< Fiber::MemBase > & MB,
const string & arrayname,
const RefPtr< GLProgram > & Shader,
const Fiber::MemBase::Creator_t & theCreator ) const
pure virtual

◆ isOlderThan()

bool Wizt::VertexField::isOlderThan ( const Ageable & A,
const RefPtr< ValuePool > & Context ) const
virtual

Check if the parameters associated with this field are older than the given age.

If nothing has changed, return true, which is the default. Returning false here will trigger some action like reloading and/or recomputing data, which might be expensive.

Referenced by createVBOArray().

Member Data Documentation

◆ ConvertToElements

const bool Wizt::VertexField::ConvertToElements = false

A flag telling whether the elements of memory arrays shall be converted into temporary explicit arrays, for the sake of loading into vertex arrays.

This is significantly slower but makes the rendering code easier because it does not need to deal with multiple cases of procedural arrays.

Referenced by VertexField().