Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
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 struct csGLExtensionManager;
00033 class csGLStateCache;
00034
00035 namespace CS
00036 {
00037 namespace PluginCommon
00038 {
00042 class CS_CSPLUGINCOMMON_GL_EXPORT ShaderProgramPluginGL :
00043 public scfImplementation1<ShaderProgramPluginGL, iShaderProgramPlugin>
00044 {
00045 public:
00047 enum HardwareVendor
00048 {
00050 Invalid = -1,
00052 Other = 0,
00054 ATI = 1,
00056 NVIDIA = 2
00057 };
00059 static const char* VendorToString (HardwareVendor vendor);
00061 static HardwareVendor VendorFromString (const char* vendorStr);
00062 protected:
00067 HardwareVendor vendor;
00068
00070 ShaderProgramPluginGL (iBase* parent);
00071
00073 bool Initialize (iObjectRegistry* objectReg);
00075 bool Open();
00077 void Close ();
00078
00079 public:
00094 uint ParseVendorMask (const char* mask);
00095
00096 protected:
00098 bool isOpen;
00100 iObjectRegistry* object_reg;
00102 csGLExtensionManager* ext;
00104 csGLStateCache* statecache;
00106 bool doVerbose;
00112 bool doVerbosePrecache;
00113
00114 public:
00116 class CS_CSPLUGINCOMMON_GL_EXPORT ClipPlanes
00117 {
00118 size_t maxPlanes;
00119 uint32 currentPlanes;
00120
00121 CS::ShaderVarStringID svObjectToWorldInv;
00122 CS::ShaderVarStringID svWorldToCamera;
00123
00124 csReversibleTransform worldToObject;
00125 csReversibleTransform worldToCam;
00126 bool eyeToObjectDirty;
00127 csTransform eyeToObject;
00128 public:
00129 ClipPlanes ();
00130 ~ClipPlanes ();
00131
00133 void Initialize (iObjectRegistry* objectReg);
00134
00136 void SetShaderVars (const csShaderVariableStack& stack);
00138 enum ClipSpace
00139 {
00141 Object,
00143 World,
00145 Eye
00146 };
00148
00149 bool AddClipPlane (const csPlane3& plane, ClipSpace space);
00150 bool AddClipPlane (const csVector4& plane, ClipSpace space)
00151 { return AddClipPlane (csPlane3 (plane.x, plane.y, plane.z, plane.w), space); }
00153
00157 bool EnableClipPlane (size_t n);
00162 bool EnableNextClipPlane ();
00164 void DisableClipPlanes ();
00165 };
00167 ClipPlanes clipPlanes;
00168 };
00169 }
00170 }
00171
00172 #endif // __CS_CSPLUGINCOMMON_OPENGL_SHADERPLUGIN_H__