Crazy Eddies GUI System: CEGUIDirect3D9Renderer.h Source File

Crazy Eddies GUI System 0.7.6

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

CEGUIDirect3D9Renderer.h

    00001 /***********************************************************************
    00002     filename:   CEGUIDirect3D9Renderer.h
    00003     created:    Mon Feb 9 2009
    00004     author:     Paul D Turner
    00005 *************************************************************************/
    00006 /***************************************************************************
    00007  *   Copyright (C) 2004 - 2010 Paul D Turner & The CEGUI Development Team
    00008  *
    00009  *   Permission is hereby granted, free of charge, to any person obtaining
    00010  *   a copy of this software and associated documentation files (the
    00011  *   "Software"), to deal in the Software without restriction, including
    00012  *   without limitation the rights to use, copy, modify, merge, publish,
    00013  *   distribute, sublicense, and/or sell copies of the Software, and to
    00014  *   permit persons to whom the Software is furnished to do so, subject to
    00015  *   the following conditions:
    00016  *
    00017  *   The above copyright notice and this permission notice shall be
    00018  *   included in all copies or substantial portions of the Software.
    00019  *
    00020  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    00021  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    00022  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
    00023  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
    00024  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
    00025  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
    00026  *   OTHER DEALINGS IN THE SOFTWARE.
    00027  ***************************************************************************/
    00028 #ifndef _CEGUIDirect3D9Renderer_h_
    00029 #define _CEGUIDirect3D9Renderer_h_
    00030
    00031 #include "../../CEGUIBase.h"
    00032 #include "../../CEGUIRenderer.h"
    00033 #include "../../CEGUISize.h"
    00034 #include "../../CEGUIVector.h"
    00035
    00036 #include <d3d9.h>
    00037 #include <vector>
    00038
    00039 #if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined(CEGUI_STATIC)
    00040 #   ifdef DIRECT3D9_GUIRENDERER_EXPORTS
    00041 #       define DIRECT3D9_GUIRENDERER_API __declspec(dllexport)
    00042 #   else
    00043 #       define DIRECT3D9_GUIRENDERER_API __declspec(dllimport)
    00044 #   endif
    00045 #else
    00046 #   define DIRECT3D9_GUIRENDERER_API
    00047 #endif
    00048
    00049 #if defined(_MSC_VER)
    00050 #   pragma warning(push)
    00051 #   pragma warning(disable : 4251)
    00052 #endif
    00053
    00054 // Start of CEGUI namespace section
    00055 namespace CEGUI
    00056 {
    00057 class Direct3D9Texture;
    00058 class Direct3D9GeometryBuffer;
    00059
    00064 class DIRECT3D9_GUIRENDERER_API Direct3D9Renderer : public Renderer
    00065 {
    00066 public:
    00084     static Direct3D9Renderer& bootstrapSystem(LPDIRECT3DDEVICE9 device);
    00085
    00101     static void destroySystem();
    00102
    00107     static Direct3D9Renderer& create(LPDIRECT3DDEVICE9 device);
    00108
    00116     static void destroy(Direct3D9Renderer& renderer);
    00117
    00119     void preD3DReset();
    00120
    00122     void postD3DReset();
    00123
    00125     LPDIRECT3DDEVICE9 getDevice() const;
    00126
    00128     Texture& createTexture(LPDIRECT3DTEXTURE9 tex);
    00129
    00131     bool supportsNonSquareTexture();
    00132
    00134     bool supportsNPOTTextures();
    00135
    00137     Size getAdjustedSize(const Size& sz);
    00138
    00140     void setupRenderingBlendMode(const BlendMode mode,
    00141                                  const bool force = false);
    00142
    00143     // implement Renderer interface
    00144     RenderingRoot& getDefaultRenderingRoot();
    00145     GeometryBuffer& createGeometryBuffer();
    00146     void destroyGeometryBuffer(const GeometryBuffer& buffer);
    00147     void destroyAllGeometryBuffers();
    00148     TextureTarget* createTextureTarget();
    00149     void destroyTextureTarget(TextureTarget* target);
    00150     void destroyAllTextureTargets();
    00151     Texture& createTexture();
    00152     Texture& createTexture(const String& filename, const String& resourceGroup);
    00153     Texture& createTexture(const Size& size);
    00154     void destroyTexture(Texture& texture);
    00155     void destroyAllTextures();
    00156     void beginRendering();
    00157     void endRendering();
    00158     void setDisplaySize(const Size& sz);
    00159     const Size& getDisplaySize() const;
    00160     const Vector2& getDisplayDPI() const;
    00161     uint getMaxTextureSize() const;
    00162     const String& getIdentifierString() const;
    00163
    00164 private:
    00166     Direct3D9Renderer(LPDIRECT3DDEVICE9 device);
    00167
    00169     virtual ~Direct3D9Renderer();
    00170
    00172     Size getViewportSize();
    00174     float getSizeNextPOT(float sz) const;
    00175
    00177     static String d_rendererID;
    00179     LPDIRECT3DDEVICE9 d_device;
    00181     Size d_displaySize;
    00183     Vector2 d_displayDPI;
    00185     RenderingRoot* d_defaultRoot;
    00187     RenderTarget* d_defaultTarget;
    00189     typedef std::vector<TextureTarget*> TextureTargetList;
    00191     TextureTargetList d_textureTargets;
    00193     typedef std::vector<Direct3D9GeometryBuffer*> GeometryBufferList;
    00195     GeometryBufferList d_geometryBuffers;
    00197     typedef std::vector<Direct3D9Texture*> TextureList;
    00199     TextureList d_textures;
    00201     uint d_maxTextureSize;
    00203     bool d_supportNPOTTex;
    00205     bool d_supportNonSquareTex;
    00207     BlendMode d_activeBlendMode;
    00208   };
    00209
    00210 } // End of  CEGUI namespace section
    00211
    00212 #if defined(_MSC_VER)
    00213 #   pragma warning(pop)
    00214 #endif
    00215
    00216 #endif // end of guard _CEGUIDirect3D9Renderer_h_