YourGameLib
Loading...
Searching...
No Matches
include
toolbox
yourgame
gl
shape.h
Go to the documentation of this file.
1
/*
2
Copyright (c) 2019-2024 Alexander Scholz
3
4
This software is provided 'as-is', without any express or implied
5
warranty. In no event will the authors be held liable for any damages
6
arising from the use of this software.
7
8
Permission is granted to anyone to use this software for any purpose,
9
including commercial applications, and to alter it and redistribute it
10
freely, subject to the following restrictions:
11
12
1. 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.
16
2. Altered source versions must be plainly marked as such, and must not be
17
misrepresented as being the original software.
18
3. This notice may not be removed or altered from any source distribution.
19
*/
20
#ifndef YOURGAME_GLSHAPE_H
21
#define YOURGAME_GLSHAPE_H
22
23
#include <vector>
24
#include "
yourgame/gl_include.h
"
25
#include "
yourgame/gl/buffer.h
"
26
27
namespace
yourgame
28
{
29
namespace
gl
30
{
31
class
Shape
32
{
33
public
:
34
struct
ArrBufferDescr
35
{
36
GLuint
index
;
37
GLint
size
;
38
GLenum
type
;
39
GLboolean
normalized
;
40
GLsizei
stride
;
41
const
GLvoid *
pointer
;
42
GLuint
attribDivisor
;
43
};
44
45
struct
ElemArrBufferDescr
46
{
47
GLenum
type
;
48
GLenum
drawMode
;
49
GLsizei
numElements
;
50
};
51
52
static
Shape
*
make
(std::vector<ArrBufferDescr> arDescrs,
53
std::vector<Buffer *> arBuffers,
54
ElemArrBufferDescr
elArDescr,
55
Buffer
*elArBuffer);
56
bool
setElArDescr
(
Shape::ElemArrBufferDescr
elArDescr);
57
bool
addArrBuf
(
ArrBufferDescr
arDescr,
Buffer
*buf);
58
~Shape
();
59
void
draw
();
60
void
drawInstanced
(GLsizei instancecount);
61
62
/* deleting the copy constructor and the copy assignment operator
63
prevents copying (and moving) of the object. */
64
Shape
(
Shape
const
&) =
delete
;
65
Shape
&
operator=
(
Shape
const
&) =
delete
;
66
67
private
:
68
Shape
() {}
69
ElemArrBufferDescr m_elArDescr;
70
GLuint m_vaoHandle;
71
};
72
}
// namespace gl
73
}
// namespace yourgame
74
75
#endif
buffer.h
yourgame::gl::Buffer
Definition
buffer.h:30
yourgame::gl::Shape
Definition
shape.h:32
yourgame::gl::Shape::draw
void draw()
Definition
shape.cpp:98
yourgame::gl::Shape::addArrBuf
bool addArrBuf(ArrBufferDescr arDescr, Buffer *buf)
Definition
shape.cpp:68
yourgame::gl::Shape::~Shape
~Shape()
Definition
shape.cpp:93
yourgame::gl::Shape::Shape
Shape(Shape const &)=delete
yourgame::gl::Shape::make
static Shape * make(std::vector< ArrBufferDescr > arDescrs, std::vector< Buffer * > arBuffers, ElemArrBufferDescr elArDescr, Buffer *elArBuffer)
Definition
shape.cpp:26
yourgame::gl::Shape::operator=
Shape & operator=(Shape const &)=delete
yourgame::gl::Shape::setElArDescr
bool setElArDescr(Shape::ElemArrBufferDescr elArDescr)
Definition
shape.cpp:62
yourgame::gl::Shape::drawInstanced
void drawInstanced(GLsizei instancecount)
Definition
shape.cpp:105
gl_include.h
yourgame
Definition
audio.h:27
yourgame::gl::Shape::ArrBufferDescr
Definition
shape.h:35
yourgame::gl::Shape::ArrBufferDescr::normalized
GLboolean normalized
Definition
shape.h:39
yourgame::gl::Shape::ArrBufferDescr::pointer
const GLvoid * pointer
Definition
shape.h:41
yourgame::gl::Shape::ArrBufferDescr::index
GLuint index
Definition
shape.h:36
yourgame::gl::Shape::ArrBufferDescr::stride
GLsizei stride
Definition
shape.h:40
yourgame::gl::Shape::ArrBufferDescr::type
GLenum type
Definition
shape.h:38
yourgame::gl::Shape::ArrBufferDescr::size
GLint size
Definition
shape.h:37
yourgame::gl::Shape::ArrBufferDescr::attribDivisor
GLuint attribDivisor
Definition
shape.h:42
yourgame::gl::Shape::ElemArrBufferDescr
Definition
shape.h:46
yourgame::gl::Shape::ElemArrBufferDescr::drawMode
GLenum drawMode
Definition
shape.h:48
yourgame::gl::Shape::ElemArrBufferDescr::numElements
GLsizei numElements
Definition
shape.h:49
yourgame::gl::Shape::ElemArrBufferDescr::type
GLenum type
Definition
shape.h:47
Generated by
1.9.8