ivideo/shader/shader.h
00001 /* 00002 Copyright (C) 2002 by Marten Svanfeldt 00003 Anders Stenberg 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; if not, write to the Free 00017 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 00020 00021 #ifndef __CS_IVIDEO_SHADER_H__ 00022 #define __CS_IVIDEO_SHADER_H__ 00023 00024 #include "csgeom/vector4.h" 00025 #include "csutil/ref.h" 00026 #include "csutil/refarr.h" 00027 #include "csutil/scf.h" 00028 #include "csutil/strhash.h" 00029 #include "ivideo/graph3d.h" 00030 #include "csgfx/shadervar.h" 00031 00032 struct iString; 00033 struct iDataBuffer; 00034 struct iDocumentNode; 00035 struct iMaterial; 00036 00037 struct iShaderManager; 00038 struct iShaderRenderInterface; 00039 struct iShader; 00040 struct iShaderCompiler; 00041 00042 struct csRenderMesh; 00043 00044 00045 00046 SCF_VERSION (iShaderVariableContext, 0, 0, 1); 00047 00052 struct iShaderVariableContext : public iBase 00053 { 00055 virtual void AddVariable (csShaderVariable *variable) = 0; 00056 00058 virtual csShaderVariable* GetVariable (csStringID name) const = 0; 00059 00061 virtual csShaderVariable* GetVariableRecursive (csStringID name) const = 0; 00062 00064 virtual unsigned int FillVariableList (csShaderVariableProxyList *list) const = 0; 00065 00069 csShaderVariable* GetVariableAdd (csStringID name) 00070 { 00071 csShaderVariable* sv; 00072 sv = GetVariable (name); 00073 if (sv == 0) 00074 { 00075 sv = new csShaderVariable (name); 00076 AddVariable (sv); 00077 } 00078 return sv; 00079 } 00080 00084 csShaderVariable* GetVariableRecursiveAdd (csStringID name) 00085 { 00086 csShaderVariable* sv; 00087 sv = GetVariableRecursive (name); 00088 if (sv == 0) 00089 { 00090 sv = new csShaderVariable (name); 00091 AddVariable (sv); 00092 } 00093 return sv; 00094 } 00095 }; 00096 00097 SCF_VERSION (iShaderManager, 0, 1, 0); 00098 00102 struct iShaderManager : public iShaderVariableContext 00103 { 00105 virtual void RegisterShader(iShader* shader) = 0; 00107 virtual iShader* GetShader(const char* name) = 0; 00109 virtual const csRefArray<iShader> &GetShaders () = 0; 00110 00112 virtual void RegisterCompiler (iShaderCompiler* compiler) = 0; 00114 virtual iShaderCompiler* GetCompiler(const char* name) = 0; 00115 }; 00116 00117 SCF_VERSION (iShaderRenderInterface, 0,0,1); 00118 00120 struct iShaderRenderInterface : public iBase 00121 { 00123 virtual void* GetPrivateObject(const char* name) = 0; 00124 }; 00125 00126 SCF_VERSION (iShader, 0,0,2); 00127 00132 struct iShader : public iShaderVariableContext 00133 { 00135 virtual const char* GetName() = 0; 00136 00138 virtual int GetNumberOfPasses() = 0; 00139 00141 virtual bool ActivatePass(unsigned int number) = 0; 00142 00144 virtual bool SetupPass (csRenderMesh *mesh, 00145 const csArray<iShaderVariableContext*> &dynamicDomains) = 0; 00146 00151 virtual bool TeardownPass() = 0; 00152 00154 virtual bool DeactivatePass() = 0; 00155 }; 00156 00157 00158 SCF_VERSION (iShaderCompiler, 0,0,1); 00164 struct iShaderCompiler : iBase 00165 { 00167 virtual const char* GetName() = 0; 00168 00170 virtual csPtr<iShader> CompileShader (iDocumentNode *templ) = 0; 00171 00173 virtual bool ValidateTemplate (iDocumentNode *templ) = 0; 00174 00176 virtual bool IsTemplateToCompiler (iDocumentNode *templ) = 0; 00177 }; 00178 00179 #endif // __CS_IVIDEO_SHADER_H__
Generated for Crystal Space by doxygen 1.2.18