sculpto
vertex_array.h
Go to the documentation of this file.
1/*!****************************************************************//*!*
2 * \file mesh.h
3 * \brief Mesh interfaces definition module.
4 * Mesh stores vertex and index buffer and implement their binding during render.
5 *
6 * \author Sabitov Kirill
7 * \date 27 June 2022
8 *********************************************************************/
9
10#pragma once
11
12#include "buffer.h"
13
14namespace scl
15{
17 enum class mesh_type
18 {
19 LINES,
20 POINTS,
21 PATCHES,
22 TRIANGLES,
23 TRISTRIP,
24 };
25
27 class vertex_array : public render_primitive
28 {
29 protected:
33
34 public:
36 mesh_type GetType() const { return Type; }
41
46
47 public:
49 vertex_array(mesh_type MeshType);
50
52 virtual ~vertex_array() = default;
53
54 /*!*
55 * Bind vertex array to current render stage function.
56 *
57 * \param None.
58 * \return None.
59 */
60 virtual void Bind() const = 0;
61
62 /*!*
63 * Unbind vertex array from current render stage function.
64 *
65 * \param None.
66 * \return None.
67 */
68 virtual void Unbind() const = 0;
69
70 /*!*
71 * Create vertex array function.
72 *
73 * \param Type - creating mesh type.
74 * \param VertexBuffer - vertex buffer to link to vertex array.
75 * \param IndexBuffer - vartex indicies buffer to be linked to vertex array.
76 * \return pointer to created vertex array.
77 */
78 static shared<vertex_array> Create(mesh_type Mesh_type);
79 };
80}
Buffer interfaces implementation module.
virtual void Bind() const =0
const shared< index_buffer > & GetIndexBuffer() const
Definition: vertex_array.h:40
virtual ~vertex_array()=default
vertex_array(mesh_type MeshType)
virtual void SetIndexBuffer(const shared< index_buffer > &IndexBuffer)=0
shared< vertex_buffer > VertexBuffer
Definition: vertex_array.h:31
virtual void Unbind() const =0
static shared< vertex_array > Create(mesh_type Mesh_type)
const shared< vertex_buffer > & GetVertexBuffer() const
Definition: vertex_array.h:38
virtual void SetVertexBuffer(const shared< vertex_buffer > &VertexBuffer)=0
mesh_type GetType() const
Definition: vertex_array.h:36
shared< index_buffer > IndexBuffer
Definition: vertex_array.h:32
Definition: base.h:33
std::shared_ptr< T > shared
Definition: smart_ptr.h:15
mesh_type
Definition: vertex_array.h:18