IViewportManager.h

Go to the documentation of this file.
00001 /**********************************************************************
00002  *<
00003     FILE: IViewportManager.h
00004 
00005     DESCRIPTION:    Viewport Manager for loading up DXEffects and other 
00006                     viewport properties
00007 
00008     CREATED BY:     Neil Hazzard
00009 
00010     HISTORY:        Created:  02/15/02
00011                     Updated:  05/05/04  New interface added for 3ds max7
00012                     Updated:  07/21/05  New interface added for 3ds max10
00013                     Updated:  07/13/07  exposed some new viewport properties
00014                     
00015 
00016  *> Copyright (c) 2004, All Rights Reserved.
00017  **********************************************************************/
00018 
00019 #pragma once
00020 
00021 #include "iFnPub.h"
00022 #include "custattrib.h"
00023 #include "IHardwareMaterial.h"
00024 #include "GetCOREInterface.h"
00025 // forward declarations
00026 class MtlBase;
00027 
00028 #define VIEWPORT_SHADER_MANAGER_INTERFACE Interface_ID(0x5dbe33d6, 0x2e1b422b)
00029 #define VIEWPORT_SHADER_MANAGER_INTERFACE2 Interface_ID(0x5a4d6672, 0x7d8a2857)
00030 #define VIEWPORT_SHADER_MANAGER_INTERFACE3 Interface_ID(0x59b97216, 0x64d41c0d)
00031 
00032 #define VIEWPORT_SHADER_CLIENT_INTERFACE Interface_ID(0x40c926b8, 0x7c3a66b7)
00033 #define VIEWPORT_SHADER9_CLIENT_INTERFACE Interface_ID(0x40c926b7, 0x7c3a6347)
00034 
00035 #define IDX_SHADER_MANAGER Interface_ID(0x6dce7429, 0x200169ac)
00036 
00038 
00041 class IViewportShaderManager : public FPMixinInterface {
00042     public:
00043 
00044         enum {  get_num_effects, get_active_effect, is_effect_active, is_manager_active,
00045         get_effect_name,set_effect,activate_effect};
00046 
00047         FPInterfaceDesc* GetDesc();    
00048 
00052         virtual int GetNumEffects()=0;
00053 
00057         virtual ReferenceTarget* GetActiveEffect()=0;
00058 
00063         virtual MCHAR * GetEffectName(int i)=0;
00064 
00069         virtual ReferenceTarget * SetViewportEffect(int i)=0;
00070 
00076         virtual void ActivateEffect(MtlBase * mtl, BOOL State)=0;
00077 
00078 
00079     };
00081 
00083 class IViewportShaderManager2 : public IViewportShaderManager
00084 {
00085 public:
00087 
00091     virtual bool SaveFXFile(MCHAR * fileName)=0;
00092 
00096     virtual bool IsDxStdMtlEnabled()=0;
00097 
00101     virtual void SetDxStdMtlEnabled(bool state)=0;
00102 
00106     virtual MCHAR * GetActiveEffectName() = 0;
00107 };
00108 
00110 
00121 class IViewportShaderManager3 : public IViewportShaderManager2
00122 {
00123 public:
00129     virtual bool IsCurrentEffectEnabled() = 0;
00130 
00136     virtual bool SetCurrentEffectEnabled(bool enabled) = 0;
00137 
00142     virtual bool IsDxStdMtlSupported() = 0;
00143 
00148     virtual bool IsSaveFxSupported() = 0;
00149 
00154     virtual bool IsCurrentEffectSupported() = 0;
00155 
00159     virtual MtlBase* FindOwnerMaterial() = 0;
00160 };
00161 
00163 
00209 class IDXDataBridge : public BaseInterface
00210 {
00211 public:
00214     virtual Interface_ID    GetID() { return VIEWPORT_SHADER_CLIENT_INTERFACE; }
00215 
00216     // Interface Lifetime
00217     virtual LifetimeType    LifetimeControl() { return noRelease; }
00231     virtual ParamDlg * CreateEffectDlg(HWND hWnd, IMtlParams * imp)= 0;
00232 
00234 
00236     virtual void DisableUI()=0;
00237 
00244     virtual MCHAR * GetName()=0;
00245 
00265     virtual void SetDXData(IHardwareMaterial * pHWMtl, Mtl * pMtl)=0;
00266 };
00267 
00268 
00269 // If you are creating a DX9 based DXEffects then you need to implement this interface 
00270 class IDX9DataBridge : public IDXDataBridge
00271 {
00272 public:
00273     // Interface Lifetime
00274     virtual LifetimeType    LifetimeControl() { return noRelease; }
00275     virtual Interface_ID    GetID() { return VIEWPORT_SHADER9_CLIENT_INTERFACE; }
00276 
00278 
00281     virtual float GetDXVersion() = 0;
00282     
00283 };
00284 
00303 class IDXShaderManagerInterface : public FPStaticInterface
00304 {
00305     public:
00315         virtual CustAttrib* FindViewportShaderManager (MtlBase* mtl)=0;
00325         virtual CustAttrib* AddViewportShaderManager(MtlBase * mtl)=0;
00326         
00335         virtual void    SetVisible(BOOL show=TRUE)=0;
00338         virtual BOOL    IsVisible()=0;
00339     
00340 };
00341 
00342 inline IDXShaderManagerInterface* GetDXShaderManager() { return (IDXShaderManagerInterface*)GetCOREInterface(IDX_SHADER_MANAGER); }
00343 
00344 
00345 
00346 
00347