Extension: parse vertex with colors(6 items)
| 1047 | |
| 1048 | // Extension: parse vertex with colors(6 items) |
| 1049 | static inline bool parseVertexWithColor(real_t *x, real_t *y, real_t *z, |
| 1050 | real_t *r, real_t *g, real_t *b, |
| 1051 | const char **token, |
| 1052 | const double default_x = 0.0, |
| 1053 | const double default_y = 0.0, |
| 1054 | const double default_z = 0.0) { |
| 1055 | (*x) = parseReal(token, default_x); |
| 1056 | (*y) = parseReal(token, default_y); |
| 1057 | (*z) = parseReal(token, default_z); |
| 1058 | |
| 1059 | const bool found_color = |
| 1060 | parseReal(token, r) && parseReal(token, g) && parseReal(token, b); |
| 1061 | |
| 1062 | if (!found_color) { |
| 1063 | (*r) = (*g) = (*b) = 1.0; |
| 1064 | } |
| 1065 | |
| 1066 | return found_color; |
| 1067 | } |
| 1068 | |
| 1069 | static inline bool parseOnOff(const char **token, bool default_value = true) { |
| 1070 | (*token) += strspn((*token), " \t"); |