12#ifndef MANAGEDMESH_H_6014714286
13#define MANAGEDMESH_H_6014714286
62 const std::unique_ptr< Details > pimpl;
146template<
typename VertexType,
typename IndexType >
150 const std::vector< VertexType > vertices;
151 const std::vector< IndexType > indices;
183template<
typename VertexType,
typename IndexType >
185 (
unsigned int primitiveType
197template<
typename VertexType,
typename IndexType >
201 vb->copy( &vertices.front(), vertices.size() );
206template<
typename VertexType,
typename IndexType >
210 ib->copy( &indices.front(), indices.size() );
215template<
typename VertexType,
typename IndexType >
217 (
unsigned int primitiveType
Defines Carna::base::GeometryFeature.
Defines Carna::base::ManagedMeshInterface.
Defines Carna::base::Mesh.
Represents an association.
Represents "components" that are aggregated by Geometry objects. Closer description is given here.
Maintains GL_ELEMENT_ARRAY_BUFFER object that holds the vertex indices, that interconnect the vertice...
Represents MeshBase object whose lifetime is managed by instances of this class. This is a format-ind...
virtual ~ManagedMeshBase()
Deletes.
ManagedMeshInterface ManagedInterface
Defines the type to be used for interfacing the video resource.
virtual ManagedMeshInterface * acquireVideoResource() override
Acquires the video resources from this GeometryFeature by returning new instance of a class derived f...
const unsigned int primitiveType
Holds the primitive type, like GL_TRIANGLES, that should be used when rendering this mesh.
void releaseMesh()
Releases mesh within current OpenGL context.
const VertexAttributes vertexAttributes
Holds the vertex format of the vertices contained by the vertex buffer.
virtual IndexBufferBase * loadIndexBuffer()=0
Creates OpenGL index buffer object and fills it with data.
const MeshBase & mesh() const
References mesh within current OpenGL context.
virtual bool controlsSameVideoResource(const GeometryFeature &) const override
Tells whether this instance maintains the same video resources like other.
virtual VertexBufferBase * loadVertexBuffer()=0
Creates OpenGL vertex buffer object and fills it with data.
void acquireMesh()
Acquires mesh within current OpenGL context.
ManagedMeshBase(unsigned int primitiveType, const VertexAttributes &va)
Instantiates.
Interfaces the MeshBase that a ManagedMeshBase represents.
Implements MeshBase class for particular VertexType and IndexType.
static ManagedMesh< VertexType, IndexType > & create(unsigned int primitiveType, const VertexType *vertices, const std::size_t vertexCount, const IndexType *indices, const std::size_t indexCount)
Instantiates. Call release when you do not need the object any longer.
VertexType Vertex
Holds the element type of the vertex buffer.
virtual IndexBufferBase * loadIndexBuffer() override
Creates OpenGL index buffer object and fills it with data.
virtual VertexBufferBase * loadVertexBuffer() override
Creates OpenGL vertex buffer object and fills it with data.
IndexType Index
Holds the element type of the index buffer.
Format-independent abstract Mesh base class. Each mesh consists of a VertexBuffer,...
Maintains GL_ARRAY_BUFFER object that holds vertices. This class realizes the RAII-idiom.
std::vector< VertexAttribute > VertexAttributes
Defines VertexAttribute vector.
#define NON_COPYABLE
Features class it is placed in as non-copyable.