Sat, 16 Mar 2013 03:42:04 +0200
Allow addition of dummy lines..
0 | 1 | #include "common.h" |
2 | #include <math.h> | |
3 | ||
13
3955ff2a7d72
Added logf function to write to message log. Write warnings of unparsable files into the message log.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
0
diff
changeset
|
4 | double GetWordFloat (str& s, const ushort n) { |
0 | 5 | return atof ((s / " ")[n]); |
6 | } | |
7 | ||
13
3955ff2a7d72
Added logf function to write to message log. Write warnings of unparsable files into the message log.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
0
diff
changeset
|
8 | long GetWordInt (str& s, const ushort n) { |
0 | 9 | return atol ((s / " ")[n]); |
10 | } | |
11 | ||
13
3955ff2a7d72
Added logf function to write to message log. Write warnings of unparsable files into the message log.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
0
diff
changeset
|
12 | vertex ParseVertex (str& s, const ushort n) { |
0 | 13 | vertex v; |
14 | v.x = GetWordFloat (s, n); | |
13
3955ff2a7d72
Added logf function to write to message log. Write warnings of unparsable files into the message log.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
0
diff
changeset
|
15 | v.y = GetWordFloat (s, n + 1); |
3955ff2a7d72
Added logf function to write to message log. Write warnings of unparsable files into the message log.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
0
diff
changeset
|
16 | v.z = GetWordFloat (s, n + 2); |
0 | 17 | |
18 | return v; | |
19 | } | |
20 | ||
21 | void StripWhitespace (str& s) { | |
22 | str other; | |
23 | ||
24 | for (size_t i = 0; i < ~s; i++) | |
25 | if (s[i] > 32 && s[i] < 127) | |
26 | other += s[i]; | |
27 | } | |
28 | ||
29 | vertex bearing::project (vertex& vSource, ulong ulLength) { | |
30 | vertex vDest = vSource; | |
31 | ||
32 | vDest.x += (cos (fAngle) * ulLength); | |
33 | vDest.y += (sin (fAngle) * ulLength); | |
34 | vDest.x += (cos (fPitch) * ulLength); | |
35 | vDest.z += (sin (fPitch) * ulLength); | |
36 | return vDest; | |
37 | } |