LibCarna
Version 3.4.0
Loading...
Searching...
No Matches
include
LibCarna
base
Mesh.hpp
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2010 - 2016 Leonid Kostrykin
3
*
4
* Chair of Medical Engineering (mediTEC)
5
* RWTH Aachen University
6
* Pauwelsstr. 20
7
* 52074 Aachen
8
* Germany
9
*
10
*
11
* Copyright (C) 2021 - 2025 Leonid Kostrykin
12
*
13
*/
14
15
#ifndef MESH_H_6014714286
16
#define MESH_H_6014714286
17
18
#include <
LibCarna/base/VertexAttributes.hpp
>
19
#include <
LibCarna/base/VertexBuffer.hpp
>
20
#include <
LibCarna/base/IndexBuffer.hpp
>
21
#include <memory>
22
28
namespace
LibCarna
29
{
30
31
namespace
base
32
{
33
34
35
36
// ----------------------------------------------------------------------------------
37
// MeshBase
38
// ----------------------------------------------------------------------------------
39
66
class
LIBCARNA
MeshBase
67
{
68
69
const
std::unique_ptr< Association< VertexBufferBase > > myVertexBuffer;
70
const
std::unique_ptr< Association< IndexBufferBase > > myIndexBuffer;
71
72
public
:
73
78
MeshBase
79
(
const
VertexAttributes
&
va
80
,
Association< VertexBufferBase >
* vertexBuffer
81
,
Association< IndexBufferBase >
* indexBuffer );
82
87
virtual
~MeshBase
()
noexcept
(
false
);
88
92
const
unsigned
int
id
;
93
97
const
GLContext
& glContext;
98
103
void
bind()
const
;
104
109
void
render()
const
;
110
111
const
VertexBufferBase
& vertexBuffer()
const
;
112
const
IndexBufferBase
& indexBuffer()
const
;
113
114
VertexBufferBase
& vertexBuffer();
115
IndexBufferBase
& indexBuffer();
116
117
};
// MeshBase
118
119
120
121
// ----------------------------------------------------------------------------------
122
// Mesh
123
// ----------------------------------------------------------------------------------
124
136
template
<
typename
VertexType
,
typename
IndexType
>
137
class
Mesh
:
public
MeshBase
138
{
139
140
public
:
141
145
Mesh
(
Association< VertexBufferBase >
* vertexBuffer
146
,
Association< IndexBufferBase >
* indexBuffer );
147
148
typedef
VertexType
Vertex
;
149
typedef
IndexType
Index
;
150
151
};
// Mesh
152
153
154
template
<
typename
VertexType,
typename
IndexType >
155
Mesh< VertexType, IndexType >::Mesh
156
(
Association< VertexBufferBase >
* vertexBuffer
157
,
Association< IndexBufferBase >
* indexBuffer )
158
:
MeshBase
(
VertexType
::attributes, vertexBuffer, indexBuffer )
159
{
160
}
161
162
163
164
}
// namespace LibCarna :: base
165
166
}
// namespace LibCarna
167
168
#endif
// MESH_H_6014714286
IndexBuffer.hpp
Defines LibCarna::base::IndexBuffer.
VertexAttributes.hpp
Defines LibCarna::base::VertexAttributes.
VertexBuffer.hpp
Defines LibCarna::base::VertexBuffer.
LibCarna::base::Association
Represents an association.
Definition
Association.hpp:48
LibCarna::base::GLContext
Wraps and represents an OpenGL context.
Definition
GLContext.hpp:66
LibCarna::base::IndexBufferBase
Maintains GL_ELEMENT_ARRAY_BUFFER object that holds the vertex indices, that interconnect the vertice...
Definition
IndexBuffer.hpp:47
LibCarna::base::MeshBase
Format-independent abstract Mesh base class. Each mesh consists of a VertexBuffer,...
Definition
Mesh.hpp:67
LibCarna::base::MeshBase::MeshBase
MeshBase(const VertexAttributes &va, Association< VertexBufferBase > *vertexBuffer, Association< IndexBufferBase > *indexBuffer)
LibCarna::base::MeshBase::~MeshBase
virtual ~MeshBase() noexcept(false)
Deletes.
LibCarna::base::Mesh
Implements MeshBase class for particular VertexType and IndexType.
Definition
Mesh.hpp:138
LibCarna::base::Mesh::Vertex
VertexType Vertex
Holds the element type of the vertex buffer.
Definition
Mesh.hpp:148
LibCarna::base::Mesh::Index
IndexType Index
Holds the element type of the index buffer.
Definition
Mesh.hpp:149
LibCarna::base::VertexBufferBase
Maintains GL_ARRAY_BUFFER object that holds vertices. This class realizes the RAII-idiom.
Definition
VertexBuffer.hpp:46
LibCarna::base::VertexAttributes
std::vector< VertexAttribute > VertexAttributes
Defines VertexAttribute vector.
Definition
VertexAttributes.hpp:104
Written by Leonid Kostrykin © 2021–2025. Based on
Carna
(© 2010-2016).
Documentation generated by
Doxygen