-
Notifications
You must be signed in to change notification settings - Fork 0
/
ground.cpp
64 lines (49 loc) · 1.29 KB
/
ground.cpp
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
#include "ground.h"
#include <QtOpenGL/qgl.h>
Ground::Ground()
{
midaX = 30;
midaY = 0.5;
midaZ = 30;
}
void Ground::Init(double sx, double sz)
{
midaX = sx;
midaZ = sz;
}
void Ground::Render()
{
//glColor3f(0.1, 0.1, 0.4);
GLfloat rgba[] = { 0.1, 0.1, 0.4, 0.0 };
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, rgba);
glNormal3f(0, 1, 0);
glBegin(GL_QUADS);
glVertex3f(0, 0, 0);
glVertex3f(0, 0, midaZ);
glVertex3f(midaX, 0, midaZ);
glVertex3f(midaX, 0, 0);
glVertex3f(0, -midaY, 0);
glVertex3f(0, -midaY, midaZ);
glVertex3f(midaX, -midaY, midaZ);
glVertex3f(midaX, -midaY, 0);
glVertex3f(0, 0, 0);
glVertex3f(0, -midaY, 0);
glVertex3f(0, -midaY, midaZ);
glVertex3f(0, 0, midaZ);
glVertex3f(midaX, 0, 0);
glVertex3f(midaX, -midaY, 0);
glVertex3f(midaX, -midaY, midaZ);
glVertex3f(midaX, 0, midaZ);
glVertex3f(0, 0, 0);
glVertex3f(midaX, 0, 0);
glVertex3f(midaX, -midaY, 0);
glVertex3f(0, -midaY, 0);
glVertex3f(0, 0, midaZ);
glVertex3f(midaX, 0, midaZ);
glVertex3f(midaX, -midaY, midaZ);
glVertex3f(0, -midaY, midaZ);
glEnd();
}
double Ground::MidaX () { return midaX; }
double Ground::MidaY () { return midaY; }
double Ground::MidaZ () { return midaZ; }