ModelInfo.cpp 962 B

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