YourGameLib
Loading...
Searching...
No Matches
geometry.h
Go to the documentation of this file.
1/*
2Copyright (c) 2019-2024 Alexander Scholz
3
4This software is provided 'as-is', without any express or implied
5warranty. In no event will the authors be held liable for any damages
6arising from the use of this software.
7
8Permission is granted to anyone to use this software for any purpose,
9including commercial applications, and to alter it and redistribute it
10freely, subject to the following restrictions:
11
121. The origin of this software must not be misrepresented; you must not
13 claim that you wrote the original software. If you use this software
14 in a product, an acknowledgment in the product documentation would be
15 appreciated but is not required.
162. Altered source versions must be plainly marked as such, and must not be
17 misrepresented as being the original software.
183. This notice may not be removed or altered from any source distribution.
19*/
20#ifndef YOURGAME_GLGEOMETRY_H
21#define YOURGAME_GLGEOMETRY_H
22
23#include <string>
24#include <map>
25#include <vector>
26#include "yourgame/gl_include.h"
27#include "yourgame/gl/buffer.h"
28#include "yourgame/gl/shape.h"
29
30namespace yourgame
31{
32 namespace gl
33 {
35 {
36 public:
37 static Geometry *make();
38 ~Geometry();
39 bool addBuffer(std::string name, GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
40 bool bufferData(std::string name, GLsizeiptr size, const GLvoid *data);
41 bool addShape(std::string name,
42 std::vector<Shape::ArrBufferDescr> arDescrs,
43 std::vector<std::string> arBufferNames,
45 std::string elArBufferName);
46 bool addBufferToShape(std::string shapeName,
47 std::vector<Shape::ArrBufferDescr> arDescrs,
48 std::string bufferName);
49 bool setShapeElArDescr(std::string name,
51 void drawAll() const;
52 void drawAllInstanced(GLsizei instancecount) const;
53
54 /* deleting the copy constructor and the copy assignment operator
55 prevents copying (and moving) of the object. */
56 Geometry(Geometry const &) = delete;
57 Geometry &operator=(Geometry const &) = delete;
58
59 private:
60 Geometry() {}
61 std::map<std::string, Buffer *> m_buffers;
62 std::map<std::string, Shape *> m_shapes;
63 };
64 } // namespace gl
65} // namespace yourgame
66
67#endif
Definition geometry.h:35
bool addBuffer(std::string name, GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
Definition geometry.cpp:44
Geometry(Geometry const &)=delete
void drawAllInstanced(GLsizei instancecount) const
Definition geometry.cpp:137
bool addShape(std::string name, std::vector< Shape::ArrBufferDescr > arDescrs, std::vector< std::string > arBufferNames, Shape::ElemArrBufferDescr elArDescr, std::string elArBufferName)
Definition geometry.cpp:69
bool bufferData(std::string name, GLsizeiptr size, const GLvoid *data)
Definition geometry.cpp:59
bool setShapeElArDescr(std::string name, Shape::ElemArrBufferDescr elArDescr)
Definition geometry.cpp:118
~Geometry()
Definition geometry.cpp:31
Geometry & operator=(Geometry const &)=delete
bool addBufferToShape(std::string shapeName, std::vector< Shape::ArrBufferDescr > arDescrs, std::string bufferName)
Definition geometry.cpp:99
void drawAll() const
Definition geometry.cpp:129
static Geometry * make()
Definition geometry.cpp:26
Definition audio.h:27