#include "ModelInfo.h" #include #include "Globals.h" using namespace Framework; ModelInfo::ModelInfo(const char* model, const char *texture, bool transparent, int numTextures, float size) : modelPath(model), transparent(transparent), size(size) { for (int i = 0; i < numTextures; i++) texturPaths.add(new Text(texture)); } ModelInfo::ModelInfo(Framework::StreamReader* reader) { char len; reader->read(&len, 1); char* path = new char[len + 1]; reader->read(path, len); path[len] = 0; modelPath = path; delete[] path; short count; reader->read((char*)&count, 2); for (int i = 0; i < count; i++) { reader->read(&len, 1); path = new char[len + 1]; reader->read(path, len); path[len] = 0; texturPaths.add(new Text(path)); delete[] path; } reader->read((char*)&transparent, 1); reader->read((char*)&size, 4); } Framework::Model3DData* ModelInfo::getModel() const { return uiFactory.initParam.bildschirm->zGraphicsApi()->getModel(modelPath); } Framework::Model3DTexture* ModelInfo::getTexture() const { Model3DTexture* texture = new Model3DTexture(); int index = 0; for (Text* texturPath : texturPaths) { Texture* tex = uiFactory.initParam.bildschirm->zGraphicsApi()->createOrGetTexture( texturPath->getText(), 0); texture->setPolygonTexture(index++, tex); } return texture; } Framework::Text ModelInfo::getModelName() const { return modelPath; } const Framework::RCArray* ModelInfo::getTexturNames() const { return &texturPaths; } bool ModelInfo::isTransparent() const { return transparent; } float ModelInfo::getSize() const { return size; }