12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- #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),
- transparent(0)
- {
- 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;
- }
|