#include "ModelInfo.h"

using namespace Framework;

ModelInfo::ModelInfo(const char* modelPath, const char* texturPath, int textureCount)
	: modelPath(modelPath)
{
	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));
}

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);
	}
}