-
Notifications
You must be signed in to change notification settings - Fork 0
/
factory.d
39 lines (36 loc) · 1.31 KB
/
factory.d
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
/**
* Copyright: Copyright (C) 2018 Gabriel Gheorghe, All Rights Reserved
* Authors: $(Gabriel Gheorghe)
* License: $(LINK2 https://www.gnu.org/licenses/gpl-3.0.txt, GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007)
* Source: $(LINK2 https://github.com/GabyForceQ/LibertyEngine/blob/master/source/liberty/graphics/factory.d)
* Documentation:
* Coverage:
**/
module liberty.graphics.factory;
import bindbc.opengl;
import liberty.graphics.buffer.array;
import liberty.graphics.buffer.constants;
import liberty.graphics.buffer.impl;
import liberty.graphics.constants;
/// Graphics renderer factory interface is implemented and used by models.
interface IGfxRendererFactory {
///
static void drawElements(GfxDrawMode drawMode, GfxVectorType type, size_t count) {
GLenum _drawMode, _type;
final switch (drawMode) with (GfxDrawMode) {
case TRIANGLES: _drawMode = GL_TRIANGLES;
}
final switch (type) with (GfxVectorType) {
case UINT: _type = GL_UNSIGNED_INT;
}
glDrawElements(_drawMode, cast(int)count, _type, null);
}
///
static void drawArrays(GfxDrawMode drawMode, size_t count) {
GLenum _drawMode;
final switch (drawMode) with (GfxDrawMode) {
case TRIANGLES: _drawMode = GL_TRIANGLES;
}
glDrawArrays(_drawMode, 0, cast(int)count);
}
}