/***************************************************************************
 *                          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 IRenderExtension
 *   An extension to IRenderTechnique. Extension can be applied on mesh and/or
 *   polygon level and affect rendering of the mesh.
 *   IRenderExtension transparently inherits:
 *   - core::INamed
 *   - core::IStatus
 *   [opt core::IConfiguration and core::IProfileable].
 *   One instance per mesh is created and maintained by the mesh.
 *--------------------------------------------------------------------------
 * @created: Saturday, April 24, 2004 15:55:09
 */

#if !defined(IRenderExtension_h_included)
#define IRenderExtension_h_included
//forward declaration of this class might require
namespace rend
{ class IRenderExtension; class CRenderExtensionCol; };
#include <zmodeler.h>
#include <rend/renderTypes.h>
#include <scene/INode.h>
#include <core/ui/IViewport.h>


namespace rend
{
  
  class IRenderExtension : public ZUnknown
  {
  public:
    /* Verifies whether this technique is supported by device */
    virtual ZRESULT validate(IDevice* pDevice, scene::INode* pNode)=0;
    /* Tells whether extension supports polygon level. ZRESULT_OK if so. */
    virtual ZRESULT supportPolyLevel(void)=0;
    /* Tells whether this extension really affects visual appearence. If not,
     * it's unused in poly-sorting for rendering. Otherwise, priority is taken
     * and used for poly-sorting. */
    virtual ZRESULT isVisual(void)=0;
    /* Provides polygon-level priorty. The higher priority, the earlier polygons with this
     * extension will be rendered. Standard polygons assume to have core::EP_DEFAULT. */
    virtual ZRESULT polyLevelPriority(core::ePriority& prior)=0;
    virtual ZRESULT getBitValue(DWORD& nBit)=0;
    virtual ZRESULT setBitValue(DWORD nBit)=0;
    /* Notifies extension on begin of render. If bTopLevel is true, then the object's rendering
     * was started. otherwise, polygons burst starts rendering and pNode is valid */
    virtual ZRESULT beginRender(bool bTopLevel, core::ui::IViewport* vport, IDevice* device, scene::INode* pNode=NULL)=0;
    /* Notifies extension on end of render. If bTopLevel is true, then the object's rendering
     * has finished. Otherwise, polygons burst ended rendering. */
    virtual ZRESULT endRender(bool bTopLevel, core::ui::IViewport* vport, IDevice* device, scene::INode* pNode=NULL)=0;
  
  };//class IRenderExtension
  
  //
  // collection template
  //
  class CRenderExtensionCol : public ZUnknown,
      public ZIntrCollection<IRenderExtension>
  {
  public:
    INTERFACE_FUNCTIONS_DEFAULT(CRenderExtensionCol)
  };//class CRenderExtensionCol
};//rend

#endif
