/***************************************************************************
 *                          Zanoza Modeler v2.x                            *
 *      This is unpublished propietary source code of Zanoza Software.     *
 *      The copyright notice does not evidence any actual or intended      *
 *                    publication of such source code.                     *
 *                                                                         *
 *                Copyright (c) 2002-2008 Zanoza Software.                 *
 *                                                                         *
 *                        All rights reserved.                             *
 ***************************************************************************
 *--------------------------------------------------------------------------
 * @author:   Oleg Melashenko
 *--------------------------------------------------------------------------
 * @purpose:  Declaration of the class IRenderManager
 *   This manager allows user to select preferable device and configure it.
 *   The service is maintained by ZModeler and picked up on startup.
 *   The service transparently inherits:
 *   - core::IProfileable
 *   The service contains render-specific operations which are called on
 *   pre-render and post-render of each frame.
 *   The service manages render-specific resources like materials textures
 *   and lights.
 *--------------------------------------------------------------------------
 * @created: Sunday, February 23, 2003 18:59:56
 */

#if !defined(IRenderManager_h_included)
#define IRenderManager_h_included
//forward declaration of this class might require
namespace services
{ class IRenderManager; };
#include <zmodeler.h>
#include <core/coreTypes.h>
#include <services/zmServices.h>
#include <services/IService.h>
#include <rend/IRenderExtension.h>
#include <services/IMaterialsService.h>
#include <services/ITexturesService.h>
#include <rend/ILightsManager.h>
#include <core/ui/IViewport.h>
#include <rend/ITexture.h>
#include <rend/IRenderTechnique.h>


namespace services
{
  
  class IRenderManager : public services::IService
  {
  public:
    /* Displays a dialog box to allow user pickup a preferable device */
    virtual ZRESULT doUserSelectDevice(void)=0;
    /* Routine forces service to create preferable device and set it as default to ZModeler */
    virtual ZRESULT pickDefaultDevice(void)=0;
    /* Provides collection of available rendering techniques */
    virtual ZRESULT getRenderTechniques(rend::CRenderTechniqueCol** ppTechs)=0;
    /* Sets collection of available rendering techniques */
    virtual ZRESULT setRenderTechniques(rend::CRenderTechniqueCol* pTechs)=0;
    virtual ZRESULT getRenderExtensions(rend::CRenderExtensionCol** ppExt)=0;
    virtual ZRESULT registerRenderExtension(rend::IRenderExtension* pExt)=0;
    /* dwFormat is D3DFORMAT
     * dwFlags are: RENDMAN_RT_* flags */
    virtual ZRESULT createRenderTarget(long nWidth, long nHeight, DWORD dwFormat, DWORD dwFlags, IRenderTarget** ppTarget)=0;
    virtual ZRESULT getMaterialsService(services::IMaterialsService** ppMatSrv)=0;
    virtual ZRESULT getTexturesService(services::ITexturesService** ppTextureSrv)=0;
    virtual ZRESULT getLightsManager(rend::ILightsManager** ppMan)=0;
    virtual ZRESULT beginRender(core::ui::IViewport* pVPort)=0;
    virtual ZRESULT endRender(core::ui::IViewport* pVPort)=0;
    virtual ZRESULT addRenderBlock(rend::tRenderBlock& block)=0;
    virtual ZRESULT renderBlocks(rend::tRenderBlockSeq& seqBlocks)=0;
    virtual ZRESULT drawSolidRect(ZRect& rect, ZColor color, bool bIsInSceneLoop=false, bool bAlphaBlend=true)=0;
    virtual ZRESULT drawTexturedRect(ZRect& rect, ZColor color, rend::ITexture* pTexture, bool bIsInSceneLoop=false, bool bDrawTexture=true, bool bDrawAlpha=true)=0;
    /* Draws a text using default GUI font. Text can be drawn over a colored sub-layer.
     * To draw a text without sublayer rect, pass 0x00000000 as a color for sub-layer. */
    virtual ZRESULT drawText(float scrX, float scrY, ZColor cr, LPCTSTR pszText, bool bBold, ZColor crSubLayer)=0;
  
  };//class IRenderManager
};//services

#endif
