ModelInfo.cpp 886 B

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