Material.h

00001 /****************************************************************************************
00002 THIS CODE IS PUBLISHED AS A SAMPLE ONLY AND IS PROVIDED "AS IS".
00003 IN NO EVENT SHALL SOFTIMAGE, AVID TECHNOLOGY, INC. AND/OR THEIR RESPECTIVE 
00004 SUPPLIERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
00005 DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
00006 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
00007 CONNECTION WITH THE USE OR PERFORMANCE OF THIS CODE . 
00008  
00009 COPYRIGHT NOTICE. Copyright © 1999-2002 Avid Technology Inc. . All rights reserved. 
00010 
00011 SOFTIMAGE is a registered trademark of Avid Technology Inc. or its subsidiaries 
00012 or divisions. Windows NT is a registered trademark of Microsoft Corp. All other
00013 trademarks contained herein are the property of their respective owners. 
00014 ****************************************************************************************/
00015 /******************************************************************************\
00016 *
00017 * File:          Material.h
00018 * Creation date: January 15, 2002
00019 * Purpose:       Declaration of class 'Material' & 'BaseMaterial'
00020 *
00021 \******************************************************************************/
00022 #ifndef _MATERIAL_H
00023 #define _MATERIAL_H
00024 
00025 #include "Template.h"
00026 
00027 // Forward declaration
00028 class CSLTexture2D;
00029 
00030 
00037 class XSIEXPORT CSLBaseMaterial
00038     : public CSLTemplate
00039 {
00040 public:
00041     virtual SI_Error Synchronize();
00042 
00043     virtual SI_Error GetCapabilities ( SI_Int in_iFeature, SI_Void* out_pValue );
00044 
00045 protected:
00046 
00052     CSLBaseMaterial(CSLScene* in_pScene, CSLModel *in_pModel, CdotXSITemplate* in_pTemplate);
00053 
00054 private:
00055     void *m_pReserved;  // reserved for future extension
00056 };
00057 
00063 class XSIEXPORT CSLMaterial
00064     : public CSLBaseMaterial
00065 {
00066 public:
00070     enum EShadingModel
00071     {
00072         CONSTANT,       
00073         LAMBERT,        
00074         PHONG,          
00075         BLINN,          
00076         SHADOW_OBJECT,  
00077         VERTEX_COLOR,   
00078     };
00079 
00085     CSLMaterial(CSLScene* in_pScene, CSLModel *in_pModel, CdotXSITemplate* in_pTemplate);
00086 
00089     virtual ~CSLMaterial();
00090 
00094     CSIBCColorf GetAmbientColor();
00095 
00100     SI_Void SetAmbientColor(CSIBCColorf &in_rColor);
00101 
00105     CSIBCColorf GetDiffuseColor();
00106 
00111     SI_Void SetDiffuseColor(CSIBCColorf &in_rColor);
00112 
00116     CSIBCColorf GetEmissiveColor();
00117 
00122     SI_Void SetEmissiveColor(CSIBCColorf &in_rColor);
00123 
00127     EShadingModel GetShadingModel();
00128 
00133     SI_Void SetShadingModel(EShadingModel in_Value);
00134 
00138     CSIBCColorf GetSpecularColor();
00139 
00144     SI_Void SetSpecularColor(CSIBCColorf &in_rColor);
00145 
00149     SI_Float GetSpecularDecay();
00150 
00155     SI_Void SetSpecularDecay(SI_Float in_fValue);
00156 
00160     CSLTexture2D* Texture2D();
00161 
00165     CSLTexture2D* CreateTexture2D();
00166 
00170     SI_Error DestroyTexture2D();
00171 
00172     CSLTexture2D* ConnectTexture2D(CSLTexture2D* in_pNewTexture2D);
00173 
00174     virtual SI_Error Synchronize();
00175     virtual ETemplateType Type();
00176     virtual CSLAnimatableType* ParameterFromName(SI_Char *in_szName);
00177     virtual CSLAnimatableType* ParameterFromType(EFCurveType in_Type, SI_Char *in_szParameterName);
00178 
00179     CSLColorRGBAProxy*                          GetDiffuseColorProxy(){ return  &m_DiffuseColor;};
00180     CSLFloatProxy*                              GetSpecularDecayProxy(){ return  &m_SpecularDecay;};
00181     CSLColorRGBProxy*                           GetSpecularColorProxy(){ return  &m_SpecularColor;};
00182     CSLColorRGBProxy*                           GetEmissiveColorProxy(){ return  &m_EmissiveColor;};
00183     CSLEnumProxy<EShadingModel, VERTEX_COLOR>*  GetShadingModelProxy(){ return  &m_ShadingModel;};
00184     CSLColorRGBProxy *                          GetAmbientColorProxy(){ return  &m_AmbientColor;};
00185 
00186 private:
00187     CSLColorRGBAProxy m_DiffuseColor;
00188     CSLFloatProxy m_SpecularDecay;
00189     CSLColorRGBProxy m_SpecularColor;
00190     CSLColorRGBProxy m_EmissiveColor;
00191     CSLEnumProxy<EShadingModel, VERTEX_COLOR> m_ShadingModel;
00192     CSLColorRGBProxy m_AmbientColor;
00193     CSLTexture2D *m_pTexture2D;
00194 
00195     void *m_pReserved;  // reserved for future extension
00196 };
00197 
00198 #endif