Material.h

00001 //***************************************************************************************
00002 //
00003 // File supervisor: Crosswalk team
00004 //
00005 // Copyright 2008 Autodesk, Inc.  All rights reserved.
00006 // Use of this software is subject to the terms of the Autodesk license agreement
00007 // provided at the time of installation or download, or which otherwise accompanies
00008 // this software in either electronic or hard copy form.
00009 //
00010 //***************************************************************************************
00011 
00012 #ifndef _MATERIAL_H
00013 #define _MATERIAL_H
00014 
00015 #include "Template.h"
00016 
00017 // Forward declaration
00018 class CSLTexture2D;
00019 
00020 
00024 class XSIEXPORT CSLBaseMaterial
00025     : public CSLTemplate
00026 {
00027 public:
00028     virtual SI_Error Synchronize();
00029 
00030     virtual SI_Error GetCapabilities ( SI_Int in_iFeature, SI_Void* out_pValue );
00031 
00032 protected:
00033 
00039     CSLBaseMaterial(CSLScene* in_pScene, CSLModel *in_pModel, CdotXSITemplate* in_pTemplate);
00040 
00041 private:
00042     void *m_pReserved;  // reserved for future extension
00043 };
00044 
00048 class XSIEXPORT CSLMaterial
00049     : public CSLBaseMaterial
00050 {
00051 public:
00055     enum EShadingModel
00056     {
00057         CONSTANT,       
00058         LAMBERT,        
00059         PHONG,          
00060         BLINN,          
00061         SHADOW_OBJECT,  
00062         VERTEX_COLOR,   
00063     };
00064 
00070     CSLMaterial(CSLScene* in_pScene, CSLModel *in_pModel, CdotXSITemplate* in_pTemplate);
00071 
00074     virtual ~CSLMaterial();
00075 
00079     CSIBCColorf GetAmbientColor();
00080 
00085     SI_Void SetAmbientColor(CSIBCColorf &in_rColor);
00086 
00090     CSIBCColorf GetDiffuseColor();
00091 
00096     SI_Void SetDiffuseColor(CSIBCColorf &in_rColor);
00097 
00101     CSIBCColorf GetEmissiveColor();
00102 
00107     SI_Void SetEmissiveColor(CSIBCColorf &in_rColor);
00108 
00112     EShadingModel GetShadingModel();
00113 
00118     SI_Void SetShadingModel(EShadingModel in_Value);
00119 
00123     CSIBCColorf GetSpecularColor();
00124 
00129     SI_Void SetSpecularColor(CSIBCColorf &in_rColor);
00130 
00134     SI_Float GetSpecularDecay();
00135 
00140     SI_Void SetSpecularDecay(SI_Float in_fValue);
00141 
00145     CSLTexture2D* Texture2D();
00146 
00150     CSLTexture2D* CreateTexture2D();
00151 
00155     SI_Error DestroyTexture2D();
00156 
00157     CSLTexture2D* ConnectTexture2D(CSLTexture2D* in_pNewTexture2D);
00158 
00159     virtual SI_Error Synchronize();
00160     virtual ETemplateType Type();
00161     virtual CSLAnimatableType* ParameterFromName(SI_Char *in_szName);
00162     virtual CSLAnimatableType* ParameterFromType(EFCurveType in_Type, SI_Char *in_szParameterName);
00163 
00164     CSLColorRGBAProxy*                          GetDiffuseColorProxy(){ return  &m_DiffuseColor;};
00165     CSLFloatProxy*                              GetSpecularDecayProxy(){ return  &m_SpecularDecay;};
00166     CSLColorRGBProxy*                           GetSpecularColorProxy(){ return  &m_SpecularColor;};
00167     CSLColorRGBProxy*                           GetEmissiveColorProxy(){ return  &m_EmissiveColor;};
00168     CSLEnumProxy<EShadingModel, VERTEX_COLOR>*  GetShadingModelProxy(){ return  &m_ShadingModel;};
00169     CSLColorRGBProxy *                          GetAmbientColorProxy(){ return  &m_AmbientColor;};
00170 
00171 private:
00172     CSLColorRGBAProxy m_DiffuseColor;
00173     CSLFloatProxy m_SpecularDecay;
00174     CSLColorRGBProxy m_SpecularColor;
00175     CSLColorRGBProxy m_EmissiveColor;
00176     CSLEnumProxy<EShadingModel, VERTEX_COLOR> m_ShadingModel;
00177     CSLColorRGBProxy m_AmbientColor;
00178     CSLTexture2D *m_pTexture2D;
00179 
00180     void *m_pReserved;  // reserved for future extension
00181 };
00182 
00183 #endif