csplugincommon/opengl/shaderplugin.h Source File (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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 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   } // namespace PluginCommon
    00170 } // namespace CS
    00171
    00172 #endif // __CS_CSPLUGINCOMMON_OPENGL_SHADERPLUGIN_H__