-
Notifications
You must be signed in to change notification settings - Fork 0
/
Renderer.h
78 lines (59 loc) · 1.13 KB
/
Renderer.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
77
78
/*
* Renderer.h
*
* Created on: Apr 4, 2012
* Author: iraklis
*/
#ifndef RENDERER_H_
#define RENDERER_H_
#include <NativeUI/GlView.h>
#include <NativeUI/GlViewListener.h>
#include <GLES/gl.h>
#include <madmath.h>
using namespace NativeUI;
struct vector{
float x;
float y;
float z;
};
struct landSegment{
GLfloat vcoords[4][3];
GLfloat tcoords[4][2];
vector normalVector[2];
float distance[2];
};
struct landscape{
int numSegments;
landSegment *segments;
};
struct camera{
vector position;
vector facing;
};
class Renderer : public GLViewListener
{
public:
void init(GLView *glView);
void setLandscape(landscape *ls);
void setCamera(camera *c);
void glViewReady(GLView* glView);
void draw();
private:
void setViewport(int width, int height);
void gluPerspective(
GLfloat fovy,
GLfloat aspect,
GLfloat zNear,
GLfloat zFar);
void renderLandscape();
// Create the texture we will use for rendering.
void createTexture();
// Initialize OpenGL.
void initGL();
GLView *mGLView;
GLuint mLunarTexture;
bool mEnvironmentInitialized;
camera *mCamera;
landscape *mLandscape;
};
#endif /* RENDERER_H_ */