12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- #include "ModelInfo.h"
- #include <Textur.h>
- #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->lese(&len, 1);
- char* path = new char[len + 1];
- reader->lese(path, len);
- path[len] = 0;
- modelPath = path;
- delete[] path;
- short count;
- reader->lese((char*)&count, 2);
- for (int i = 0; i < count; i++)
- {
- reader->lese(&len, 1);
- path = new char[len + 1];
- reader->lese(path, len);
- path[len] = 0;
- texturPaths.add(new Text(path));
- delete[] path;
- }
- reader->lese((char*)&transparent, 1);
- reader->lese((char*)&size, 4);
- }
- Framework::Model3DData* ModelInfo::getModel() const
- {
- return uiFactory.initParam.bildschirm->zGraphicsApi()->getModel(modelPath);
- }
- Framework::Model3DTextur* ModelInfo::getTexture() const
- {
- Model3DTextur* textur = new Model3DTextur();
- int index = 0;
- for (Text* texturPath : texturPaths)
- {
- Textur* tex
- = uiFactory.initParam.bildschirm->zGraphicsApi()->createOrGetTextur(
- texturPath->getText(), 0);
- textur->setPolygonTextur(index++, tex);
- }
- return textur;
- }
- Framework::Text ModelInfo::getModelName() const
- {
- return modelPath;
- }
- const Framework::RCArray<Framework::Text>* ModelInfo::getTexturNames() const
- {
- return &texturPaths;
- }
- bool ModelInfo::isTransparent() const
- {
- return transparent;
- }
- float ModelInfo::getSize() const
- {
- return size;
- }
|