csplugincommon/opengl/shaderplugin.h
Go to the documentation of this file.00001 /* 00002 Copyright (C) 2008 by Frank Richter 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_CSPLUGINCOMMON_OPENGL_SHADERPLUGIN_H__ 00020 #define __CS_CSPLUGINCOMMON_OPENGL_SHADERPLUGIN_H__ 00021 00026 #include "csextern_gl.h" 00027 00028 #include "csgeom/plane3.h" 00029 #include "csplugincommon/shader/shaderplugin.h" 00030 #include "csutil/scf_implementation.h" 00031 00032 class csGLStateCache; 00033 00034 namespace CS 00035 { 00036 struct GLExtensionManager; 00037 00038 namespace PluginCommon 00039 { 00043 class CS_CSPLUGINCOMMON_GL_EXPORT ShaderProgramPluginGL : 00044 public scfImplementation1<ShaderProgramPluginGL, iShaderProgramPlugin> 00045 { 00046 public: 00048 enum HardwareVendor 00049 { 00051 Invalid = -1, 00053 Other = 0, 00055 ATI = 1, 00057 NVIDIA = 2 00058 }; 00060 static const char* VendorToString (HardwareVendor vendor); 00062 static HardwareVendor VendorFromString (const char* vendorStr); 00063 protected: 00068 HardwareVendor vendor; 00069 00071 ShaderProgramPluginGL (iBase* parent); 00072 00074 bool Initialize (iObjectRegistry* objectReg); 00076 bool Open(); 00078 void Close (); 00079 00080 public: 00095 uint ParseVendorMask (const char* mask); 00096 00097 protected: 00099 bool isOpen; 00101 iObjectRegistry* object_reg; 00103 CS::GLExtensionManager* ext; 00105 csGLStateCache* statecache; 00107 bool doVerbose; 00113 bool doVerbosePrecache; 00114 00115 public: 00117 class CS_CSPLUGINCOMMON_GL_EXPORT ClipPlanes 00118 { 00119 size_t maxPlanes; 00120 uint32 currentPlanes; 00121 00122 CS::ShaderVarStringID svObjectToWorldInv; 00123 CS::ShaderVarStringID svWorldToCamera; 00124 00125 csReversibleTransform worldToObject; 00126 csReversibleTransform worldToCam; 00127 bool eyeToObjectDirty; 00128 csTransform eyeToObject; 00129 public: 00130 ClipPlanes (); 00131 ~ClipPlanes (); 00132 00134 void Initialize (iObjectRegistry* objectReg); 00135 00137 void SetShaderVars (const csShaderVariableStack& stack); 00139 enum ClipSpace 00140 { 00142 Object, 00144 World, 00146 Eye 00147 }; 00149 00150 bool AddClipPlane (const csPlane3& plane, ClipSpace space); 00151 bool AddClipPlane (const csVector4& plane, ClipSpace space) 00152 { return AddClipPlane (csPlane3 (plane.x, plane.y, plane.z, plane.w), space); } 00154 00158 bool EnableClipPlane (size_t n); 00163 bool EnableNextClipPlane (); 00165 void DisableClipPlanes (); 00166 }; 00168 ClipPlanes clipPlanes; 00169 }; 00170 } // namespace PluginCommon 00171 } // namespace CS 00172 00173 #endif // __CS_CSPLUGINCOMMON_OPENGL_SHADERPLUGIN_H__
Generated for Crystal Space 2.1 by doxygen 1.6.1
