15#ifndef MANAGEDMESH_H_6014714286
16#define MANAGEDMESH_H_6014714286
65 const std::unique_ptr< Details > pimpl;
148template<
typename VertexType,
typename IndexType >
152 const std::vector< VertexType > vertices;
153 const std::vector< IndexType > indices;
185template<
typename VertexType,
typename IndexType >
187 (
unsigned int primitiveType
199template<
typename VertexType,
typename IndexType >
203 vb->copy( &vertices.front(), vertices.size() );
208template<
typename VertexType,
typename IndexType >
212 ib->copy( &indices.front(), indices.size() );
217template<
typename VertexType,
typename IndexType >
219 (
unsigned int primitiveType
Defines LibCarna::base::GeometryFeature.
Defines LibCarna::base::ManagedMeshInterface.
Defines LibCarna::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 VertexBufferBase * loadVertexBuffer()=0
Creates OpenGL vertex buffer object and fills it with data.
void releaseMesh()
Releases mesh within current OpenGL context.
virtual bool controlsSameVideoResource(const GeometryFeature &) const override
Tells whether this instance maintains the same video resources like other.
virtual IndexBufferBase * loadIndexBuffer()=0
Creates OpenGL index buffer object and fills it with data.
const VertexAttributes vertexAttributes
Holds the vertex format of the vertices contained by the vertex buffer.
const unsigned int primitiveType
Holds the primitive type, like GL_TRIANGLES, that should be used when rendering this mesh.
void acquireMesh()
Acquires mesh within current OpenGL context.
const MeshBase & mesh() const
References mesh within current OpenGL context.
virtual ManagedMeshInterface * acquireVideoResource() override
Acquires the video resources from this GeometryFeature by returning new instance of a class derived f...
ManagedMeshInterface ManagedInterface
Defines the type to be used for interfacing the video resource.
ManagedMeshBase(unsigned int primitiveType, const VertexAttributes &va)
Instantiates.
virtual ~ManagedMeshBase()
Deletes.
Interfaces the MeshBase that a ManagedMeshBase represents.
Implements MeshBase class for particular VertexType and IndexType.
virtual VertexBufferBase * loadVertexBuffer() override
Creates OpenGL vertex buffer object and fills it with data.
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.
IndexType Index
Holds the element type of the index buffer.
virtual IndexBufferBase * loadIndexBuffer() override
Creates OpenGL index buffer object and fills it with data.
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
Marks the class that it is placed in as non-copyable.