Carna  Version 3.0.1
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Friends | List of all members
Carna::base::ManagedMeshBase Class Referenceabstract

Represents MeshBase object whose lifetime is managed by instances of this class. This is a format-independent abstract ManagedMesh base class. More...

#include <ManagedMesh.h>

+ Inheritance diagram for Carna::base::ManagedMeshBase:
+ Collaboration diagram for Carna::base::ManagedMeshBase:

Public Types

typedef ManagedMeshInterface ManagedInterface
 Defines the type to be used for interfacing the video resource.
 

Public Member Functions

virtual bool controlsSameVideoResource (const GeometryFeature &) const override
 Tells whether this instance maintains the same video resources like other.
 
virtual ManagedMeshInterfaceacquireVideoResource () override
 Acquires the video resources from this GeometryFeature by returning new instance of a class derived from ManagedInterface, that realizes the RAII idiom. Refer to its documentation for details. May return nullptr if this GeometryFeature does not provide any video resources.
 
- Public Member Functions inherited from Carna::base::GeometryFeature
unsigned int videoResourceAcquisitionsCount () const
 Tells current number of video resource acquisitions.
 
void release ()
 Denotes that this object is no longer required and may be deleted as soon as it is valid to delete it. More...
 
void addTo (Geometry &sceneGraphNode, unsigned int role)
 Puts this geometry feature on the sceneGraphNode. More...
 
void removeFrom (Geometry &sceneGraphNode)
 Removes this geometry feature from the sceneGraphNode. More...
 

Public Attributes

const unsigned int primitiveType
 Holds the primitive type, like GL_TRIANGLES, that should be used when rendering this mesh.
 
const VertexAttributes vertexAttributes
 Holds the vertex format of the vertices contained by the vertex buffer.
 

Protected Member Functions

 ManagedMeshBase (unsigned int primitiveType, const VertexAttributes &va)
 Instantiates.
 
virtual ~ManagedMeshBase ()
 Deletes.
 
virtual VertexBufferBaseloadVertexBuffer ()=0
 Creates OpenGL vertex buffer object and fills it with data.
 
virtual IndexBufferBaseloadIndexBuffer ()=0
 Creates OpenGL index buffer object and fills it with data.
 
void acquireMesh ()
 Acquires mesh within current OpenGL context.
 
void releaseMesh ()
 Releases mesh within current OpenGL context.
 
const MeshBasemesh () const
 References mesh within current OpenGL context.
 
- Protected Member Functions inherited from Carna::base::GeometryFeature
 GeometryFeature ()
 Instantiates.
 
virtual ~GeometryFeature ()
 Deletes and logs an error if video resources are leaked.
 

Friends

class GeometryFeature
 
class ManagedMeshInterface
 

Detailed Description

Represents MeshBase object whose lifetime is managed by instances of this class. This is a format-independent abstract ManagedMesh base class.

See also
The MeshFactory class contains a few examples.

The class maintains one VertexBuffer and one IndexBuffer on an application level. The buffers are created the first time the mesh's video resources are acquired. The buffers are deleted when the last acquisition is released. The buffer instances are available across all OpenGL contexts.

The MeshBase class is only valid within the OpenGL context it was created within. Refer to the class documentation for an explanation.

Author
Leonid Kostrykin
Date
1.9.14 - 24.3.15

Definition at line 56 of file ManagedMesh.h.


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