neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
vertex_buffer.hpp
Go to the documentation of this file.
1
// vertex_buffer.hpp
2
/*
3
neogfx C++ App/Game Engine
4
Copyright (c) 2020 Leigh Johnston. All Rights Reserved.
5
6
This program is free software: you can redistribute it and / or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation, either version 3 of the License, or
9
(at your option) any later version.
10
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
15
16
You should have received a copy of the GNU General Public License
17
along with this program. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
#pragma once
21
22
#include <
neogfx/neogfx.hpp
>
23
#include <
neogfx/gfx/i_vertex_buffer.hpp
>
24
#include <
neogfx/gfx/i_shader_program.hpp
>
25
26
namespace
neogfx
27
{
28
// todo
29
class
vertex_buffer
:
public
i_vertex_buffer
30
{
31
public
:
32
vertex_buffer
(
i_vertex_provider
& aProvider,
vertex_buffer_type
aType) :
33
iProvider{ aProvider }, iType { aType }, iAttachedShader{ nullptr }
34
{
35
}
36
public
:
37
i_vertex_provider
&
vertex_provider
()
const override
38
{
39
return
iProvider;
40
}
41
vertex_buffer_type
buffer_type
()
const override
42
{
43
return
iType;
44
}
45
public
:
46
i_shader_program
&
attached_shader
()
const override
47
{
48
if
(iAttachedShader)
49
return
*iAttachedShader;
50
throw
shader_not_attached
();
51
}
52
void
attach_shader
(
i_rendering_context
& aContext,
i_shader_program
& aShaderProgram)
override
53
{
54
aShaderProgram.
instantiate
(aContext);
55
iAttachedShader = &aShaderProgram;
56
}
57
void
detach_shader
()
override
58
{
59
iAttachedShader =
nullptr
;
60
}
61
private
:
62
i_vertex_provider
& iProvider;
63
vertex_buffer_type
iType;
64
i_shader_program
* iAttachedShader;
65
};
66
}
neogfx::i_rendering_context
Definition
i_rendering_context.hpp:35
neogfx::i_shader_program
Definition
i_shader_program.hpp:69
neogfx::i_shader_program::instantiate
virtual void instantiate(const i_rendering_context &aContext)=0
neogfx::i_vertex_buffer
Definition
i_vertex_buffer.hpp:113
neogfx::i_vertex_provider
Definition
i_vertex_provider.hpp:28
neogfx::vertex_buffer
Definition
vertex_buffer.hpp:30
neogfx::vertex_buffer::vertex_provider
i_vertex_provider & vertex_provider() const override
Definition
vertex_buffer.hpp:37
neogfx::vertex_buffer::attached_shader
i_shader_program & attached_shader() const override
Definition
vertex_buffer.hpp:46
neogfx::vertex_buffer::attach_shader
void attach_shader(i_rendering_context &aContext, i_shader_program &aShaderProgram) override
Definition
vertex_buffer.hpp:52
neogfx::vertex_buffer::buffer_type
vertex_buffer_type buffer_type() const override
Definition
vertex_buffer.hpp:41
neogfx::vertex_buffer::vertex_buffer
vertex_buffer(i_vertex_provider &aProvider, vertex_buffer_type aType)
Definition
vertex_buffer.hpp:32
neogfx::vertex_buffer::detach_shader
void detach_shader() override
Definition
vertex_buffer.hpp:57
i_shader_program.hpp
i_vertex_buffer.hpp
neogfx
Definition
action.hpp:28
neogfx::vertex_buffer_type
vertex_buffer_type
Definition
i_vertex_buffer.hpp:32
neogfx.hpp
neogfx::i_vertex_buffer::shader_not_attached
Definition
i_vertex_buffer.hpp:115
include
neogfx
gfx
vertex_buffer.hpp
Generated by
1.9.8