-
Notifications
You must be signed in to change notification settings - Fork 0
/
util.cpp
59 lines (48 loc) · 846 Bytes
/
util.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
#include <stdio.h>
#include "util.h"
float Max(float a, float b) {
if (a > b) {
return a;
} else {
return b;
}
}
float Min(float a, float b) {
if (a < b) {
return a;
} else {
return b;
}
}
void read_vec4(istream &in, vec4 &v) {
char dummy;
in >> dummy;
in >> v.x;
in >> dummy;
in >> v.y;
in >> dummy;
in >> v.z;
in >> dummy;
in >> v.w;
in >> dummy;
}
void read_vec3(istream &in, vec3 &v) {
char dummy;
in >> dummy;
in >> v.x;
in >> dummy;
in >> v.y;
in >> dummy;
in >> v.z;
in >> dummy;
}
void skip_to(istream &in, char target_ch) {
char ch;
do {
in.get(ch);
} while (!in.eof() && ch != target_ch);
}
void skip_line(istream &in) {
skip_to(in, '\n');
dprint("skipped comment");
}