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>
25
26namespace neogfx
27{
28 // todo
30 {
31 public:
33 iProvider{ aProvider }, iType { aType }, iAttachedShader{ nullptr }
34 {
35 }
36 public:
38 {
39 return iProvider;
40 }
42 {
43 return iType;
44 }
45 public:
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;
64 i_shader_program* iAttachedShader;
65 };
66}
virtual void instantiate(const i_rendering_context &aContext)=0
i_vertex_provider & vertex_provider() const override
i_shader_program & attached_shader() const override
void attach_shader(i_rendering_context &aContext, i_shader_program &aShaderProgram) override
vertex_buffer_type buffer_type() const override
vertex_buffer(i_vertex_provider &aProvider, vertex_buffer_type aType)
void detach_shader() override