[4] | 1 | #ifndef _SCREEN_MODEL_H_ |
---|
| 2 | #define _SCREEN_MODEL_H_ |
---|
| 3 | |
---|
| 4 | #include "screen/ScreenShape.h" |
---|
| 5 | |
---|
| 6 | #include <QtGui> |
---|
| 7 | |
---|
| 8 | #include "glm/glm.h" |
---|
| 9 | |
---|
| 10 | // Only requiered to be able to retireve a GUI-Pointer |
---|
| 11 | #include "Screen.h" |
---|
| 12 | #include "ProjectionModel.h" |
---|
| 13 | #include "GUIControler.h" |
---|
| 14 | |
---|
| 15 | namespace projection |
---|
| 16 | { |
---|
| 17 | |
---|
| 18 | /** |
---|
| 19 | * Model screen class. |
---|
| 20 | */ |
---|
| 21 | class ScreenModel : public ScreenShape |
---|
| 22 | { |
---|
| 23 | Q_OBJECT |
---|
| 24 | public: |
---|
| 25 | |
---|
| 26 | /** |
---|
| 27 | * Constructor. |
---|
| 28 | * |
---|
| 29 | * @param pScreen Screen data. |
---|
| 30 | */ |
---|
| 31 | ScreenModel(Screen* pScreen); |
---|
| 32 | |
---|
| 33 | /** |
---|
| 34 | * Destructor. |
---|
| 35 | */ |
---|
| 36 | virtual ~ScreenModel(); |
---|
| 37 | |
---|
| 38 | /** |
---|
| 39 | * Retrieve name of the sceen shape. |
---|
| 40 | * |
---|
| 41 | * @return Name of the screen shape. |
---|
| 42 | */ |
---|
| 43 | QString getName() const { return "Model"; } |
---|
| 44 | |
---|
| 45 | /** |
---|
| 46 | * Load a model file. |
---|
| 47 | * |
---|
| 48 | * @param fileName File name of a model to load. |
---|
| 49 | */ |
---|
| 50 | void setFileName(const QString& fileName); |
---|
| 51 | |
---|
| 52 | /** |
---|
| 53 | * Retrieve file name of the model. |
---|
| 54 | * |
---|
| 55 | * @return File name of the model. |
---|
| 56 | */ |
---|
| 57 | QString getFileName() const; |
---|
| 58 | |
---|
| 59 | /** |
---|
| 60 | * Retrieve bounding box of the screen shape. |
---|
| 61 | * |
---|
| 62 | * @param min One corner of the screen shape. |
---|
| 63 | * @param max Another corner of the screen shape. |
---|
| 64 | */ |
---|
| 65 | void getBoundingBox(gmtl::Vec3f& min, gmtl::Vec3f& max); |
---|
| 66 | |
---|
| 67 | /** |
---|
| 68 | * Restore the screen shape from XML data. |
---|
| 69 | * |
---|
| 70 | * @param element Parent XML element of the screen shape data. |
---|
| 71 | */ |
---|
| 72 | virtual bool initFromDOMElement(const QDomElement& element); |
---|
| 73 | |
---|
| 74 | /** |
---|
| 75 | * Store the current screen shape as XML data. |
---|
| 76 | * |
---|
| 77 | * @param name XML node name of the data. |
---|
| 78 | * @param doc XML document to store the data. |
---|
| 79 | * @return Current screen shape data as XML data. |
---|
| 80 | */ |
---|
| 81 | virtual QDomElement domElement(const QString& name, QDomDocument& doc) const; |
---|
| 82 | |
---|
| 83 | protected: |
---|
| 84 | |
---|
| 85 | /** |
---|
| 86 | * Draw the shape model in inherited class. |
---|
| 87 | * |
---|
| 88 | * @param bFrame True to draw a wire frame mesh. False to draw as a polygon model. |
---|
| 89 | */ |
---|
| 90 | void drawShape(bool bFrame); |
---|
| 91 | |
---|
| 92 | protected: |
---|
| 93 | |
---|
| 94 | QString m_fileName; //!< File name of the model. |
---|
| 95 | GLMmodel* m_pModel; //!< glm model data structure. |
---|
| 96 | GLuint m_modelIndex; //!< gml model display list index. |
---|
| 97 | Screen* m_pScreen; |
---|
| 98 | }; |
---|
| 99 | |
---|
| 100 | }; // projection |
---|
| 101 | |
---|
| 102 | #endif // _SCREEN_MODEL_H_ |
---|