CrystalSpace

Public API Reference

Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | 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 
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(iShaderTUResolver, 0, 0, 1);
00040 struct iShaderTUResolver : public iBase
00041 {
00046   virtual int ResolveTextureBinding (const char* binding) = 0;
00047 };
00048 
00049 SCF_VERSION(iShaderProgram, 0, 3, 0);
00054 struct iShaderProgram : public iBase
00055 {
00057   virtual void Activate() = 0;
00058 
00060   virtual void Deactivate() = 0;
00061 
00063   virtual void SetupState (const csRenderMesh* mesh, 
00064                            csRenderMeshModes& modes,
00065                            const csShaderVarStack &stacks) = 0;
00066 
00068   virtual void ResetState () = 0;
00069 
00071   virtual bool Load (iShaderTUResolver* tuResolve, iDocumentNode* node) = 0;
00072 
00074   virtual bool Load (iShaderTUResolver* tuResolve, const char* program, 
00075     csArray<csShaderVarMapping>& mappings) = 0;
00076 
00078   virtual bool Compile () = 0;
00079 };
00080 
00081 SCF_VERSION(iShaderProgramPlugin,0,1,0);
00086 struct iShaderProgramPlugin : public iBase
00087 {
00088   virtual csPtr<iShaderProgram> CreateProgram(const char* type) = 0;
00089   virtual bool SupportType(const char* type) = 0;
00090 };
00091 
00092 #endif
00093 

Generated for Crystal Space by doxygen 1.4.4