ModelInfo.cpp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include <Textur.h>
  2. #include "ModelInfo.h"
  3. #include "Globals.h"
  4. using namespace Framework;
  5. ModelInfo::ModelInfo(Framework::StreamReader* reader)
  6. {
  7. char len;
  8. reader->lese(&len, 1);
  9. char* path = new char[len + 1];
  10. reader->lese(path, len);
  11. path[len] = 0;
  12. modelPath = path;
  13. delete[] path;
  14. short count;
  15. reader->lese((char*)&count, 2);
  16. for (int i = 0; i < count; i++)
  17. {
  18. reader->lese(&len, 1);
  19. path = new char[len + 1];
  20. reader->lese(path, len);
  21. path[len] = 0;
  22. texturPaths.add(new Text(path));
  23. delete[] path;
  24. }
  25. }
  26. Framework::Model3DData* ModelInfo::getModel() const
  27. {
  28. return uiFactory.initParam.bildschirm->zGraphicsApi()->getModel(modelPath);
  29. }
  30. Framework::Model3DTextur* ModelInfo::getTexture() const
  31. {
  32. Model3DTextur* textur = new Model3DTextur();
  33. int index = 0;
  34. for (Text* texturPath : texturPaths)
  35. {
  36. Textur* tex = uiFactory.initParam.bildschirm->zGraphicsApi()->createOrGetTextur(texturPath->getText(), 0);
  37. textur->setPolygonTextur(index++, dynamic_cast<Textur*>(tex));
  38. }
  39. return textur;
  40. }