Inviwo 0.9.12-pre
Inviwo documentation
Loading...
Searching...
No Matches
inviwo::MeshDrawer Class Referenceabstract

#include <meshdrawer.h>

+ Inheritance diagram for inviwo::MeshDrawer:

Public Member Functions

virtual void draw ()=0
 
virtual const MeshgetMesh () const =0
 

Protected Member Functions

virtual MeshDrawercreate (const Mesh *geom) const =0
 
virtual bool canDraw (const Mesh *geom) const =0
 

Friends

class MeshDrawerFactory
 

Detailed Description

Base class for drawers capable of drawing Geometry. A derived MeshDrawer should be registered by the module. The MeshDrawerFactory can be used to get a drawer without knowing the type of Geometry. This is enabled by implementing the abstract functions canRender and create.

Example of how to implement a derived MeshDrawer.

class IVW_XXX_API DerivedDrawer: public MeshDrawer {
public:
DerivedDrawer(const DerivedMesh* g): MeshDrawer(), geomToRender_(g) {};
virtual void draw() { // do stuff
}
virtual const Mesh* getMesh() const { return geomToRender_; }
protected:
virtual DerivedDrawer* create(const Mesh* geom) const {
return new DerivedDrawer(static_cast<const DerivedMesh*>(geom));
}
virtual bool canRender(const Mesh* geom) const {
return dynamic_cast<const DerivedMesh*>(geom) != nullptr;
}
private:
const DerivedMesh* geomToRender_;
};
Definition meshdrawer.h:72
virtual void draw()=0
virtual const Mesh * getMesh() const =0
virtual MeshDrawer * create(const Mesh *geom) const =0
See also
Geometry
MeshDrawerFactory
Module

Member Function Documentation

◆ canDraw()

virtual bool inviwo::MeshDrawer::canDraw ( const Mesh * geom) const
protectedpure virtual

Determine if the renderer can render geometry.

Parameters
geomThe Geometry to draw
Returns
Return true if able to render the Geometry, otherwise false.

Implemented in inviwo::MeshDrawerGL.

◆ create()

virtual MeshDrawer * inviwo::MeshDrawer::create ( const Mesh * geom) const
protectedpure virtual

Return a new object of the derived class.

Note
The MeshDrawer does not take ownership of the Geometry.
Parameters
geomThe geometry to render. This will always be of a type that canDraw return true for.
Returns
A new renderer.

Implemented in inviwo::MeshDrawerGL.

◆ draw()

virtual void inviwo::MeshDrawer::draw ( )
pure virtual

Draw the geometry the renderer was created for.

Implemented in inviwo::MeshDrawerGL.

◆ getMesh()

virtual const Mesh * inviwo::MeshDrawer::getMesh ( ) const
pure virtual

Get the geometry to render.

Returns

Implemented in inviwo::MeshDrawerGL.


The documentation for this class was generated from the following file: