-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathunusedcode.cpp
More file actions
105 lines (86 loc) · 2.58 KB
/
Copy pathunusedcode.cpp
File metadata and controls
105 lines (86 loc) · 2.58 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#if 0
typedef struct {
std::string classname;
std::string message;
std::string music;
std::string model;
glm::ivec3 origin;
int angle;
glm::fvec3 _color;
int ambient;
int light;
std::string targetname;
std::string target;
int spawnflags;
int radius;
} BSPEntity;
class j7Light {
public:
j7Light(aiVector3D pos, aiVector3D dir, aiColor3D amb, aiColor3D diff, aiColor3D spec) {
position.push_back(pos.x);
position.push_back(pos.y);
position.push_back(pos.z);
direction.push_back(dir.x);
direction.push_back(dir.y);
direction.push_back(dir.z);
colorAmbient.push_back(amb.r);
colorAmbient.push_back(amb.g);
colorAmbient.push_back(amb.b);
colorDiffuse.push_back(diff.r);
colorDiffuse.push_back(diff.g);
colorDiffuse.push_back(diff.b);
colorSpecular.push_back(spec.r);
colorSpecular.push_back(spec.g);
colorSpecular.push_back(spec.b);
std::cout << "Added new light at (" << position[0] << ',' << position[1] << ',' << position[2] << "), pointing at (" << direction[0] << ',' << direction[1] << ',' << direction[2] << ")\n";
}
void draw() {
// Place it
//Fixed function OpenGL only supports 8 lights. We're going to need shaders
/*glLightfv(GL_LIGHT0, GL_AMBIENT, colorAmbient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, colorDiffuse);
glLightfv(GL_LIGHT0, GL_SPECULAR, colorSpecular);
glLightfv(GL_LIGHT0, GL_POSITION, position);*/
}
private:
// Coordinates
std::vector<GLfloat> position;
std::vector<GLfloat> direction;
// Colors
std::vector<GLfloat> colorAmbient;
std::vector<GLfloat> colorDiffuse;
std::vector<GLfloat> colorSpecular;
};
class j7Material {
public:
std::vector<GLuint> diffuse_tex;
private:
};
void drawGround() {
static bool loaded=false;
static GLuint concretetex;
if(!loaded) {
sf::Image texture;
texture.loadFromFile("concrete.jpg");
glGenTextures(1, &concretetex);
glBindTexture(GL_TEXTURE_2D, concretetex);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, texture.getSize().x, texture.getSize().y, 0, GL_RGBA, GL_UNSIGNED_BYTE, texture.getPixelsPtr());
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
loaded=true;
}
glBindTexture(GL_TEXTURE_2D, concretetex);
glBegin(GL_QUADS);
glTexCoord2f(1,1);
glVertex3f(-50,-0.01f, 50);
glTexCoord2f(1,0);
glVertex3f( 50,-0.01f, 50);
glTexCoord2f(0,1);
glVertex3f( 50,-0.01f,-50);
glTexCoord2f(0,0);
glVertex3f(-50,-0.01f,-50);
glEnd();
}
#endif