forked from mrkite/TerraFirma
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrender.h
52 lines (40 loc) · 1.33 KB
/
render.h
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
41
42
43
44
45
46
47
48
49
50
51
52
/** @Copyright 2015 seancode */
#ifndef RENDER_H_
#define RENDER_H_
#include <QOpenGLBuffer>
#include <QOpenGLVertexArrayObject>
#include <QOpenGLFunctions>
#include "./gltextures.h"
class Render {
public:
Render();
void init(QOpenGLFunctions *gl);
void destroy();
void setTexturePath(QString path);
bool texturesValid() const;
QSharedPointer<QOpenGLTexture> get(int type);
void add(int type, int x, int y, int texw, int texh, qint16 u, qint16 v,
GLfloat z, quint8 paint, bool hilite,
bool fliph = false, bool flipv = false);
void addLiquid(int type, int x, int y, int texw, int texh, qint16 v,
GLfloat z, GLfloat alpha);
void addSlope(int type, int slope, int x, int y, int texw, int texh,
qint16 u, qint16 v, GLfloat z, quint8 paint, bool hilite);
void addFog(int x, int y, GLfloat z = 0.0f);
void apply();
void applyLiquid();
void applyFog();
void drawBG(int type, int cropw, int croph, GLfloat x, GLfloat y,
int w, int h);
void drawFlat(int x, int y, int x2, int y2);
private:
QHash<int, QVector<GLfloat>> buffers;
QVector<GLfloat> buffer;
QHash<int, QVector<unsigned int>> indices;
QVector<unsigned int> index;
GLTextures textures;
QOpenGLVertexArrayObject vao;
QOpenGLBuffer vbo, ibo;
QOpenGLFunctions *gl;
};
#endif // RENDER_H_