Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

RmSurface.h

00001 //=============================================================================
00002 // filename: RmSurface.h                                                       
00003 //                                                                             
00004 //           ATI Research, Inc.                                                
00005 //           3D Application Research Group                                     
00006 //                                                                             
00007 // Description: RenderMonkey's Surface Definition                              
00008 //                                                                             
00009 //=============================================================================
00010 //   (C) 2004 ATI Research, Inc.  All rights reserved.                         
00011 //=============================================================================
00012 
00013 #ifndef _RM_CORE_SURFACE_H_
00014 #define _RM_CORE_SURFACE_H_
00015 
00016 #include <Core/RmTypes.h>
00017 #include <Core/RmDefines.h>
00018 #include <Core/RmEffect.h>
00019 #include <Core/RmMath.h>
00020 #include <Core/RmMatrix.h>
00021 
00022 //=============================================================================
00035 //=============================================================================
00036 class RM_API RmSurface
00037 {
00038 public :
00039    //--------------------------------------------------------------------------
00044    //--------------------------------------------------------------------------
00045    RmSurface();
00046 
00047    //--------------------------------------------------------------------------
00052    //--------------------------------------------------------------------------
00053    virtual ~RmSurface();
00054 
00055    //--------------------------------------------------------------------------
00067    //--------------------------------------------------------------------------
00068    bool Create( RmPixelFormatType pixelFormat, int width, int height );
00069 
00070    //--------------------------------------------------------------------------
00076    //--------------------------------------------------------------------------
00077    virtual void Destroy();
00078 
00079    //--------------------------------------------------------------------------
00083    //--------------------------------------------------------------------------
00084    int GetWidth()  const { return m_width; };
00085 
00086    //--------------------------------------------------------------------------
00090    //--------------------------------------------------------------------------
00091    int GetHeight() const { return m_height; };
00092 
00093    //--------------------------------------------------------------------------
00099    //--------------------------------------------------------------------------
00100    int GetBytesPerPixel() const { return m_bytesPerPixel; };
00101 
00102    //--------------------------------------------------------------------------
00108    //--------------------------------------------------------------------------
00109    int GetPitch() const { return m_pitch; };
00110 
00111    //--------------------------------------------------------------------------
00117    //--------------------------------------------------------------------------
00118    RM_BYTE*       GetBuffer() { return m_pBuffer; };
00119 
00120    //--------------------------------------------------------------------------
00126    //--------------------------------------------------------------------------
00127    const RM_BYTE* GetBuffer() const { return m_pBuffer; };
00128 
00129    //--------------------------------------------------------------------------
00136    //--------------------------------------------------------------------------
00137    RM_BYTE*       GetScanLine( int y );
00138 
00139    //--------------------------------------------------------------------------
00146    //--------------------------------------------------------------------------
00147    const RM_BYTE* GetScanLine( int y ) const;
00148 
00149    //--------------------------------------------------------------------------
00158    RM_BYTE*       GetPixel( int x, int y );
00159 
00160    //--------------------------------------------------------------------------
00169    const RM_BYTE* GetPixel( int x, int y ) const;
00170 
00171    //--------------------------------------------------------------------------
00177    //--------------------------------------------------------------------------
00178    RmPixelFormatType GetPixelFormat() const { return m_pixelFormat; };
00179 
00180    //--------------------------------------------------------------------------
00186    //--------------------------------------------------------------------------
00187    int GetTotalSize() const { return m_totalSize; };
00188 
00189    //--------------------------------------------------------------------------
00195    //--------------------------------------------------------------------------
00196    bool IsDXTFormat() const;
00197 
00198    //--------------------------------------------------------------------------
00205    //
00212    //--------------------------------------------------------------------------
00213    int  GetDXTBlockSize() const { return m_DXTBlockSize; };
00214 
00215    //--------------------------------------------------------------------------
00221    //--------------------------------------------------------------------------
00222    int  GetDXTBlockWidth() const { return m_DXTBlockWidth; };
00223 
00224    //--------------------------------------------------------------------------
00230    //--------------------------------------------------------------------------
00231    int  GetDXTBlockHeight() const { return m_DXTBlockHeight; };
00232 
00233    //--------------------------------------------------------------------------
00241    //--------------------------------------------------------------------------
00242    RM_BYTE*       GetDXTBlock( int bx, int by );
00243 
00244    //--------------------------------------------------------------------------
00252    //--------------------------------------------------------------------------
00253    const RM_BYTE* GetDXTBlock( int bx, int by ) const;
00254 
00255 private :
00256    RmPixelFormatType  m_pixelFormat;      
00257    RM_BYTE           *m_pBuffer;          
00258    int                m_width;            
00259    int                m_height;           
00260    int                m_pitch;            
00261    int                m_bytesPerPixel;    
00262 
00263    int                m_DXTBlockSize;     
00264    int                m_DXTBlockWidth;    
00265    int                m_DXTBlockHeight;   
00266 
00267    int                m_totalSize;        
00268 }; // End of RmSurface
00269 
00270 
00271 //=============================================================================
00279 //=============================================================================
00280 class RM_API RmTexture
00281 {
00282 public :
00283    //--------------------------------------------------------------------------
00287    //--------------------------------------------------------------------------
00288    RmTexture() {};
00289 
00290    //--------------------------------------------------------------------------
00294    //--------------------------------------------------------------------------
00295    virtual ~RmTexture() {};
00296    
00297    //--------------------------------------------------------------------------
00303    //--------------------------------------------------------------------------
00304    virtual void Destroy() {};
00305 
00306    //--------------------------------------------------------------------------
00312    //--------------------------------------------------------------------------
00313    virtual RmPixelFormatType GetPixelFormat() const = 0;
00314 
00315    //--------------------------------------------------------------------------
00321    //--------------------------------------------------------------------------
00322    virtual RmTextureType     GetTextureType() const = 0;
00323 
00324 }; // End of RmTexture
00325 
00326 
00327 //=============================================================================
00335 //=============================================================================
00336 class RM_API Rm2DTexture : public RmTexture
00337 {
00338 public :
00339    //--------------------------------------------------------------------------
00343    //--------------------------------------------------------------------------
00344    Rm2DTexture();
00345 
00346    //--------------------------------------------------------------------------
00350    //--------------------------------------------------------------------------
00351    virtual ~Rm2DTexture();
00352 
00353    //--------------------------------------------------------------------------
00366    //--------------------------------------------------------------------------
00367    bool Create( RmPixelFormatType pixelFormat, int width, int height,
00368                 int numMipmaps );
00369 
00370    //--------------------------------------------------------------------------
00376    //--------------------------------------------------------------------------
00377    virtual void Destroy();
00378 
00379    //--------------------------------------------------------------------------
00385    //--------------------------------------------------------------------------
00386    int          GetNumMipmaps() const { return m_numMipmaps; };
00387 
00388    //--------------------------------------------------------------------------
00395    //--------------------------------------------------------------------------
00396    RmSurface*       GetMipmap( int level );
00397 
00398    //--------------------------------------------------------------------------
00405    //--------------------------------------------------------------------------
00406    const RmSurface* GetMipmap( int level ) const;
00407 
00408    //--------------------------------------------------------------------------
00414    //--------------------------------------------------------------------------
00415    RmTextureType     GetTextureType() const { return RM_TEXTURE_2D; };
00416 
00417    //--------------------------------------------------------------------------
00423    //--------------------------------------------------------------------------
00424    int GetWidth() const { return m_width; };
00425 
00426    //--------------------------------------------------------------------------
00432    //--------------------------------------------------------------------------
00433    int GetHeight() const { return m_height; };
00434 
00435    //--------------------------------------------------------------------------
00441    //--------------------------------------------------------------------------
00442    RmPixelFormatType GetPixelFormat() const { return m_pixelFormat; };
00443 
00444 private :
00445    int                 m_numMipmaps;   
00446    RmSurface          *m_pMipmaps;     
00447  
00448    RmPixelFormatType   m_pixelFormat;  
00449    int                 m_width;        
00450    int                 m_height;       
00451 }; // End of Rm2DTexture
00452 
00453 
00454 //=============================================================================
00467 //=============================================================================
00468 class RM_API RmCubemap : public RmTexture
00469 {
00470 public :
00471    //--------------------------------------------------------------------------
00475    //--------------------------------------------------------------------------
00476    RmCubemap();
00477 
00478    //--------------------------------------------------------------------------
00482    //--------------------------------------------------------------------------
00483    virtual ~RmCubemap();
00484 
00485    //--------------------------------------------------------------------------
00497    //--------------------------------------------------------------------------
00498    bool Create( RmPixelFormatType pixelFormat, int edgeSize,
00499                 int numMipmaps );
00500 
00501    //--------------------------------------------------------------------------
00507    //--------------------------------------------------------------------------
00508    virtual void Destroy();
00509 
00510    //--------------------------------------------------------------------------
00518    //--------------------------------------------------------------------------
00519    RmSurface*       GetFaceSurface( RmCubemapFaceType  whichFace, int mipLevel );
00520 
00521    //--------------------------------------------------------------------------
00529    //--------------------------------------------------------------------------
00530    const RmSurface* GetFaceSurface( RmCubemapFaceType  whichFace, int mipLevel ) const;
00531 
00532    //--------------------------------------------------------------------------
00538    //--------------------------------------------------------------------------
00539    RmTextureType     GetTextureType() const { return RM_TEXTURE_CUBEMAP; };
00540 
00541    //--------------------------------------------------------------------------
00547    //--------------------------------------------------------------------------
00548    int GetNumMipmaps() const { return m_numMipmaps; };
00549 
00550    //--------------------------------------------------------------------------
00556    //--------------------------------------------------------------------------
00557    int GetEdgeSize() const { return m_edgeSize; };     
00558 
00559    //--------------------------------------------------------------------------
00565    //--------------------------------------------------------------------------
00566    RmPixelFormatType GetPixelFormat() const { return m_pixelFormat; };
00567 
00568 private :
00569    //--------------------------------------------------------------------------
00571    //--------------------------------------------------------------------------
00572    struct Cube
00573    {
00574       RmSurface* pFaces[6];
00575    }; // End of Cube
00576 
00577 private :
00578    Cube               *m_pMipCubes;   
00579    int                 m_numMipmaps;  
00580 
00581    RmPixelFormatType   m_pixelFormat; 
00582    int                 m_edgeSize;    
00583 }; // End of RmCubemap
00584 
00585 #endif

Generated on Fri Feb 25 16:08:40 2005 for RenderMonkey SDK by doxygen 1.3.6