ModelInfo.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #include "ModelInfo.h"
  2. using namespace Framework;
  3. ModelInfo::ModelInfo(
  4. const char* modelPath, const char* texturPath, int textureCount)
  5. : modelPath(modelPath),
  6. transparent(1)
  7. {
  8. for (int i = 0; i < textureCount; i++)
  9. texturePaths.add(new Text(texturPath));
  10. }
  11. ModelInfo::ModelInfo(
  12. const char* modelPath, std::initializer_list<const char*> texturePaths)
  13. : modelPath(modelPath)
  14. {
  15. for (const char* texturPath : texturePaths)
  16. this->texturePaths.add(new Text(texturPath));
  17. }
  18. void ModelInfo::writeTo(Framework::StreamWriter* zWriter) const
  19. {
  20. char len = (char)modelPath.getLength();
  21. zWriter->schreibe(&len, 1);
  22. zWriter->schreibe(modelPath.getText(), (int)len);
  23. short count = (short)texturePaths.getEintragAnzahl();
  24. zWriter->schreibe((char*)&count, 2);
  25. for (Text* t : texturePaths)
  26. {
  27. len = (char)t->getLength();
  28. zWriter->schreibe(&len, 1);
  29. zWriter->schreibe(t->getText(), (int)len);
  30. }
  31. zWriter->schreibe((char*)&transparent, 1);
  32. }
  33. ModelInfo& ModelInfo::setTransparent()
  34. {
  35. transparent = 1;
  36. return *this;
  37. }