#ifndef _SCREEN_H_ #define _SCREEN_H_ #include "math/TransformMatrix.h" //! Projection image source. enum PROJECT_SOURCE { PROJECT_SOURCE_NONE = 0, //!< Draw the screen only. PROJECT_SOURCE_PROJECTORAREA, //!< Projected area of the projector. PROJECT_SOURCE_VIEWAREA, //!< View area of the channel. PROJECT_SOURCE_SCENE, //!< Scene viewed from the center. PROJECT_SOURCE_EXPORT_DISTORTION, //!< Color encoded distortion, green and blue channels (internal use only). PROJECT_SOURCE_EXPORT_DISTORTION_R, //!< Color encoded distortion, red channel (internal use only). PROJECT_SOURCE_EXPORT_BLENDING //!< Edge blend intensity (internal use only). }; namespace projection { class ScreenShape; class Channel; class ProjectionModel; /** * Screen class. */ class Screen : public QObject { Q_OBJECT public: /** * Constructor. Screen data / rendering class. * * @param Projection model. */ Screen(ProjectionModel* pModel); /** * Destructor. */ virtual ~Screen(); /** * Returns a Pointer to the Projection Model. * * @return Pointer to the ProjectionModel */ ProjectionModel* getProjectionModel(){return m_pModel;} /** * Set transform matrix of the screen. * * @param matrix Transform matrix of the screen. */ void setMatrix(const TransformMatrix& matrix); /** * Retrieve the transform matrix of the screen. * * @return Transform matrix of the screen. */ TransformMatrix getMatrix() const { return m_transformMatrix; } /** * Retrieve name of the screen shape. * * @param index Index of the screen shape. * @return Name of the screen shape. */ QString getShapeName(int index) const; /** * Retrieve the number of the screen shapes. * * @return Number of the screen shapes. */ unsigned int getNumShapes() const; /** * Retrieve screen shape object. * * @param shapeName Name of the screen shape. * @return Screen shape object. */ ScreenShape* getShape(const QString& shapeName) const; /** * Select screen shape by name. * * @param shapeName Name of the screen shape to select. */ void setCurrentShape(const QString& shapeName); /** * Retrieve the name of the current srceen shape. * * @return Name of the current screen shape. */ QString getCurrentShapeName() const; /** * Retrieve the current screen shape object. * * @return Current screen shape object. */ ScreenShape* getCurrentShape() const; /** * Retrive the radius of the current screen. * * @return Radius of the current screen. */ float getSize() const; /** * Show or hide the wire frame mesh of the screen. * * @param bShowFrame True to show the wire frame mesh. */ void setShowFrame(bool bShowFrame); /** * Check whether the wire frame mesh of the screen is shown or hidden. * * @param bShowFrame True if the wire frame mesh of the screen is shown. */ bool getShowFrame() { return m_bShowFrame; } /** * Set line width of the wire frame mesh of the screen. * * @param frameLineWidth Line width of the wire frame mesh of the screen. */ void setFrameLineWidth(float frameLineWidth); /** * Retrieve the line width of the wire frame mesh of the screen. * * @return Line width of the wire frame mesh of the screen. */ bool getFrameLineWidth() { return m_frameLineWidth; } /** * Set size of the off-screen buffer. * * @param width Width of the off-screen buffer. * @param height Height of the off-screen buffer. */ void setBufferSize(int width, int height); /** * Retrieve the width of the off-screen buffer. * * @retrieve Width of the off-screen buffer. */ int getBufferWidth() const { return m_bufferWidth; } /** * Retrieve the height of the off-screen buffer. * * @retrieve Height of the off-screen buffer. */ int getBufferHeight() const { return m_bufferHeight; } /** * Draw the screen shape object with. * * @param bDepthMaskControl True to use glDepthMask() for blending. */ void draw(bool bDepthMaskControl=true); /** * Draw the wire frame mesh of the screen. */ void drawFrame(); /** * Draw the screen object with projection texture image of the specified channel. * * @param source Projection image source to draw. * @param pChannel Channel which draws for. */ void draw(PROJECT_SOURCE source, Channel* pChannel=NULL); /** * Notify to redraw the screen. */ void notifyRedraw(); /** * Restore the screen shape from XML data. * * @param element Parent XML element of the screen data. */ bool initFromDOMElement(const QDomElement& element); /** * Store the current screen shape as XML data. * * @param name XML node name of the data. * @param doc XML document to store the data. * @return Current screen data as XML data. */ QDomElement domElement(const QString& name, QDomDocument& doc) const; /** * Reset the screen. */ void reset(); protected: TransformMatrix m_transformMatrix; //!< Transform matrix of the screen. bool m_bShowFrame; //!< True if the wire frame mesh of the screen is shown. float m_frameLineWidth; //!< Line width of the wire frame mesh of the screen. int m_bufferWidth; //!< Width of the off-screen buffer. int m_bufferHeight; //!< Height of the off-screen buffer. QList m_pShapes; //!< Screen shape objects. ScreenShape* m_pCurrentShape; //!< Current screen shape object. ProjectionModel* m_pModel; //!< Projection model. }; }; // projection #endif // _SCREEN_H_