00001 /*============================================================================== 00002 00003 file: imrMaterialCustAttrib.h 00004 00005 author: Daniel Levesque 00006 00007 created: 26sept2002 00008 00009 description: 00010 00011 Interface definition for the mental ray custom attributes. This custom 00012 attributes is used to override the default translation of a MAX materal 00013 by assigning custom shaders. 00014 00015 modified: 00016 00017 00018 (c) 2002 Autodesk 00019 ==============================================================================*/ 00020 #pragma once 00021 00022 #include "..\CustAttrib.h" 00023 00024 // forward declarations 00025 class Texmap; 00026 #define MRMATERIALCUSTATTRIB_CLASS_ID Class_ID(0x218ab459, 0x25dc8980) 00027 00028 //============================================================================== 00029 // class imrMaterialCustAttrib 00030 // 00031 // The mental ray material custom attributes. Used to assign custom shaders 00032 // to MAX materals, overriding the default translation. 00033 // 00034 //============================================================================== 00035 class imrMaterialCustAttrib : public CustAttrib { 00036 00037 public: 00038 00039 enum ShaderSlot { 00040 kShaderSlot_Surface, 00041 kShaderSlot_Displacement, 00042 kShaderSlot_Shadow, 00043 kShaderSlot_Volume, 00044 kShaderSlot_Environment, 00045 kShaderSlot_Contour, 00046 kShaderSlot_Photon, 00047 kShaderSlot_PhotonVolume, 00048 kShaderSlot_LightMap, 00049 00050 kShaderSlot_Count 00051 }; 00052 00053 // Gets/Sets the "Opaque" flag at the given time 00054 virtual bool GetOpaque(TimeValue t = 0) const = 0; 00055 virtual void SetOpaque(bool val, TimeValue t = 0) = 0; 00056 00057 // Gets/Sets the different shaders. 00058 virtual Texmap* GetShader(ShaderSlot slot) const = 0; 00059 virtual void SetShader(ShaderSlot slot, Texmap* shader) = 0; 00060 00061 // Enables/Disables the locks for each slot 00062 virtual bool GetLockEnabled(ShaderSlot slot) const = 0; 00063 virtual void SetLockEnabled(ShaderSlot slot, bool enable) = 0; 00064 00065 // Turns the locks for each slot ON/OFF. 00066 virtual bool GetShaderLocked(ShaderSlot slot) const = 0; 00067 virtual void SetShaderLocked(ShaderSlot slot, bool lock) = 0; 00068 00069 // Returns whether the given shader slot is locked. Shader locks that are 00070 // disabled are never ON, regardless of the value returned by GetShaderLock() 00071 virtual bool IsShaderLocked(ShaderSlot slot) const = 0; 00072 }; 00073 00074 // Returns the mental ray custom attribute associate with the given material, 00075 // if it one exists. 00076 // Cut and paste in your source file to use it. 00077 /* 00078 imrMaterialCustAttrib* Get_mrMaterialCustAttrib(MtlBase* rt) { 00079 00080 ICustAttribContainer* cc = rt->GetCustAttribContainer(); 00081 if(cc != NULL) { 00082 int nbCustAttribs = cc->GetNumCustAttribs(); 00083 for(int i = 0; i < nbCustAttribs; ++i) { 00084 00085 CustAttrib* ca = cc->GetCustAttrib(i); 00086 if((ca != NULL) && (ca->ClassID() == MRMATERIALCUSTATTRIB_CLASS_ID)) { 00087 return static_cast<imrMaterialCustAttrib*>(ca); 00088 } 00089 } 00090 } 00091 00092 return NULL; 00093 } 00094 */ 00095