hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/src/platform/opengl/opengl_vertex_array.h
blob: d6986db89d41e1f82385f4317aa6c158ce7e8d7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once

#include "rendering/vertex_array.h"
#include "rendering/vertex_buffer.h"
#include "rendering/index_buffer.h"

#include <vector>
#include <memory>

namespace Donut
{
    class OpenGLVertexArray 
        : public VertexArray 
        {
    public:
        OpenGLVertexArray();
        virtual ~OpenGLVertexArray();

        virtual void bind() const override;
        virtual void unbind() const override;

        virtual void add_vertex_buffer(const std::shared_ptr<VertexBuffer>& vertex_buffer) override;
        virtual void set_index_buffer(const std::shared_ptr<IndexBuffer>& index_buffer) override;

        virtual const std::vector<std::shared_ptr<VertexBuffer>>& get_vertex_buffers() const override 
        { 
            return m_vertex_buffers; 
        }
        
        virtual const std::shared_ptr<IndexBuffer>& get_index_buffer() const override 
        { 
            return m_index_buffer; 
        }
    private:
        uint32_t m_renderer_id;
        uint32_t m_vertex_buffer_index = 0;
        std::vector<std::shared_ptr<VertexBuffer>> m_vertex_buffers;
        std::shared_ptr<IndexBuffer>               m_index_buffer;
    };
};