SLA Contour3D expanded with conversions supporting quads.

This commit is contained in:
tamasmeszaros 2019-11-04 14:33:29 +01:00
parent a8a5a884f9
commit 7808d09d06
14 changed files with 7777 additions and 259 deletions

View file

@ -355,6 +355,35 @@ bool objparse(const char *path, ObjData &data)
return true;
}
bool objparse(std::istream &stream, ObjData &data)
{
try {
char buf[65536 * 2];
size_t len = 0;
size_t lenPrev = 0;
while ((len = size_t(stream.read(buf + lenPrev, 65536).gcount())) != 0) {
len += lenPrev;
size_t lastLine = 0;
for (size_t i = 0; i < len; ++ i)
if (buf[i] == '\r' || buf[i] == '\n') {
buf[i] = 0;
char *c = buf + lastLine;
while (*c == ' ' || *c == '\t')
++ c;
obj_parseline(c, data);
lastLine = i + 1;
}
lenPrev = len - lastLine;
memmove(buf, buf + lastLine, lenPrev);
}
}
catch (std::bad_alloc&) {
printf("Out of memory\r\n");
}
return true;
}
template<typename T>
bool savevector(FILE *pFile, const std::vector<T> &v)
{