[2823] | 1 | /*! |
---|
[6021] | 2 | * @file static_model.h |
---|
| 3 | * @brief Contains the Model Class that handles Static 3D-Models rendered with glList's |
---|
| 4 | */ |
---|
[2823] | 5 | |
---|
[6021] | 6 | #ifndef _STATIC_MODEL_H |
---|
| 7 | #define _STATIC_MODEL_H |
---|
[2773] | 8 | |
---|
[6021] | 9 | #include "model.h" |
---|
[5701] | 10 | |
---|
[2776] | 11 | #include "material.h" |
---|
[6423] | 12 | #include <vector> |
---|
[9869] | 13 | #include "static_model_data.h" |
---|
[2748] | 14 | |
---|
[4022] | 15 | ///////////// |
---|
| 16 | /// MODEL /// |
---|
| 17 | ///////////// |
---|
[6021] | 18 | //! Class that handles static 3D-Models. |
---|
| 19 | /** |
---|
| 20 | * it can also read them in and display them. |
---|
| 21 | * All the objects are rendered with glLists |
---|
| 22 | */ |
---|
| 23 | class StaticModel : public Model |
---|
[4022] | 24 | { |
---|
[9869] | 25 | ObjectListDeclaration(StaticModel); |
---|
| 26 | public: |
---|
[7221] | 27 | StaticModel(const std::string& modelName = ""); |
---|
[9869] | 28 | StaticModel(const StaticModel& staticModel); |
---|
[6021] | 29 | virtual ~StaticModel(); |
---|
[3910] | 30 | |
---|
[9869] | 31 | StaticModel& operator=(const StaticModel& model); |
---|
[3910] | 32 | |
---|
[9869] | 33 | virtual void draw() const { data->draw(); }; |
---|
| 34 | void draw(int groupNumber) const { data->draw(groupNumber); }; |
---|
| 35 | void draw(const std::string& groupName) const { data->draw(groupName); }; |
---|
[5790] | 36 | |
---|
[9869] | 37 | void rebuild() { data->rebuild(); }; |
---|
[3913] | 38 | |
---|
[9869] | 39 | Material* addMaterial(Material* material) { return data->addMaterial(material); }; |
---|
| 40 | Material* addMaterial(const std::string& materialName) { return data->addMaterial(materialName); }; |
---|
[6031] | 41 | |
---|
[9869] | 42 | bool addGroup(const std::string& groupString) { return data->addGroup(groupString); }; |
---|
[6031] | 43 | |
---|
[9869] | 44 | bool addVertex(const std::string& vertexString) { return data->addVertex(vertexString); }; |
---|
| 45 | bool addVertex(float x, float y, float z) { return data->addVertex(x, y, z); }; |
---|
| 46 | |
---|
| 47 | bool addFace(const std::string& faceString) { return data->addFace(faceString); }; |
---|
[3895] | 48 | bool addFace(int faceElemCount, VERTEX_FORMAT type, ...); |
---|
[6031] | 49 | |
---|
[9869] | 50 | bool addVertexNormal(const std::string& normalString) { return this->data->addVertexNormal(normalString); }; |
---|
| 51 | bool addVertexNormal(float x, float y, float z) { return this->data->addVertexNormal(x,y,z); }; |
---|
[6031] | 52 | |
---|
[9869] | 53 | bool addVertexTexture(const std::string& vTextureString) { return this->data->addVertexTexture(vTextureString); }; |
---|
| 54 | bool addVertexTexture(float u, float v) { return this->data->addVertexTexture(u, v); }; |
---|
[6031] | 55 | |
---|
[9869] | 56 | bool setMaterial(const std::string& mtlString) { return data->setMaterial(mtlString); }; |
---|
| 57 | bool setMaterial(Material* mtl) { return data->setMaterial(mtl);}; |
---|
[6031] | 58 | |
---|
[4746] | 59 | void finalize(); |
---|
[4106] | 60 | |
---|
[9869] | 61 | void acquireData(const StaticModelData::Pointer& data); |
---|
| 62 | const StaticModelData::Pointer& dataPointer() const { return this->data; }; |
---|
[4468] | 63 | |
---|
[9869] | 64 | inline void setScaleFactor(float scaleFactor) { this->data->setScaleFactor(scaleFactor); }; |
---|
| 65 | float getScaleFactor() const { return data->getScaleFactor(); } |
---|
| 66 | |
---|
| 67 | protected: |
---|
[4746] | 68 | void cubeModel(); |
---|
[4468] | 69 | |
---|
[9869] | 70 | private: |
---|
| 71 | void updateBase(); |
---|
| 72 | private: |
---|
| 73 | StaticModelData::Pointer data; |
---|
[2748] | 74 | }; |
---|
[2773] | 75 | |
---|
| 76 | #endif |
---|