CrystalSpace

Public API Reference

Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

shaderplugin.h

00001 /*
00002   Copyright (C) 2003 by Marten Svanfeldt
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_SHADERPLUGIN_H__
00020 #define __CS_SHADERPLUGIN_H__
00021 
00022 #include "csutil/scf.h"
00023 #include "csutil/strhash.h"
00024 #include "csgfx/shadervar.h"
00025 #include "ivideo/shader/shader.h"
00026 
00027 struct csShaderVarMapping
00028 {
00029   csStringID name;
00030   csString destination;
00031   csShaderVarMapping (csStringID n, const char* d)
00032     : name(n), destination(d) {}
00033 };
00034 
00035 SCF_VERSION(iShaderProgram, 0, 2, 1);
00040 struct iShaderProgram : public iBase
00041 {
00043   virtual void Activate() = 0;
00044 
00046   virtual void Deactivate() = 0;
00047 
00049   virtual void SetupState (const csRenderMesh* mesh, 
00050     const csShaderVarStack &stacks) = 0;
00051 
00053   virtual void ResetState () = 0;
00054 
00056   virtual bool Load (iDocumentNode* node) = 0;
00057 
00059   virtual bool Load (const char* program, 
00060     csArray<csShaderVarMapping>& mappings) = 0;
00061 
00063   virtual bool Compile (csArray<iShaderVariableContext*> &staticDomains) = 0;
00064   
00069   virtual int ResolveTextureBinding (const char* binding) = 0;
00070 };
00071 
00072 SCF_VERSION(iShaderProgramPlugin,0,1,0);
00077 struct iShaderProgramPlugin : public iBase
00078 {
00079   virtual csPtr<iShaderProgram> CreateProgram(const char* type) = 0;
00080   virtual bool SupportType(const char* type) = 0;
00081 };
00082 
00083 #endif
00084 

Generated for Crystal Space by doxygen 1.3.9.1