renderbuffer.h

Go to the documentation of this file.
00001 /**
00002  * \file mi32/renderbuffer.h
00003  * \brief RENDERBUFFER class definition
00004  *
00005  * \if NODOC
00006  * $Id: renderbuffer.h_v 1.6 2005/07/06 22:44:03 vdronov Exp $
00007  *
00008  * $Log: renderbuffer.h_v $
00009  * Revision 1.6  2005/07/06 22:44:03  vdronov
00010  * *** empty log message ***
00011  *
00012  * Revision 1.5  2005/06/15 22:07:10  mju
00013  * Add interlaceFromDevice.
00014  *
00015  * Revision 1.4  2005/05/24 21:29:18  mju
00016  * Unify overlayOnDevice with optional cliprect.
00017  *
00018  * Revision 1.3  2005/05/24 17:54:37  mju
00019  * Add ability to set plane masks for use when overlay.
00020  *
00021  * Revision 1.2  2005/05/03 20:29:45  mju
00022  * Add overlayOnDevice variant using rectangle.
00023  *
00024  * Revision 1.1  2005/04/22 17:34:41  mju
00025  * Initial revision
00026  *
00027  * \endif
00028 **/
00029 
00030 #ifndef  INC_MI32_RENDERBUFFER_H
00031 #define  INC_MI32_RENDERBUFFER_H
00032 
00033 #ifndef INC_MI32_RECT_H
00034 #include <mi32/rect.h>
00035 #endif
00036 
00037 #ifndef INC_MI32_COLORSPC_H
00038 #include <mi32/colorspc.h>
00039 #endif
00040 
00041 #ifndef INC_MI32_MXSTEREO_H
00042 #include <mi32/mxstereo.h>
00043 #endif
00044 
00045 
00046 namespace MGD {
00047    class DEVICE;
00048    class DEVICE_MEM32RGBA;
00049    }
00050 
00051 //===================================================================================================================
00052 
00053 //! General memory-based rendering buffer.
00054 //! Supports creation/copying from and overlay on other MGD devices.
00055 class RENDERBUFFER {
00056    public:
00057 
00058       //! Get target colorspace suitable for overlay.
00059       static COLORSPACE GetTargetColorSpace (
00060          const MGD::DEVICE *pDeviceRef             //!< Reference device
00061          );
00062 
00063       //! Constructor.
00064       RENDERBUFFER ();
00065 
00066       //! Destructor.
00067       ~RENDERBUFFER ();
00068 
00069       //! Copy rendering from specified source device.
00070       //! Created device will have same (virtual) size and colorspace as source.
00071       //! If successful will set as having been rendered.
00072       ERRVALUE CopyFromDevice (
00073          const MGD::DEVICE_MEM32RGBA *pDevSource,  //!< Source device to copy from
00074          bool UseMinimalRectangle = true,          //!< Use minimal rectangle
00075          bool CopyDepth = false
00076          );
00077 
00078       //! Destroy device buffer if any.
00079       void DestroyDevice (
00080          );
00081 
00082       //! Get rendering device (non-const).
00083       //! @return Device pointer, NULL if not yet created.
00084       MGD::DEVICE* GetDevice (
00085          );
00086 
00087       //! Get rendering device (const).
00088       //! @return Device pointer, NULL if not yet created.
00089       const MGD::DEVICE* GetDevice (
00090          ) const;
00091 
00092       //! Determine if has been rendered.
00093       bool HasRendered (
00094          ) const { return (m_pDevice != 0 && m_HasRendered); }
00095 
00096       //! Interlace left/right stereo views.
00097       ERRVALUE InterlaceFromDevice (
00098          MGD::DEVICE_MEM32RGBA *pDevSource,        //!< Source device to copy from
00099          const LRECT2D& SrcRectLeft,               //!< Source rectangle for left view
00100          const LRECT2D& SrcRectRight,              //!< Source rectangle for right view
00101          STEREOMODE StereoMode,                    //!< Stereo mode
00102          bool UseMinimalRectangle = true           //!< Use minimal rectangle
00103          );
00104 
00105       //! Overlay rendered buffer on specified device using rectangle.
00106       void OverlayOnDevice (
00107          MGD::DEVICE *pDevTarget,               //!< Target device to overlay on
00108          const LRECT2D *pClipRect = 0           //!< Optional limiting rectangle
00109          ) const;
00110 
00111       //! Set to use all planes when overlaying.
00112       void SetPlaneMaskAll (
00113          ) { m_MaskRed = m_MaskGreen = m_MaskBlue = 255; }
00114 
00115       //! Set to only use specific color planes when overlaying.
00116       void SetPlaneMaskRGB (
00117          UINT8 MaskRed,
00118          UINT8 MaskGreen,
00119          UINT8 MaskBlue
00120          ) { m_MaskRed = MaskRed; m_MaskGreen = MaskGreen; m_MaskBlue = MaskBlue; }
00121 
00122       //! Set whether current rendering is valid or not.
00123       void SetRendered (
00124          bool HasRendered                       //!< True to mark as valid, false to mark as invalid
00125          ) { m_HasRendered = HasRendered; }
00126 
00127       //! Setup device.
00128       //! Existing rendering will be lost.
00129       //! Created device will have same size and colorspace as specified reference.
00130       ERRVALUE SetupDevice (
00131          const MGD::DEVICE *pDeviceRef          //!< Reference device for determining size and colorspace
00132          );
00133 
00134    private:
00135       #ifndef GENERATING_DOXYGEN_OUTPUT
00136       MGD::DEVICE_MEM32RGBA *m_pDevice;
00137       bool m_HasRendered;                       // Has been rendered
00138       LRECT2D m_ValidRect;                      // Portion of virtual rendering space which is valid
00139       UINT8 m_MaskRed;
00140       UINT8 m_MaskGreen;
00141       UINT8 m_MaskBlue;
00142 
00143       void CopyRect (MGD::DEVICE *pDevTarget, const MGD::DEVICE *pDevSource, bool UseTransp, const LRECT2D *pClipRect) const;
00144       void CopyDepthRect (MGD::DEVICE *pDevTarget, const MGD::DEVICE *pDevSource, const LRECT2D *pClipRect) const;
00145 
00146       // Unimplemented
00147       RENDERBUFFER (const RENDERBUFFER&);
00148       RENDERBUFFER& operator= (const RENDERBUFFER&);
00149 
00150       #endif // GENERATING_DOXYGEN_OUTPUT
00151    };
00152 
00153 //===================================================================================================================
00154 
00155 
00156 #endif   // INC_MI32_RENDERBUFFER_H

Generated on Wed May 31 15:27:04 2006 for TNTsdk by  doxygen 1.3.8-20040913