ivideo/material.h
Go to the documentation of this file.00001 /* 00002 Copyright (C) 2000 by Jorrit Tyberghein 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public 00015 License along with this library; if not, write to the Free 00016 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00017 */ 00018 00019 #ifndef __CS_IVIDEO_MATERIAL_H__ 00020 #define __CS_IVIDEO_MATERIAL_H__ 00021 00029 #include "csutil/scf.h" 00030 #include "csutil/strset.h" 00031 #include "csutil/strhash.h" 00032 00033 #include "ivideo/rndbuf.h" 00034 #include "ivideo/rendermesh.h" 00035 #include "ivideo/shader/shader.h" 00036 00038 #define CS_DEFMAT_DIFFUSE 0.7f 00039 00040 #define CS_DEFMAT_AMBIENT 0.0f 00041 00042 #define CS_DEFMAT_REFLECTION 0.0f 00043 00045 #define CS_MATERIAL_VARNAME_DIFFUSE "mat diffuse" 00046 00047 #define CS_MATERIAL_VARNAME_AMBIENT "mat ambient" 00048 00049 #define CS_MATERIAL_VARNAME_REFLECTION "mat reflection" 00050 00051 #define CS_MATERIAL_VARNAME_FLATCOLOR "mat flatcolor" 00052 00053 #define CS_MATERIAL_TEXTURE_DIFFUSE "tex diffuse" 00054 00056 #define CS_MATERIAL_TEXTURE_LAYER1 "tex layer1" 00057 00058 #define CS_MATERIAL_TEXTURE_LAYER2 "tex layer2" 00059 00060 #define CS_MATERIAL_TEXTURE_LAYER3 "tex layer3" 00061 00062 #define CS_MATERIAL_TEXTURE_LAYER4 "tex layer4" 00063 00064 struct iTextureHandle; 00065 struct csRGBpixel; 00066 struct csRGBcolor; 00067 00072 struct csTextureLayer 00073 { 00075 csRef<iTextureHandle> txt_handle; 00077 uint mode; 00079 float uscale, vscale; 00081 float ushift, vshift; 00082 }; 00083 00084 SCF_VERSION (iMaterial, 0, 0, 6); 00085 00093 struct iMaterial : public iShaderVariableContext 00094 { 00098 virtual void SetShader (csStringID type, iShader* shader) = 0; 00099 00103 virtual iShader* GetShader (csStringID type) = 0; 00104 00108 virtual iTextureHandle *GetTexture () = 0; 00109 00113 virtual iTextureHandle* GetTexture (csStringID name) = 0; 00114 00115 #ifndef CS_USE_NEW_RENDERER 00116 00120 virtual int GetTextureLayerCount () = 0; 00121 00125 virtual csTextureLayer* GetTextureLayer (int idx) = 0; 00126 #endif 00127 00132 virtual void GetFlatColor (csRGBpixel &oColor, 00133 bool useTextureMean = true) = 0; 00137 virtual void SetFlatColor (const csRGBcolor& col) = 0; 00138 00142 virtual void GetReflection ( 00143 float &oDiffuse, float &oAmbient, float &oReflection) = 0; 00147 virtual void SetReflection (float oDiffuse, float oAmbient, 00148 float oReflection) = 0; 00149 }; 00150 00151 SCF_VERSION (iMaterialHandle, 0, 0, 2); 00152 00157 struct iMaterialHandle : public iBase 00158 { 00162 virtual iShader* GetShader (csStringID type) = 0; 00163 00167 virtual iTextureHandle *GetTexture () = 0; 00168 00173 virtual void GetFlatColor (csRGBpixel &oColor) = 0; 00174 00178 virtual void GetReflection (float &oDiffuse, float &oAmbient, 00179 float &oReflection) = 0; 00180 00187 virtual void Prepare () = 0; 00188 }; 00189 00192 #endif // __CS_IVIDEO_MATERIAL_H__
Generated for Crystal Space by doxygen 1.2.18