-
Notifications
You must be signed in to change notification settings - Fork 2
/
OpenGLRenderer.h
76 lines (56 loc) · 2.67 KB
/
OpenGLRenderer.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#pragma once
#include "IRenderer.h"
#include "OpenGLRenderTarget.h"
#include "OpenGLTexturePool.h"
#include "OpenGLShaderProgramPool.h"
#include "dawn.h"
namespace dawn
{
class OpenGLRenderer : public IRenderer
{
public:
OpenGLRenderer();
virtual ~OpenGLRenderer() { }
void render(Scene3D *scene);
void render(Camera *camera, Object3D *stage, unsigned int width, unsigned int height);
private:
void Render(const mat4f &projection, const mat4f viewmodel, Object3D *object, OpenGLRenderTargetPtr target = NULL);
void RenderFullscreenQuad(OpenGLShaderProgramPtr shader, UniformMap uniforms);
void PrepareMask();
void ApplyBasicMaterial(Material *material);
void ApplyFilterMaterial(const mat4f &mvp, FilterMaterial *material);
void ApplyShaderMaterial(const mat4f &mvp, ShaderMaterial *material);
void ApplyShader(OpenGLShaderProgramPtr shader, UniformMap uniforms);
void ApplyMaterial(const mat4f &mvp, Material *material);
void RenderRaw(const vec3farray &positions, const vec4farray color, const vec2farray &uv, const iarray &indices);
void RenderPolygon(const vec2farray &positions, vec4f uv);
void RenderPlane(float w, float h, vec4f uv);
void RenderEllipsisArc(float w2, float h2, float angle1, float angle2, unsigned int segments, vec4f uv);
void RenderRaw(RawGeometry *raw);
void RenderPolygon(PolygonGeometry *polygon);
void RenderArc(ArcGeometry *arc);
void RenderEllipsis(EllipsisGeometry *ellipsis);
void RenderPlane(PlaneGeometry *plane);
void RenderRoundedRectangle(RoundedRectangleGeometry *rect);
void RenderFillPathGeometry(FillPathGeometry *path);
void RenderStrokePathGeometry(StrokePathGeometry *path);
void RenderGeometry(Geometry *geometry);
void RenderMesh3D(const mat4f &mvp, Mesh3D *mesh);
void RenderObject3D(const mat4f &projection, const mat4f viewmodel, Object3D *object, OpenGLRenderTargetPtr target);
void InitializeGL();
typedef std::pair<OpenGLShaderProgramPtr, UniformMap> OpenGLFilter; // TODO Move to opengl_types.h?
void GetFilterPasses(Filter *filter, std::vector<OpenGLFilter> &passes);
OpenGLRenderTargetPtr AcquireRenderTarget(unsigned int width, unsigned int height); // TODO Move to a util of sorts?
void ReleaseRenderTarget(OpenGLRenderTargetPtr target);
unsigned int m_width;
unsigned int m_height;
typedef std::vector<OpenGLRenderTargetPtr> RenderTargetList;
RenderTargetList m_targets;
OpenGLTexturePool m_textures;
OpenGLShaderProgramPool m_shaders;
OpenGLTexturePtr m_backbufferTexture;
typedef std::pair<Mask3D *, mat4f> Mask;
typedef std::vector<Mask> MaskList;
MaskList m_masks;
};
}