123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #include "ModelInfo.h"
- using namespace Framework;
- ModelInfo::ModelInfo(
- const char* modelPath, const char* texturPath, int textureCount)
- : modelPath(modelPath),
- transparent(0)
- {
- for (int i = 0; i < textureCount; i++)
- texturePaths.add(new Text(texturPath));
- }
- ModelInfo::ModelInfo(
- const char* modelPath, std::initializer_list<const char*> texturePaths)
- : modelPath(modelPath)
- {
- for (const char* texturPath : texturePaths)
- this->texturePaths.add(new Text(texturPath));
- }
- ModelInfo::ModelInfo(const ModelInfo& right)
- : modelPath(right.modelPath),
- transparent(right.transparent)
- {
- for (int i = 0; i < right.texturePaths.getEintragAnzahl(); i++)
- texturePaths.add(right.texturePaths.get(i));
- }
- ModelInfo& ModelInfo::operator=(const ModelInfo& right)
- {
- modelPath = right.modelPath;
- transparent = right.transparent;
- texturePaths.leeren();
- for (int i = 0; i < right.texturePaths.getEintragAnzahl(); i++)
- texturePaths.add(right.texturePaths.get(i));
- return *this;
- }
- void ModelInfo::writeTo(Framework::StreamWriter* zWriter) const
- {
- char len = (char)modelPath.getLength();
- zWriter->schreibe(&len, 1);
- zWriter->schreibe(modelPath.getText(), (int)len);
- short count = (short)texturePaths.getEintragAnzahl();
- zWriter->schreibe((char*)&count, 2);
- for (Text* t : texturePaths)
- {
- len = (char)t->getLength();
- zWriter->schreibe(&len, 1);
- zWriter->schreibe(t->getText(), (int)len);
- }
- zWriter->schreibe((char*)&transparent, 1);
- }
- ModelInfo& ModelInfo::setTransparent()
- {
- transparent = 1;
- return *this;
- }
|