Revision 692,
1.1 KB
checked in by mattausch, 19 years ago
(diff) |
adding ogre 1.2 and dependencies
|
Line | |
---|
1 | #include <vrmllib/types_bits.h>
|
---|
2 |
|
---|
3 | namespace vrmllib {
|
---|
4 | namespace bits {
|
---|
5 |
|
---|
6 | void parse_value(bool &b, std::istream &s, file &)
|
---|
7 | {
|
---|
8 | std::string t;
|
---|
9 | s >> t;
|
---|
10 | if (t == "TRUE")
|
---|
11 | b = true;
|
---|
12 | else if (t == "FALSE")
|
---|
13 | b = false;
|
---|
14 | else
|
---|
15 | throw std::runtime_error("parse error: expected TRUE or FALSE, got: " + t);
|
---|
16 | }
|
---|
17 |
|
---|
18 | void parse_value(std::string &str, std::istream &s, file &)
|
---|
19 | {
|
---|
20 | char c = 0;
|
---|
21 | s >> c;
|
---|
22 |
|
---|
23 | if (c != '"') {
|
---|
24 | s.putback(c);
|
---|
25 | throw std::runtime_error(std::string("expected start of string (\"), got: ") + c);
|
---|
26 | }
|
---|
27 | str.erase();
|
---|
28 | c = 0;
|
---|
29 | while (s.get(c) && c != '"') str += c;
|
---|
30 |
|
---|
31 | if (c != '"') {
|
---|
32 | throw std::runtime_error(std::string("expected end of string (\"), got: ") + c);
|
---|
33 | }
|
---|
34 | }
|
---|
35 |
|
---|
36 | void parse_value(vec3 &v, std::istream &s, file &)
|
---|
37 | {
|
---|
38 | s >> v.x >> v.y >> v.z;
|
---|
39 | }
|
---|
40 |
|
---|
41 | void parse_value(col3 &v, std::istream &s, file &)
|
---|
42 | {
|
---|
43 | s >> v.r >> v.g >> v.b;
|
---|
44 | }
|
---|
45 |
|
---|
46 | void parse_value(vec2 &v, std::istream &s, file &)
|
---|
47 | {
|
---|
48 | s >> v.x >> v.y;
|
---|
49 | }
|
---|
50 |
|
---|
51 | void parse_value(rot &r, std::istream &s, file &f)
|
---|
52 | {
|
---|
53 | parse_value(r.vector, s, f);
|
---|
54 | s >> r.radians;
|
---|
55 | }
|
---|
56 |
|
---|
57 | } // namespace bits
|
---|
58 | } // namespace vrmllib
|
---|
Note: See
TracBrowser
for help on using the repository browser.