/***************************************************************************
 *                          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 IMaterial
 *   Material interface. Materials are tree-structured with 'default material' in the root.
 *   Each material can either inherit or surpress paren'ts parameters in following groups:
 *   - Basic parameters: [color, opacity, specular]
 *   - Alpha parameters: [mode, parameters]
 *   - Extentions [collection of extentions]
 *--------------------------------------------------------------------------
 * @created: Wednesday, May 28, 2003 19:07:53
 */

#if !defined(IMaterial_h_included)
#define IMaterial_h_included
//forward declaration of this class might require
namespace rend
{ class IMaterial; class CMaterialCol; };
#include <zmodeler.h>
#include <rend/renderTypes.h>

namespace rend
{
  
  class IMaterial : public ZUnknown
  {
  public:
    virtual ZRESULT getClassName(ZString& strClass)=0;
    virtual ZRESULT duplicate(rend::IMaterial** ppMat)=0;
    virtual ZRESULT setParentMaterial(rend::IMaterial* pMat)=0;
    virtual ZRESULT getParentMaterial(rend::IMaterial** ppMat)=0;
    virtual ZRESULT setName(ZString strName)=0;
    virtual ZRESULT getName(ZString& strName)=0;
    virtual ZRESULT apply(IDevice* pDevice, bool bTopLevel=true)=0;
    virtual ZRESULT setColor(eColorType nKind, ZColor color, bool* pInherit=NULL)=0;
    virtual ZRESULT getColor(eColorType nKind, ZColor& color, bool* pInherited=NULL)=0;
    virtual ZRESULT setOpacity(float fOpacity, bool* pInherit=NULL)=0;
    virtual ZRESULT getOpacity(float& fOpacity, bool* pInherited=NULL)=0;
    virtual ZRESULT getRenderExtensions(rend::CRenderExtensionCol** ppExt, bool* pInherited=NULL)=0;
    virtual ZRESULT setRenderExtensions(rend::CRenderExtensionCol* pExt, bool* pInherit=NULL)=0;
    virtual ZRESULT getSpecular(float& fPower, bool* pInherited=NULL)=0;
    virtual ZRESULT setSpecular(float fPower, bool* pInherit=NULL)=0;
    virtual ZRESULT getAlphaBlend(bool& bBlendEnabled, DWORD* pOp=NULL, DWORD* pSrc=NULL, DWORD* pDst=NULL, bool bColor=true, bool bOp=false, bool bSrc=false, bool bDst=false, bool* pInherited=NULL)=0;
    virtual ZRESULT setAlphaBlend(bool bBlendEnabled, DWORD nOp, DWORD nSrc, DWORD nDst, bool bColor=true, bool bOp=true, bool bSrc=true, bool bDst=true, bool* pInherit=NULL)=0;
    virtual ZRESULT setAlphaSeparation(bool bSeparate=true, bool* pInherit=NULL)=0;
    /* ZRESULT_OK as true. */
    virtual ZRESULT isAlphaSeparate(bool* pInherited=NULL)=0;
    virtual ZRESULT getAlphaTest(bool& bTestEnabled, DWORD* refValue=NULL, DWORD* cmpFunc=NULL, bool* pInherited=NULL)=0;
    virtual ZRESULT setAlphaTest(bool bTestEnabled, DWORD refValue, DWORD cmpFunc, bool* pInherit=NULL)=0;
    virtual ZRESULT getTextureLayer(long nLayer, bool& bEnabled, tTextureLayerInfo* pInfo=NULL, bool* pInherited=NULL)=0;
    virtual ZRESULT setTextureLayer(long nLayer, bool bEnabled, tTextureLayerInfo* pInfo=NULL)=0;
    virtual ZRESULT addTextureLayer(tTextureLayerInfo* pInfo=NULL)=0;
    virtual ZRESULT deleteTextureLayer(long nLayer)=0;
    virtual long getTextureLayersCount(bool bIncludeInherited=false)=0;
    virtual ZRESULT getPreferableVerticesFormat(DWORD& dwFormat)=0;
    virtual ZRESULT enumSupportedVerticesFormat(tULongSeq& seqFormats)=0;
  
  };//class IMaterial
  
  //
  // collection template
  //
  class CMaterialCol : public ZUnknown,
      public ZIntrCollection<IMaterial>
  {
  public:
    INTERFACE_FUNCTIONS_DEFAULT(CMaterialCol)
  };//class CMaterialCol
};//rend

#endif
