-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildings.cpp
124 lines (84 loc) · 1.62 KB
/
buildings.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
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#include "buildings.h"
#include <Windows.h>
#include <gl\gl.h>
#include <gl\glu.h>
building::building()
{
bM = 0;
}
void buildings::LoadModels(char *filename)
{
bM.Load(filename);
/*
std::ifstream f(filename);
std::string name;
double length;
int n;
f >> n;
model *tempM;
for (int i = 0; i < n; i++)
{
f >> length;
f.ignore();
f >> name;
tempM = new model;
std::string s = "buildings/" + name + "/";
tempM->Open(s.c_str());
bModels.push_back(*tempM);
delete tempM;
}
f.close();
*/
}
void buildings::LoadBuildings(char *filename)
{
std::ifstream f(filename);
int nr;
f >> nr;
building temp;
int mNr;//model nr
for (int i = 0; i < nr; i++)
{
f >> temp.r[0] >> temp.r[1] >> temp.d >> mNr;
temp.bM = &bM.bM[mNr];
b.push_back(temp);
}
f.close();
}
int buildings::Load(char *filenameModels,char *filenameBuildings)
{
LoadBuildings(filenameBuildings);
return 0;
}
void buildings::Clear()
{
b.clear();
}
/*
void buildings::Draw()
{
for (int i = 0; i < b.size(); i++)
{
int ra, rb;
ra = b[i].r[0];
rb = b[i].r[1];
point pa, pb, p;
pa = c->p[ra].pos;
pb = c->p[rb].pos;
double l = b[i].d / Length(pa, pb);
p = pa + ((pb - pa)*l);
point side;
side = pb - pa;
side.Norm();
side *= c->LanesNr(ra, rb);
side.Rotate();
p += side;
double k = Angle(pa, pb);
//glTranslated(p.x, 0, p.y);
//glRotated(k, 0, -1, 0);
bModels[b[i].mNr].Draw(p, k);
//glRotated(k, 0, 1, 0);
//glTranslated(-p.x, 0, -p.y);
}
}
*/