equal
deleted
inserted
replaced
410 } |
410 } |
411 getline(st, s, ')'); |
411 getline(st, s, ')'); |
412 } |
412 } |
413 } |
413 } |
414 |
414 |
415 istream & KdTree::load(istream &st) |
415 istream & KdTree::load(istream &st, Material *mat) |
416 { |
416 { |
417 string s; |
417 string s; |
418 istringstream is; |
418 istringstream is; |
419 |
419 |
420 getline(st, s, ','); |
420 getline(st, s, ','); |
421 if (s.compare("(kdtree") != 0) |
421 if (s.compare("(kdtree") != 0) |
422 return st; |
422 return st; |
|
423 |
|
424 dbgmsg(1, "* loading kd-tree\n"); |
423 |
425 |
424 shapes.clear(); |
426 shapes.clear(); |
425 if (root) delete root; |
427 if (root) delete root; |
426 root = new KdNode(); |
428 root = new KdNode(); |
427 |
429 |
431 is >> shape_count; |
433 is >> shape_count; |
432 |
434 |
433 Shape *shape; |
435 Shape *shape; |
434 for (int i = 0; i < shape_count; i++) |
436 for (int i = 0; i < shape_count; i++) |
435 { |
437 { |
436 shape = loadShape(st); |
438 shape = loadShape(st, mat); |
437 Container::addShape(shape); |
439 Container::addShape(shape); |
438 getline(st, s, ','); |
440 getline(st, s, ','); |
439 } |
441 } |
440 |
442 |
441 recursive_load(st, root); |
443 recursive_load(st, root); |