#ifndef _FRUSTUM_H_ #define _FRUSTUM_H_ #include #include #include "math/ProjectionMatrix.h" #include "math/TransformMatrix.h" namespace projection { /** * Frustum data class to represent projection area and view frustum. */ class Frustum : public QObject { Q_OBJECT public: /** * Constructor. */ Frustum(); /** * Destructor. */ virtual ~Frustum(); /** * Set projection matrix of the frustum. * * @param matrix Projection matrix of the frustum. */ void setProjectionMatrix(const ProjectionMatrix& matrix); /** * Retrieve projection matrix of the frustum. * * @return Projection matrix of the frustum. */ ProjectionMatrix getProjectionMatrix() const; /** * Set transform matrix of the frustum. * * @param matrix Transform matrix of the frustum. */ void setTransformMatrix(const TransformMatrix& matrix); /** * Retrieve transform matrix of the frustum. * * @return Transform matrix of the frustum. */ TransformMatrix getTransformMatrix() const; /** * Set color of the frustum shape object. * * @param color Color of the frustum shape object. */ void setColor(const QColor& color); /** * Retrieve color of the frustum shape object. * * @return Color of the frustum shape object. */ QColor getColor() const; /** * Show or hide the frustum shape object. * * @param bShow True to show the frustum shape object, false to hide. */ void setShow(bool bShow); /** * Check whether the frustum shape object is shown or not. * * @return True if the frustum shape object is shown. */ bool getShow() const; /** * Show or hide the frustum projected area. * * @param bShow True to show the frustum projected area, false to hide. */ void setShowArea(bool bShow); /** * Check whether the frustum projected area is shown or not. * * @return True if the frustum projected area is shown. */ bool getShowArea() const; /** * Set far clip plane distance of the frame shape object. It doesn't modify the frustum data. * * @param farDist Far clip plane distance of the frame shape object. */ void setVisibleFar(float farDist); /** * Retrieve far clip plane distance of the frame shape object. * * @return Far clip plane distance of the frame shape object. */ float getVisibleFar() const; /** * Draw frustum shape object. * * @param bSelected True to draw with selection highlight. */ void draw(bool bSelected=false); /** * Assignment operator. * * @param frustum Assignment source frustum. */ Frustum& operator=(const Frustum& frustum); /** * Restore the frustum data from XML data. * * @param element Parent XML element of the frustum data. */ virtual void initFromDOMElement(const QDomElement& element); /** * Store the current frustum data as XML data. * * @param name XML node name of the data. * @param doc XML document to store the data. * @return Current frustum data as XML data. */ virtual QDomElement domElement(const QString& name, QDomDocument& doc) const; signals: /** * Notify that the frustum data is changed. */ void dataChanged(); protected: ProjectionMatrix m_projectionMatrix; //!< Projection matrix of the frustum. TransformMatrix m_transformMatrix; //!< Transform matrix of the frustum. bool m_bShow; //!< True if the frustum shape object is shown. bool m_bShowArea; //!< True if the frustum projected area is shown. float m_visibleFar; //!< Far clip plane distance of the frustum shape object. QColor m_color; //!< Color of the frustum shape object. }; }; // projection #endif // _FRUSTUM_H_