Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
glimBatch.h
Go to the documentation of this file.
1/*
2** GLIM - OpenGL Immediate Mode
3** Copyright Jan Krassnigg (Jan@Krassnigg.de)
4** For more details, see the included Readme.txt.
5*/
6
7#ifndef GLIM_GLIMBATCH_H
8#define GLIM_GLIMBATCH_H
9
10#include "glimBatchData.h"
11
12namespace NS_GLIM
13{
16 {
17 public:
18 GLIM_BATCH();
19 ~GLIM_BATCH() = default;
20
21 // Begins defining one piece of geometry that can later be rendered with one set of states.
22 void BeginBatch (bool reserveBuffers = true, unsigned int vertexCount = 64 * 3, unsigned int attributeCount = 1);
24 glimBatchData& EndBatch (void) noexcept;
25
27 bool PrepareRender();
28
30 void Begin (GLIM_ENUM eType) noexcept;
32 void End (void);
33
35 void Vertex (float x, float y, float z = 0.0f);
37 GLIM_ATTRIBUTE Attribute1f (unsigned int attribLocation, float a1);
39 GLIM_ATTRIBUTE Attribute2f (unsigned int attribLocation, float a1, float a2);
41 GLIM_ATTRIBUTE Attribute3f (unsigned int attribLocation, float a1, float a2, float a3);
43 GLIM_ATTRIBUTE Attribute4f (unsigned int attribLocation, float a1, float a2, float a3, float a4);
44
46 GLIM_ATTRIBUTE Attribute1i (unsigned int attribLocation, int a1);
48 GLIM_ATTRIBUTE Attribute2i (unsigned int attribLocation, int a1, int a2);
50 GLIM_ATTRIBUTE Attribute3i (unsigned int attribLocation, int a1, int a2, int a3);
52 GLIM_ATTRIBUTE Attribute4i (unsigned int attribLocation, int a1, int a2, int a3, int a4);
53
55 GLIM_ATTRIBUTE Attribute4ub (unsigned int attribLocation, unsigned char a1, unsigned char a2, unsigned char a3, unsigned char a4 = 255);
56
57
59 void Attribute1f (GLIM_ATTRIBUTE Attr, float a1) noexcept;
61 void Attribute2f (GLIM_ATTRIBUTE Attr, float a1, float a2) noexcept;
63 void Attribute3f (GLIM_ATTRIBUTE Attr, float a1, float a2, float a3) noexcept;
65 void Attribute4f (GLIM_ATTRIBUTE Attr, float a1, float a2, float a3, float a4) noexcept;
66
68 void Attribute1i (GLIM_ATTRIBUTE Attr, int a1) noexcept;
70 void Attribute2i (GLIM_ATTRIBUTE Attr, int a1, int a2) noexcept;
72 void Attribute3i (GLIM_ATTRIBUTE Attr, int a1, int a2, int a3) noexcept;
74 void Attribute4i (GLIM_ATTRIBUTE Attr, int a1, int a2, int a3, int a4) noexcept;
75
77 void Attribute4ub (GLIM_ATTRIBUTE Attr, unsigned char a1, unsigned char a2, unsigned char a3, unsigned char a4 = 255) noexcept;
78
80 void Clear (bool reserveBuffers, unsigned int vertexCount, unsigned int attributeCount);
81
83 bool isCleared (void) const noexcept {return m_Data.m_State == GLIM_BATCH_STATE::STATE_EMPTY;}
84
85 private:
87 const GLIM_BATCH& operator= (const GLIM_BATCH& cc);
88
89 // The currently generated primitive type as specified via 'Begin'
91
92 // Counts how many vertices have been added since 'Begin'
93 unsigned int m_uiPrimitiveVertex;
94 // The index of the first vertex passed after 'Begin'
96 // The Index of the Vertex passed previously.
98
100 };
101}
102
103#pragma once
104
105
106#endif
107
108
An Implementation of the GLIM_Interface.
Definition: glimBatch.h:16
void Vertex(float x, float y, float z=0.0f)
Specifies a new vertex of a primitive.
Definition: glimBatch.cpp:192
void BeginBatch(bool reserveBuffers=true, unsigned int vertexCount=64 *3, unsigned int attributeCount=1)
Definition: glimBatch.cpp:39
GLIM_ATTRIBUTE Attribute4i(unsigned int attribLocation, int a1, int a2, int a3, int a4)
Specifies a new value for the attribute with the given name.
GLIM_ATTRIBUTE Attribute4ub(unsigned int attribLocation, unsigned char a1, unsigned char a2, unsigned char a3, unsigned char a4=255)
Specifies a new value for the attribute with the given name.
GLIM_ATTRIBUTE Attribute3i(unsigned int attribLocation, int a1, int a2, int a3)
Specifies a new value for the attribute with the given name.
glimBatchData & EndBatch(void) noexcept
Ends defining the batch. After this call "RenderBatch" can be called to actually render it.
Definition: glimBatch.cpp:50
unsigned int m_uiPrimitiveFirstIndex
Definition: glimBatch.h:95
GLIM_ATTRIBUTE Attribute1i(unsigned int attribLocation, int a1)
Specifies a new value for the attribute with the given location.
void Begin(GLIM_ENUM eType) noexcept
Begins gathering information about the given type of primitives.
Definition: glimBatch.cpp:61
const GLIM_BATCH & operator=(const GLIM_BATCH &cc)
GLIM_BATCH(const GLIM_BATCH &cc)
glimBatchData m_Data
Definition: glimBatch.h:99
GLIM_ATTRIBUTE Attribute2i(unsigned int attribLocation, int a1, int a2)
Specifies a new value for the attribute with the given name.
GLIM_ATTRIBUTE Attribute1f(unsigned int attribLocation, float a1)
Specifies a new value for the attribute with the given name.
void End(void)
Ends gathering information about the primitives.
Definition: glimBatch.cpp:99
GLIM_ATTRIBUTE Attribute2f(unsigned int attribLocation, float a1, float a2)
Specifies a new value for the attribute with the given name.
unsigned int m_uiPrimitiveLastIndex
Definition: glimBatch.h:97
GLIM_ENUM m_PrimitiveType
Definition: glimBatch.h:90
unsigned int m_uiPrimitiveVertex
Definition: glimBatch.h:93
bool PrepareRender()
Renders n instances of the batch that has been defined previously.
Definition: glimBatch.cpp:28
GLIM_ATTRIBUTE Attribute3f(unsigned int attribLocation, float a1, float a2, float a3)
Specifies a new value for the attribute with the given name.
void Clear(bool reserveBuffers, unsigned int vertexCount, unsigned int attributeCount)
Deletes all data associated with this object.
Definition: glimBatch.cpp:22
bool isCleared(void) const noexcept
Returns true if the GLIM_BATCH contains no batch data.
Definition: glimBatch.h:83
GLIM_ATTRIBUTE Attribute4f(unsigned int attribLocation, float a1, float a2, float a3, float a4)
Specifies a new value for the attribute with the given name.
GLIM_ENUM
The enum holding all important GLIM configuration values.
Definition: Declarations.h:17
GLIM_BATCH_STATE m_State
Definition: glimBatchData.h:69