Browse Source

Check needed OpenGL extensions more carefully.
Cleaned up unnecessary GLee code.
Initial OpenGL light pre-pass rendering.

Lasse Öörni 14 years ago
parent
commit
c27ab40f7f

+ 2 - 4
Engine/Graphics/Batch.cpp

@@ -222,10 +222,8 @@ void Batch::Prepare(Graphics* graphics, Renderer* renderer, bool setModelTransfo
     unsigned viewportHash = (viewport.left_) | (viewport.top_ << 8) | (viewport.right_ << 16) | (viewport.bottom_ << 24);
     unsigned viewportHash = (viewport.left_) | (viewport.top_ << 8) | (viewport.right_ << 16) | (viewport.bottom_ << 24);
     if (graphics->NeedParameterUpdate(VSP_GBUFFEROFFSETS, (const void*)viewportHash))
     if (graphics->NeedParameterUpdate(VSP_GBUFFEROFFSETS, (const void*)viewportHash))
     {
     {
-        IntVector2 screenSize = graphics->GetRenderTargetDimensions();
-        
-        float gBufferWidth = (float)screenSize.x_;
-        float gBufferHeight = (float)screenSize.y_;
+        float gBufferWidth = (float)graphics->GetWidth();
+        float gBufferHeight = (float)graphics->GetHeight();
         float widthRange = 0.5f * (viewport.right_ - viewport.left_) / gBufferWidth;
         float widthRange = 0.5f * (viewport.right_ - viewport.left_) / gBufferWidth;
         float heightRange = 0.5f * (viewport.bottom_ - viewport.top_) / gBufferHeight;
         float heightRange = 0.5f * (viewport.bottom_ - viewport.top_) / gBufferHeight;
         
         

+ 1 - 1
Engine/Graphics/Direct3D9/D3D9Graphics.h

@@ -323,7 +323,7 @@ public:
     static unsigned GetRGBFormat();
     static unsigned GetRGBFormat();
     /// Return the API-specific RGBA texture format.
     /// Return the API-specific RGBA texture format.
     static unsigned GetRGBAFormat();
     static unsigned GetRGBAFormat();
-    /// Return the API-specific depth texture format.
+    /// Return the API-specific one-channel linear depth format.
     static unsigned GetDepthFormat();
     static unsigned GetDepthFormat();
     /// Return the API-specific depth stencil texture format.
     /// Return the API-specific depth stencil texture format.
     static unsigned GetDepthStencilFormat();
     static unsigned GetDepthStencilFormat();

+ 36 - 25
Engine/Graphics/OpenGL/OGLGraphics.cpp

@@ -129,6 +129,7 @@ Graphics::Graphics(Context* context_) :
     vsync_(false),
     vsync_(false),
     tripleBuffer_(false),
     tripleBuffer_(false),
     flushGPU_(true),
     flushGPU_(true),
+    lightPrepassSupport_(false),
     numPrimitives_(0),
     numPrimitives_(0),
     numBatches_(0),
     numBatches_(0),
     defaultTextureFilterMode_(FILTER_BILINEAR),
     defaultTextureFilterMode_(FILTER_BILINEAR),
@@ -244,13 +245,20 @@ bool Graphics::SetMode(int width, int height, bool fullscreen, bool vsync, bool
             return false;
             return false;
         }
         }
         
         
-        if (!_GLEE_EXT_framebuffer_object || !_GLEE_EXT_packed_depth_stencil)
+        if (!_GLEE_EXT_framebuffer_object || !_GLEE_EXT_packed_depth_stencil || !_GLEE_EXT_texture_compression_s3tc ||
+            !_GLEE_EXT_texture_filter_anisotropic)
         {
         {
-            LOGERROR("EXT_framebuffer_object and EXT_packed_depth_stencil OpenGL extensions are required");
+            LOGERROR("EXT_framebuffer_object, EXT_packed_depth_stencil, EXT_texture_compression_s3tc and "
+                "EXT_texture_filter_anisotropic OpenGL extensions are required");
             glfwCloseWindow(impl_->window_);
             glfwCloseWindow(impl_->window_);
             return false;
             return false;
         }
         }
         
         
+        if (_GLEE_ARB_texture_float)
+            lightPrepassSupport_ = true;
+        else
+            lightPrepassSupport_ = false;
+        
         // Set window close callback
         // Set window close callback
         glfwSetWindowCloseCallback(CloseCallback);
         glfwSetWindowCloseCallback(CloseCallback);
         
         
@@ -1205,33 +1213,33 @@ void Graphics::SetRenderTarget(unsigned index, Texture2D* renderTexture)
 
 
 void Graphics::SetDepthStencil(RenderSurface* depthStencil)
 void Graphics::SetDepthStencil(RenderSurface* depthStencil)
 {
 {
-    if (depthStencil != depthStencil_)
+    // If we are using a render target texture, it is required in OpenGL to also have an own depth stencil
+    // Create a new depth stencil texture as necessary to be able to provide similar behaviour as Direct3D9
+    if (renderTargets_[0] && !depthStencil)
     {
     {
-        // If we are using a render target texture, it is required in OpenGL to also have an own depth stencil
-        // Create a new depth stencil texture as necessary to be able to provide similar behaviour as Direct3D9
-        if (renderTargets_[0] && !depthStencil)
+        int width = renderTargets_[0]->GetWidth();
+        int height = renderTargets_[0]->GetHeight();
+        
+        // Direct3D9 default depth stencil can not be used when render target is larger than the window.
+        // Check size similarly
+        if (width <= width_ && height <= height_)
         {
         {
-            int width = renderTargets_[0]->GetWidth();
-            int height = renderTargets_[0]->GetHeight();
-            
-            // Direct3D9 default depth stencil can not be used when render target is larger than the window.
-            // Check size similarly
-            if (width <= width_ && height <= height_)
+            int searchKey = (width << 16) | height;
+            HashMap<int, SharedPtr<Texture2D> >::Iterator i = depthTextures_.Find(searchKey);
+            if (i != depthTextures_.End())
+                depthStencil = i->second_->GetRenderSurface();
+            else
             {
             {
-                int searchKey = (width << 16) | height;
-                HashMap<int, SharedPtr<Texture2D> >::Iterator i = depthTextures_.Find(searchKey);
-                if (i != depthTextures_.End())
-                    depthStencil = i->second_->GetRenderSurface();
-                else
-                {
-                    SharedPtr<Texture2D> newDepthTexture(new Texture2D(context_));
-                    newDepthTexture->SetSize(width, height, GetDepthStencilFormat(), TEXTURE_DEPTHSTENCIL);
-                    depthTextures_[searchKey] = newDepthTexture;
-                    depthStencil = newDepthTexture->GetRenderSurface();
-                }
+                SharedPtr<Texture2D> newDepthTexture(new Texture2D(context_));
+                newDepthTexture->SetSize(width, height, GetDepthStencilFormat(), TEXTURE_DEPTHSTENCIL);
+                depthTextures_[searchKey] = newDepthTexture;
+                depthStencil = newDepthTexture->GetRenderSurface();
             }
             }
         }
         }
-        
+    }
+    
+    if (depthStencil != depthStencil_)
+    {
         /// \todo Should check that the texture actually is in depth format
         /// \todo Should check that the texture actually is in depth format
         depthStencil_ = depthStencil;
         depthStencil_ = depthStencil;
         
         
@@ -1798,7 +1806,7 @@ unsigned Graphics::GetRGBAFormat()
 
 
 unsigned Graphics::GetDepthFormat()
 unsigned Graphics::GetDepthFormat()
 {
 {
-    return GL_DEPTH_COMPONENT24;
+    return GL_LUMINANCE32F_ARB;
 }
 }
 
 
 unsigned Graphics::GetDepthStencilFormat()
 unsigned Graphics::GetDepthStencilFormat()
@@ -1934,6 +1942,9 @@ void Graphics::SetTextureUnitMappings()
     textureUnits_["ShadowMap"] = TU_SHADOWMAP;
     textureUnits_["ShadowMap"] = TU_SHADOWMAP;
     textureUnits_["FaceSelectCubeMap"] = TU_FACESELECT;
     textureUnits_["FaceSelectCubeMap"] = TU_FACESELECT;
     textureUnits_["IndirectionCubeMap"] = TU_INDIRECTION;
     textureUnits_["IndirectionCubeMap"] = TU_INDIRECTION;
+    textureUnits_["NormalBuffer"] = TU_NORMALBUFFER;
+    textureUnits_["DepthBuffer"] = TU_DEPTHBUFFER;
+    textureUnits_["LightBuffer"] = TU_LIGHTBUFFER;
 }
 }
 
 
 void RegisterGraphicsLibrary(Context* context)
 void RegisterGraphicsLibrary(Context* context)

+ 5 - 3
Engine/Graphics/OpenGL/OGLGraphics.h

@@ -240,8 +240,8 @@ public:
     /// Return whether Shader Model 3 is supported. Always false on OpenGL.
     /// Return whether Shader Model 3 is supported. Always false on OpenGL.
     bool GetSM3Support() const { return false; }
     bool GetSM3Support() const { return false; }
     /// Return whether light pre-pass rendering is supported.
     /// Return whether light pre-pass rendering is supported.
-    bool GetLightPrepassSupport() const { return true; }
-    /// Return whether hardware depth texture is supported.
+    bool GetLightPrepassSupport() const { return lightPrepassSupport_; }
+    /// Return whether hardware depth texture is supported. Always false on OpenGL due to artifacts / slowdown on some GPUs.
     bool GetHardwareDepthSupport() const { return false; }
     bool GetHardwareDepthSupport() const { return false; }
     /// Return whether shadow map depth compare is done in hardware. Always true on OpenGL.
     /// Return whether shadow map depth compare is done in hardware. Always true on OpenGL.
     bool GetHardwareShadowSupport() const { return true; }
     bool GetHardwareShadowSupport() const { return true; }
@@ -349,7 +349,7 @@ public:
     static unsigned GetRGBFormat();
     static unsigned GetRGBFormat();
     /// Return the API-specific RGBA texture format.
     /// Return the API-specific RGBA texture format.
     static unsigned GetRGBAFormat();
     static unsigned GetRGBAFormat();
-    /// Return the API-specific depth texture format.
+    /// Return the API-specific one-channel linear depth format.
     static unsigned GetDepthFormat();
     static unsigned GetDepthFormat();
     /// Return the API-specific depth stencil texture format.
     /// Return the API-specific depth stencil texture format.
     static unsigned GetDepthStencilFormat();
     static unsigned GetDepthStencilFormat();
@@ -382,6 +382,8 @@ private:
     bool tripleBuffer_;
     bool tripleBuffer_;
     /// Flush GPU command queue flag.
     /// Flush GPU command queue flag.
     bool flushGPU_;
     bool flushGPU_;
+    /// Light prepass support flag.
+    bool lightPrepassSupport_;
     /// Number of primitives this frame.
     /// Number of primitives this frame.
     unsigned numPrimitives_;
     unsigned numPrimitives_;
     /// Number of batches this frame.
     /// Number of batches this frame.

+ 3 - 0
Engine/Graphics/OpenGL/OGLTexture.cpp

@@ -231,6 +231,7 @@ unsigned Texture::GetRowDataSize(int width) const
         return width * 3;
         return width * 3;
 
 
     case GL_RGBA:
     case GL_RGBA:
+    case GL_LUMINANCE32F_ARB:
     case GL_DEPTH24_STENCIL8_EXT:
     case GL_DEPTH24_STENCIL8_EXT:
         return width * 4;
         return width * 4;
 
 
@@ -270,6 +271,8 @@ unsigned Texture::GetExternalFormat(unsigned format)
         return GL_DEPTH_COMPONENT;
         return GL_DEPTH_COMPONENT;
     else if (format == GL_DEPTH24_STENCIL8_EXT)
     else if (format == GL_DEPTH24_STENCIL8_EXT)
         return GL_DEPTH_STENCIL_EXT;
         return GL_DEPTH_STENCIL_EXT;
+    else if (format == GL_LUMINANCE32F_ARB)
+        return GL_LUMINANCE;
     else
     else
         return format;
         return format;
 }
 }

+ 5 - 0
Engine/Graphics/Renderer.cpp

@@ -187,8 +187,13 @@ static const String shadowVariations[] =
 
 
 static const String linearVariations[] =
 static const String linearVariations[] =
 {
 {
+    // On OpenGL there is no specific linear depth variation, as it is always used
     "",
     "",
+    #ifdef USE_OPENGL
+    ""
+    #else
     "Linear"
     "Linear"
+    #endif
 };
 };
 
 
 static const String fallbackVariations[] =
 static const String fallbackVariations[] =

+ 36 - 0
Engine/Graphics/View.cpp

@@ -1074,7 +1074,12 @@ void View::RenderBatchesLightPrepass()
     // Clear destination render target with fog color
     // Clear destination render target with fog color
     graphics_->SetScissorTest(false);
     graphics_->SetScissorTest(false);
     graphics_->SetStencilTest(false);
     graphics_->SetStencilTest(false);
+    #ifndef USE_OPENGL
     graphics_->SetRenderTarget(0, renderTarget_);
     graphics_->SetRenderTarget(0, renderTarget_);
+    #else
+    // On OpenGL render the final image to the normal buffer first, as FBO and backbuffer rendering can not be mixed
+    graphics_->SetRenderTarget(0, normalBuffer);
+    #endif
     graphics_->SetDepthStencil(depthStencil);
     graphics_->SetDepthStencil(depthStencil);
     graphics_->SetViewport(screenRect_);
     graphics_->SetViewport(screenRect_);
     graphics_->Clear(CLEAR_COLOR, farClipZone_->GetFogColor());
     graphics_->Clear(CLEAR_COLOR, farClipZone_->GetFogColor());
@@ -1112,6 +1117,35 @@ void View::RenderBatchesLightPrepass()
         
         
         RenderBatchQueue(postAlphaQueue_);
         RenderBatchQueue(postAlphaQueue_);
     }
     }
+    
+    // Blit the final image to destination render target on OpenGL
+    /// \todo Depth is reset to far plane, so geometry drawn after the view (for example debug geometry) can not be depth tested
+    #ifdef USE_OPENGL
+    graphics_->SetAlphaTest(false);
+    graphics_->SetBlendMode(BLEND_REPLACE);
+    graphics_->SetColorWrite(true);
+    graphics_->SetDepthTest(CMP_ALWAYS);
+    graphics_->SetDepthWrite(true);
+    graphics_->SetScissorTest(false);
+    graphics_->SetStencilTest(false);
+    graphics_->SetRenderTarget(0, renderTarget_);
+    graphics_->SetDepthStencil(depthStencil_);
+    graphics_->SetViewport(screenRect_);
+    
+    graphics_->SetShaders(renderer_->GetVertexShader("CopyFramebuffer"), renderer_->GetPixelShader("CopyFramebuffer"));
+    
+    float gBufferWidth = (float)graphics_->GetWidth();
+    float gBufferHeight = (float)graphics_->GetHeight();
+    float widthRange = 0.5f * (screenRect_.right_ - screenRect_.left_) / gBufferWidth;
+    float heightRange = 0.5f * (screenRect_.bottom_ - screenRect_.top_) / gBufferHeight;
+    
+    Vector4 bufferUVOffset(((float)screenRect_.left_) / gBufferWidth + widthRange,
+        ((float)screenRect_.top_) / gBufferHeight + heightRange, widthRange, heightRange);
+    
+    graphics_->SetShaderParameter(VSP_GBUFFEROFFSETS, bufferUVOffset);
+    graphics_->SetTexture(TU_DIFFUSE, normalBuffer);
+    DrawFullscreenQuad(camera_, false);
+    #endif
 }
 }
 
 
 void View::UpdateOccluders(PODVector<Drawable*>& occluders, Camera* camera)
 void View::UpdateOccluders(PODVector<Drawable*>& occluders, Camera* camera)
@@ -1409,8 +1443,10 @@ IntRect View::GetShadowMapViewport(Light* light, unsigned splitIndex, Texture2D*
     unsigned height = shadowMap->GetHeight();
     unsigned height = shadowMap->GetHeight();
     int maxCascades = renderer_->GetMaxShadowCascades();
     int maxCascades = renderer_->GetMaxShadowCascades();
     // Due to instruction count limits, light prepass in SM2.0 can only support up to 3 cascades
     // Due to instruction count limits, light prepass in SM2.0 can only support up to 3 cascades
+    #ifndef USE_OPENGL
     if (renderer_->GetLightPrepass() && !graphics_->GetSM3Support())
     if (renderer_->GetLightPrepass() && !graphics_->GetSM3Support())
         maxCascades = Max(maxCascades, 3);
         maxCascades = Max(maxCascades, 3);
+    #endif
     
     
     switch (light->GetLightType())
     switch (light->GetLightType())
     {
     {

+ 4 - 0
SourceAssets/GLSLShaders/CMakeLists.txt

@@ -2,8 +2,12 @@ set (ALL_SHADERS)
 
 
 add_shader (Ambient)
 add_shader (Ambient)
 add_shader (Basic)
 add_shader (Basic)
+add_shader (CopyFramebuffer)
 add_shader (ForwardLit)
 add_shader (ForwardLit)
+add_shader (GBuffer)
+add_shader (LightVolume)
 add_shader (LitParticle)
 add_shader (LitParticle)
+add_shader (Material)
 add_shader (Shadow)
 add_shader (Shadow)
 add_shader (Stencil)
 add_shader (Stencil)
 add_shader (Unlit)
 add_shader (Unlit)

+ 10 - 0
SourceAssets/GLSLShaders/CopyFramebuffer.frag

@@ -0,0 +1,10 @@
+#include "Uniforms.frag"
+#include "Samplers.frag"
+
+varying vec2 vScreenPos;
+
+void main()
+{
+    gl_FragColor = texture2D(sDiffMap, vScreenPos);
+}
+

+ 13 - 0
SourceAssets/GLSLShaders/CopyFramebuffer.vert

@@ -0,0 +1,13 @@
+#include "Uniforms.vert"
+#include "Transform.vert"
+#include "ScreenPos.vert"
+
+varying vec2 vScreenPos;
+
+void main()
+{
+    mat4 modelMatrix = iModelMatrix;
+    vec3 worldPos = GetWorldPos(modelMatrix);
+    gl_Position = GetClipPos(worldPos);
+    vScreenPos = GetScreenPosPreDiv(gl_Position);
+}

+ 4 - 0
SourceAssets/GLSLShaders/CopyFramebuffer.xml

@@ -0,0 +1,4 @@
+<shaders>
+    <shader name="CopyFramebuffer" type="vs" />
+    <shader name="CopyFramebuffer" type="ps" />
+</shaders>

+ 35 - 0
SourceAssets/GLSLShaders/GBuffer.frag

@@ -0,0 +1,35 @@
+#include "Uniforms.frag"
+#include "Samplers.frag"
+
+varying vec3 vTexCoord;
+varying vec3 vNormal;
+#ifdef NORMALMAP
+    varying vec3 vTangent;
+    varying vec3 vBitangent;
+#endif
+
+void main()
+{
+    #ifdef ALPHAMASK
+        vec4 diffInput = texture2D(sDiffMap, vTexCoord.xy);
+        if (diffInput.a < 0.5)
+            discard;
+    #endif
+
+    #ifdef NORMALMAP
+        mat3 tbn = mat3(vTangent, vBitangent, vNormal);
+        vec3 normal = normalize(tbn * DecodeNormal(texture2D(sNormalMap, vTexCoord.xy)));
+    #else
+        vec3 normal = normalize(vNormal);
+    #endif
+
+    #ifdef SPECMAP
+        float specStrength = texture2D(sSpecMap, vTexCoord.xy).g * cMatSpecProperties.x;
+    #else
+        float specStrength = cMatSpecProperties.x;
+    #endif
+    float specPower = cMatSpecProperties.y / 255.0;
+
+    gl_FragData[0] = vec4(normal * 0.5 + 0.5, specPower);
+    gl_FragData[1] = vec4(vTexCoord.z);
+}

+ 23 - 0
SourceAssets/GLSLShaders/GBuffer.vert

@@ -0,0 +1,23 @@
+#include "Uniforms.vert"
+#include "Transform.vert"
+
+varying vec3 vTexCoord;
+varying vec3 vNormal;
+#ifdef NORMALMAP
+    varying vec3 vTangent;
+    varying vec3 vBitangent;
+#endif
+
+void main()
+{
+    mat4 modelMatrix = iModelMatrix;
+    vec3 worldPos = GetWorldPos(modelMatrix);
+    gl_Position = GetClipPos(worldPos);
+    vTexCoord = vec3(GetTexCoord(iTexCoord), GetDepth(gl_Position));
+
+    vNormal = GetWorldNormal(modelMatrix);
+    #ifdef NORMALMAP
+        vTangent = GetWorldTangent(modelMatrix);
+        vBitangent = cross(vTangent, vNormal) * iTangent.w;
+    #endif
+}

+ 13 - 0
SourceAssets/GLSLShaders/GBuffer.xml

@@ -0,0 +1,13 @@
+<shaders>
+    <shader name="GBuffer" type="vs">
+        <option name="Normal" define="NORMALMAP" />
+        <variation name="" />
+        <variation name="Skinned" define="SKINNED" />
+        <variation name="Instanced" define="INSTANCED" />
+    </shader>
+    <shader name="GBuffer" type="ps">
+        <option name="Normal" define="NORMALMAP" />
+        <option name="Spec" define="SPECMAP" />
+        <option name="Mask" define="ALPHAMASK" />
+    </shader>
+</shaders>

+ 87 - 0
SourceAssets/GLSLShaders/LightVolume.frag

@@ -0,0 +1,87 @@
+#include "Uniforms.frag"
+#include "Samplers.frag"
+#include "Lighting.frag"
+
+#ifdef DIRLIGHT
+    varying vec2 vScreenPos;
+#else
+    varying vec4 vScreenPos;
+#endif
+varying vec3 vFarRay;
+#ifdef ORTHO
+    varying vec3 vNearRay;
+#endif
+
+void main()
+{
+    // If rendering a directional light quad, optimize out the w divide
+    #ifdef DIRLIGHT
+        float depth = texture2D(sDepthBuffer, vScreenPos).r;
+        #ifdef ORTHO
+            vec3 worldPos = mix(vNearRay, vFarRay, depth);
+        #else
+            vec3 worldPos = vFarRay * depth;
+        #endif
+        vec4 normalInput = texture2D(sNormalBuffer, vScreenPos);
+    #else
+        float depth = texture2DProj(sDepthBuffer, vScreenPos).r;
+        #ifdef ORTHO
+            vec3 worldPos = mix(vNearRay, vFarRay, depth) / vScreenPos.w;
+        #else
+            vec3 worldPos = vFarRay * depth / vScreenPos.w;
+        #endif
+        vec4 normalInput = texture2DProj(sNormalBuffer, vScreenPos);
+    #endif
+
+    // With specular, normalization greatly improves stability of reflections,
+    // considering input is only 8 bits per axis
+    #ifdef SPECULAR
+        vec3 normal = normalize(normalInput.rgb * 2.0 - 1.0);
+    #else
+        vec3 normal = normalInput.rgb * 2.0 - 1.0;
+    #endif
+
+    vec4 projWorldPos = vec4(worldPos, 1.0);
+    vec3 lightColor;
+    vec3 lightDir;
+    float diff;
+
+    // Accumulate light at half intensity to allow 2x "overburn"
+    #ifdef DIRLIGHT
+        lightDir = cLightDirPS;
+        diff = 0.5 * GetDiffuseDir(normal, lightDir);
+    #else
+        vec3 lightVec = (cLightPosPS.xyz - worldPos) * cLightPosPS.w;
+        diff = 0.5 * GetDiffusePointOrSpot(normal, lightVec, lightDir);
+    #endif
+
+    #ifdef SHADOW
+        #if defined(DIRLIGHT)
+            mat4 shadowMatrix = GetDirShadowMatrix(depth, cLightMatricesPS);
+            vec4 shadowPos = shadowMatrix * projWorldPos;
+            diff *= min(GetShadow(shadowPos) + GetShadowFade(depth), 1.0);
+        #elif defined(SPOTLIGHT)
+            vec4 shadowPos = cLightMatricesPS[1] * projWorldPos;
+            diff *= GetShadow(shadowPos);
+        #else
+            vec3 shadowPos = worldPos - cLightPosPS.xyz;
+            diff *= GetCubeShadow(shadowPos);
+        #endif
+    #endif
+
+    #if defined(SPOTLIGHT)
+        vec4 spotPos = cLightMatricesPS[0] * projWorldPos;
+        lightColor = spotPos.w > 0.0 ? texture2DProj(sLightSpotMap, spotPos).rgb * cLightColor.rgb : vec3(0.0, 0.0, 0.0);
+    #elif defined(CUBEMASK)
+        lightColor = textureCube(sLightCubeMap, lightVec).rgb * cLightColor.rgb;
+    #else
+        lightColor = cLightColor.rgb;
+    #endif
+
+    #ifdef SPECULAR
+        float spec = lightColor.g * GetSpecular(normal, -worldPos, lightDir, normalInput.a * 255.0);
+        gl_FragColor = diff * vec4(lightColor, spec * cLightColor.a);
+    #else
+        gl_FragColor = diff * vec4(lightColor, 0.0);
+    #endif
+}

+ 33 - 0
SourceAssets/GLSLShaders/LightVolume.vert

@@ -0,0 +1,33 @@
+#include "Uniforms.vert"
+#include "Transform.vert"
+#include "ScreenPos.vert"
+
+#ifdef DIRLIGHT
+    varying vec2 vScreenPos;
+#else
+    varying vec4 vScreenPos;
+#endif
+varying vec3 vFarRay;
+#ifdef ORTHO
+    varying vec3 vNearRay;
+#endif
+
+void main()
+{
+    mat4 modelMatrix = iModelMatrix;
+    vec3 worldPos = GetWorldPos(modelMatrix);
+    gl_Position = GetClipPos(worldPos);
+    #ifdef DIRLIGHT
+        vScreenPos = GetScreenPosPreDiv(gl_Position);
+        vFarRay = GetFarRay(gl_Position);
+        #ifdef ORTHO
+            vNearRay = GetNearRay(gl_Position);
+        #endif
+    #else
+        vScreenPos = GetScreenPos(gl_Position);
+        vFarRay = GetFarRay(gl_Position) * gl_Position.w;
+        #ifdef ORTHO
+            vNearRay = GetNearRay(gl_Position) * gl_Position.w;
+        #endif
+    #endif
+}

+ 16 - 0
SourceAssets/GLSLShaders/LightVolume.xml

@@ -0,0 +1,16 @@
+<shaders>
+    <shader name="LightVolume" type="vs">
+        <option name="Ortho" define="ORTHO" />
+        <option name="Dir" define="DIRLIGHT" />
+    </shader>
+    <shader name="LightVolume" type="ps">
+        <option name="Ortho" define="ORTHO" />
+        <variation name="Dir" define="DIRLIGHT" />
+        <variation name="Spot" define="SPOTLIGHT" />
+        <variation name="Point" define="POINTLIGHT" />
+        <option name="Mask" define="CUBEMASK" require="POINTLIGHT" />
+        <option name="Spec" define="SPECULAR" />
+        <option name="Shadow" define="SHADOW" />
+        <option name="LQ" define="LQSHADOW" />
+    </shader>
+</shaders>

+ 17 - 0
SourceAssets/GLSLShaders/Lighting.frag

@@ -87,3 +87,20 @@ vec4 GetDirShadowPos(const vec4 shadowPos[4], float depth)
     else
     else
         return shadowPos[3];
         return shadowPos[3];
 }
 }
+
+mat4 GetDirShadowMatrix(float depth, const mat4 matrices[4])
+{
+    if (depth < cShadowSplits.x)
+        return matrices[0];
+    else if (depth < cShadowSplits.y)
+        return matrices[1];
+    else if (depth < cShadowSplits.z)
+        return matrices[2];
+    else
+        return matrices[3];
+}
+
+float GetIntensity(vec3 color)
+{
+    return dot(color, vec3(0.333, 0.333, 0.333));
+}

+ 38 - 0
SourceAssets/GLSLShaders/Material.frag

@@ -0,0 +1,38 @@
+#include "Uniforms.frag"
+#include "Samplers.frag"
+#include "Lighting.frag"
+#include "Fog.frag"
+
+varying vec3 vTexCoord;
+#ifdef VERTEXCOLOR
+    varying vec4 vColor;
+#endif
+varying vec3 vVertexLighting;
+varying vec4 vScreenPos;
+
+void main()
+{
+    #ifdef DIFFMAP
+        vec4 diffInput = texture2D(sDiffMap, vTexCoord.xy);
+        #ifdef ALPHAMASK
+            if (diffInput.a < 0.5)
+                discard;
+        #endif
+        vec3 diffColor = cMatDiffColor.rgb * diffInput.rgb;
+    #else
+        vec3 diffColor = cMatDiffColor.rgb;
+    #endif
+
+    #ifdef SPECMAP
+        float specIntensity = cMatSpecProperties.x * texture2D(sSpecMap, vTexCoord.xy).g;
+    #else
+        float specIntensity = cMatSpecProperties.x;
+    #endif
+
+    // Lights are accumulated at half intensity. Bring back to full intensity now
+    vec4 lightInput = 2.0 * texture2DProj(sLightBuffer, vScreenPos);
+    vec3 lightSpecColor = lightInput.a * (lightInput.rgb / GetIntensity(lightInput.rgb));
+
+    vec3 finalColor = (vVertexLighting + lightInput.rgb) * diffColor + lightSpecColor * specIntensity;
+    gl_FragColor = vec4(GetFog(finalColor, vTexCoord.z), 1.0);
+}

+ 31 - 0
SourceAssets/GLSLShaders/Material.vert

@@ -0,0 +1,31 @@
+#include "Uniforms.vert"
+#include "Transform.vert"
+#include "ScreenPos.vert"
+#include "Lighting.vert"
+
+varying vec3 vTexCoord;
+#ifdef VERTEXCOLOR
+    varying vec4 vColor;
+#endif
+varying vec3 vVertexLighting;
+varying vec4 vScreenPos;
+
+void main()
+{
+    mat4 modelMatrix = iModelMatrix;
+    vec3 worldPos = GetWorldPos(modelMatrix);
+    gl_Position = GetClipPos(worldPos);
+    vTexCoord = vec3(GetTexCoord(iTexCoord), GetDepth(gl_Position));
+    vScreenPos = GetScreenPos(gl_Position);
+
+    vVertexLighting = GetAmbient(GetZonePos(worldPos));
+    #ifdef NUMVERTEXLIGHTS
+    vec3 normal = GetWorldNormal(modelMatrix);
+    for (int i = 0; i < NUMVERTEXLIGHTS; ++i)
+        vVertexLighting += GetVertexLight(i, worldPos, normal) * cVertexLights[i * 3].rgb;
+    #endif
+
+    #ifdef VERTEXCOLOR
+        vColor = iColor;
+    #endif
+}

+ 20 - 0
SourceAssets/GLSLShaders/Material.xml

@@ -0,0 +1,20 @@
+<shaders>
+    <shader name="Material" type="vs">
+        <variation name="" />
+        <variation name="1VL" define="NUMVERTEXLIGHTS=1" />
+        <variation name="2VL" define="NUMVERTEXLIGHTS=2" />
+        <variation name="3VL" define="NUMVERTEXLIGHTS=3" />
+        <variation name="4VL" define="NUMVERTEXLIGHTS=4" />
+        <variation name="5VL" define="NUMVERTEXLIGHTS=5" />
+        <variation name="6VL" define="NUMVERTEXLIGHTS=6" />
+        <option name="" /> <!-- Dummy option to separate the two variation groups -->
+        <variation name="" />
+        <variation name="Skinned" define="SKINNED" />
+        <variation name="Instanced" define="INSTANCED" />
+    </shader>
+    <shader name="Material" type="ps">
+        <option name="Diff" define="DIFFMAP" />
+        <option name="SpecMap" define="SPECMAP" />
+        <option name="Mask" define="ALPHAMASK" include="Diff" />
+    </shader>
+</shaders>

+ 3 - 0
SourceAssets/GLSLShaders/Samplers.frag

@@ -12,6 +12,9 @@ uniform sampler2D sLightSpotMap;
 uniform samplerCube sLightCubeMap;
 uniform samplerCube sLightCubeMap;
 uniform samplerCube sFaceSelectCubeMap;
 uniform samplerCube sFaceSelectCubeMap;
 uniform samplerCube sIndirectionCubeMap;
 uniform samplerCube sIndirectionCubeMap;
+uniform sampler2D sNormalBuffer;
+uniform sampler2D sDepthBuffer;
+uniform sampler2D sLightBuffer;
 
 
 vec3 DecodeNormal(vec4 normalInput)
 vec3 DecodeNormal(vec4 normalInput)
 {
 {

+ 5 - 4
SourceAssets/GLSLShaders/ScreenPos.vert

@@ -2,7 +2,7 @@ vec4 GetScreenPos(vec4 clipPos)
 {
 {
     return vec4(
     return vec4(
         clipPos.x * cGBufferOffsets.z + cGBufferOffsets.x * clipPos.w,
         clipPos.x * cGBufferOffsets.z + cGBufferOffsets.x * clipPos.w,
-        -clipPos.y * cGBufferOffsets.w + cGBufferOffsets.y * clipPos.w,
+        clipPos.y * cGBufferOffsets.w + cGBufferOffsets.y * clipPos.w,
         0.0,
         0.0,
         clipPos.w);
         clipPos.w);
 }
 }
@@ -11,7 +11,7 @@ vec2 GetScreenPosPreDiv(vec4 clipPos)
 {
 {
     return vec2(
     return vec2(
         clipPos.x / clipPos.w * cGBufferOffsets.z + cGBufferOffsets.x,
         clipPos.x / clipPos.w * cGBufferOffsets.z + cGBufferOffsets.x,
-        -clipPos.y / clipPos.w * cGBufferOffsets.w + cGBufferOffsets.y);
+        clipPos.y / clipPos.w * cGBufferOffsets.w + cGBufferOffsets.y);
 }
 }
 
 
 vec3 GetFarRay(vec4 clipPos)
 vec3 GetFarRay(vec4 clipPos)
@@ -30,6 +30,7 @@ vec3 GetNearRay(vec4 clipPos)
         clipPos.x / clipPos.w * cFrustumSize.x,
         clipPos.x / clipPos.w * cFrustumSize.x,
         clipPos.y / clipPos.w * cFrustumSize.y,
         clipPos.y / clipPos.w * cFrustumSize.y,
         0.0);
         0.0);
-
-    return (cCameraRot, viewRay) * cDepthMode.z;
+    
+    return (cCameraRot * viewRay) * cDepthMode.x;
 }
 }
+

+ 2 - 0
SourceAssets/GLSLShaders/Uniforms.vert

@@ -3,6 +3,8 @@ uniform vec3 cAmbientEndColor;
 uniform vec3 cCameraPos;
 uniform vec3 cCameraPos;
 uniform mat3 cCameraRot;
 uniform mat3 cCameraRot;
 uniform vec4 cDepthMode;
 uniform vec4 cDepthMode;
+uniform vec3 cFrustumSize;
+uniform vec4 cGBufferOffsets;
 uniform vec3 cLightDir;
 uniform vec3 cLightDir;
 uniform vec4 cLightPos;
 uniform vec4 cLightPos;
 uniform mat4 cModel;
 uniform mat4 cModel;

+ 0 - 1
SourceAssets/HLSLShaders/GBuffer.hlsl

@@ -1,7 +1,6 @@
 #include "Uniforms.hlsl"
 #include "Uniforms.hlsl"
 #include "Samplers.hlsl"
 #include "Samplers.hlsl"
 #include "Transform.hlsl"
 #include "Transform.hlsl"
-#include "Fog.hlsl"
 
 
 void VS(float4 iPos : POSITION,
 void VS(float4 iPos : POSITION,
     float3 iNormal : NORMAL,
     float3 iNormal : NORMAL,

+ 4 - 6
SourceAssets/HLSLShaders/LightVolume.hlsl

@@ -111,15 +111,13 @@ void PS(
         #endif
         #endif
     #endif
     #endif
 
 
-    #ifdef SPOTLIGHT
+    #if defined(SPOTLIGHT)
         float4 spotPos = mul(projWorldPos, cLightMatricesPS[0]);
         float4 spotPos = mul(projWorldPos, cLightMatricesPS[0]);
         lightColor = spotPos.w > 0.0 ? tex2Dproj(sLightSpotMap, spotPos).rgb * cLightColor.rgb : 0.0;
         lightColor = spotPos.w > 0.0 ? tex2Dproj(sLightSpotMap, spotPos).rgb * cLightColor.rgb : 0.0;
+    #elif defined(CUBEMASK)
+        lightColor = texCUBE(sLightCubeMap, mul(lightVec, (float3x3)cLightMatricesPS[0])).rgb * cLightColor.rgb;
     #else
     #else
-        #ifdef CUBEMASK
-            lightColor = texCUBE(sLightCubeMap, mul(lightVec, (float3x3)cLightMatricesPS[0])).rgb * cLightColor.rgb;
-        #else
-            lightColor = cLightColor.rgb;
-        #endif
+        lightColor = cLightColor.rgb;
     #endif
     #endif
 
 
     #ifdef SPECULAR
     #ifdef SPECULAR

+ 1 - 1
SourceAssets/HLSLShaders/Material.hlsl

@@ -4,8 +4,8 @@
 #include "Samplers.hlsl"
 #include "Samplers.hlsl"
 #include "Transform.hlsl"
 #include "Transform.hlsl"
 #include "ScreenPos.hlsl"
 #include "ScreenPos.hlsl"
-#include "Fog.hlsl"
 #include "Lighting.hlsl"
 #include "Lighting.hlsl"
+#include "Fog.hlsl"
 
 
 void VS(float4 iPos : POSITION,   
 void VS(float4 iPos : POSITION,   
     #ifdef NUMVERTEXLIGHTS
     #ifdef NUMVERTEXLIGHTS

+ 22 - 38
ThirdParty/GLee/GLee.c

@@ -68,24 +68,13 @@ GLboolean _GLEE_VERSION_1_3 = GL_FALSE;
 GLboolean _GLEE_VERSION_1_4 = GL_FALSE;
 GLboolean _GLEE_VERSION_1_4 = GL_FALSE;
 GLboolean _GLEE_VERSION_1_5 = GL_FALSE;
 GLboolean _GLEE_VERSION_1_5 = GL_FALSE;
 GLboolean _GLEE_VERSION_2_0 = GL_FALSE;
 GLboolean _GLEE_VERSION_2_0 = GL_FALSE;
+GLboolean _GLEE_ARB_texture_float = GL_FALSE;
 GLboolean _GLEE_EXT_framebuffer_object = GL_FALSE;
 GLboolean _GLEE_EXT_framebuffer_object = GL_FALSE;
 GLboolean _GLEE_EXT_packed_depth_stencil = GL_FALSE;
 GLboolean _GLEE_EXT_packed_depth_stencil = GL_FALSE;
+GLboolean _GLEE_EXT_texture_compression_s3tc = GL_FALSE;
+GLboolean _GLEE_EXT_texture_filter_anisotropic = GL_FALSE;
 
 
 
 
-/*  GL Extension names */
-
-char __GLeeGLExtensionNames[8][28]={
-    "GL_VERSION_1_2",
-    "GL_ARB_imaging",
-    "GL_VERSION_1_3",
-    "GL_VERSION_1_4",
-    "GL_VERSION_1_5",
-    "GL_VERSION_2_0",
-    "GL_EXT_framebuffer_object",
-    "GL_EXT_packed_depth_stencil",
-};
-int __GLeeGLNumExtensions=7;
-
 /* GL_VERSION_1_2 */
 /* GL_VERSION_1_2 */
 
 
 #ifdef __GLEE_GL_VERSION_1_2
 #ifdef __GLEE_GL_VERSION_1_2
@@ -1482,21 +1471,13 @@ GLuint __GLeeLink_GL_EXT_framebuffer_object(void)
     return GLEE_LINK_PARTIAL;
     return GLEE_LINK_PARTIAL;
 }
 }
 
 
+GLuint __GLeeLink_GL_ARB_texture_float(void) {return GLEE_LINK_COMPLETE;}
+
 GLuint __GLeeLink_GL_EXT_packed_depth_stencil(void) {return GLEE_LINK_COMPLETE;}
 GLuint __GLeeLink_GL_EXT_packed_depth_stencil(void) {return GLEE_LINK_COMPLETE;}
 
 
-GLEE_LINK_FUNCTION __GLeeGLLoadFunction[8];
+GLuint __GLeeLink_GL_EXT_texture_compression_s3tc(void) {return GLEE_LINK_COMPLETE;}
 
 
-void initGLLoadFunctions(void)
-{
-    __GLeeGLLoadFunction[0]=__GLeeLink_GL_VERSION_1_2;
-    __GLeeGLLoadFunction[1]=__GLeeLink_GL_ARB_imaging;
-    __GLeeGLLoadFunction[2]=__GLeeLink_GL_VERSION_1_3;
-    __GLeeGLLoadFunction[3]=__GLeeLink_GL_VERSION_1_4;
-    __GLeeGLLoadFunction[4]=__GLeeLink_GL_VERSION_1_5;
-    __GLeeGLLoadFunction[5]=__GLeeLink_GL_VERSION_2_0;
-    __GLeeGLLoadFunction[6]=__GLeeLink_GL_EXT_framebuffer_object;
-    __GLeeGLLoadFunction[7]=__GLeeLink_GL_EXT_packed_depth_stencil;
-}
+GLuint __GLeeLink_GL_EXT_texture_filter_anisotropic(void) {return GLEE_LINK_COMPLETE;}
 
 
 
 
 /*****************************************************************
 /*****************************************************************
@@ -1629,18 +1610,6 @@ GLboolean __GLeeCheckExtension(const char * name, ExtensionList *extensionNames)
 	return GL_FALSE;
 	return GL_FALSE;
 }
 }
 
 
-GLEE_EXTERN GLint __GLeeGetExtensionNumber(const char *extensionName, int type)
-{
-	int a;
-	switch (type)
-	{
-	case 0:
-		for (a=0;a<__GLeeGLNumExtensions;a++)
-			if (strcmp(extensionName,__GLeeGLExtensionNames[a])==0)	return a;
-		return -1;
-	}
-	return -1;
-}
 
 
 /*****************************************************************
 /*****************************************************************
  * GLee external functions 
  * GLee external functions 
@@ -1725,6 +1694,11 @@ GLEE_EXTERN GLboolean GLeeInit( void )
         _GLEE_VERSION_2_0 = GL_TRUE;
         _GLEE_VERSION_2_0 = GL_TRUE;
         __GLeeLink_GL_VERSION_2_0();
         __GLeeLink_GL_VERSION_2_0();
     }
     }
+    if (__GLeeCheckExtension("GL_ARB_texture_float", &extensionNames) )
+    {
+        _GLEE_ARB_texture_float = GL_TRUE;
+        __GLeeLink_GL_ARB_texture_float();
+    }
     if (__GLeeCheckExtension("GL_EXT_framebuffer_object", &extensionNames) )
     if (__GLeeCheckExtension("GL_EXT_framebuffer_object", &extensionNames) )
     {
     {
         _GLEE_EXT_framebuffer_object = GL_TRUE;
         _GLEE_EXT_framebuffer_object = GL_TRUE;
@@ -1735,6 +1709,16 @@ GLEE_EXTERN GLboolean GLeeInit( void )
         _GLEE_EXT_packed_depth_stencil = GL_TRUE;
         _GLEE_EXT_packed_depth_stencil = GL_TRUE;
         __GLeeLink_GL_EXT_packed_depth_stencil();
         __GLeeLink_GL_EXT_packed_depth_stencil();
     }
     }
+    if (__GLeeCheckExtension("GL_EXT_texture_compression_s3tc", &extensionNames) )
+    {
+        _GLEE_EXT_texture_compression_s3tc = GL_TRUE;
+        __GLeeLink_GL_EXT_texture_compression_s3tc();
+    }
+    if (__GLeeCheckExtension("GL_EXT_texture_filter_anisotropic", &extensionNames) )
+    {
+        _GLEE_EXT_texture_filter_anisotropic = GL_TRUE;
+        __GLeeLink_GL_EXT_texture_filter_anisotropic();
+    }
     
     
     __GLeeExtList_clean(&extensionNames);
     __GLeeExtList_clean(&extensionNames);
     return GL_TRUE;
     return GL_TRUE;

+ 48 - 0
ThirdParty/GLee/GLee.h

@@ -76,8 +76,11 @@ GLEE_EXTERN GLboolean _GLEE_VERSION_1_3;
 GLEE_EXTERN GLboolean _GLEE_VERSION_1_4;
 GLEE_EXTERN GLboolean _GLEE_VERSION_1_4;
 GLEE_EXTERN GLboolean _GLEE_VERSION_1_5;
 GLEE_EXTERN GLboolean _GLEE_VERSION_1_5;
 GLEE_EXTERN GLboolean _GLEE_VERSION_2_0;
 GLEE_EXTERN GLboolean _GLEE_VERSION_2_0;
+GLEE_EXTERN GLboolean _GLEE_ARB_texture_float;
 GLEE_EXTERN GLboolean _GLEE_EXT_framebuffer_object;
 GLEE_EXTERN GLboolean _GLEE_EXT_framebuffer_object;
 GLEE_EXTERN GLboolean _GLEE_EXT_packed_depth_stencil;
 GLEE_EXTERN GLboolean _GLEE_EXT_packed_depth_stencil;
+GLEE_EXTERN GLboolean _GLEE_EXT_texture_compression_s3tc;
+GLEE_EXTERN GLboolean _GLEE_EXT_texture_filter_anisotropic;
 
 
 /* Aliases for extension querying variables */
 /* Aliases for extension querying variables */
 
 
@@ -87,8 +90,12 @@ GLEE_EXTERN GLboolean _GLEE_EXT_packed_depth_stencil;
 #define GLEE_VERSION_1_4     GLeeEnabled(&_GLEE_VERSION_1_4)
 #define GLEE_VERSION_1_4     GLeeEnabled(&_GLEE_VERSION_1_4)
 #define GLEE_VERSION_1_5     GLeeEnabled(&_GLEE_VERSION_1_5)
 #define GLEE_VERSION_1_5     GLeeEnabled(&_GLEE_VERSION_1_5)
 #define GLEE_VERSION_2_0     GLeeEnabled(&_GLEE_VERSION_2_0)
 #define GLEE_VERSION_2_0     GLeeEnabled(&_GLEE_VERSION_2_0)
+#define GLEE_ARB_texture_float     GLeeEnabled(&_GLEE_ARB_texture_float)
 #define GLEE_EXT_framebuffer_object     GLeeEnabled(&_GLEE_EXT_framebuffer_object)
 #define GLEE_EXT_framebuffer_object     GLeeEnabled(&_GLEE_EXT_framebuffer_object)
 #define GLEE_EXT_packed_depth_stencil     GLeeEnabled(&_GLEE_EXT_packed_depth_stencil)
 #define GLEE_EXT_packed_depth_stencil     GLeeEnabled(&_GLEE_EXT_packed_depth_stencil)
+#define GLEE_EXT_texture_compression_s3tc     GLeeEnabled(&_GLEE_EXT_texture_compression_s3tc)
+#define GLEE_EXT_texture_filter_anisotropic     GLeeEnabled(&_GLEE_EXT_texture_filter_anisotropic)
+
 
 
 /*****************************************************************
 /*****************************************************************
  * Additional types needed for extensions
  * Additional types needed for extensions
@@ -2160,13 +2167,54 @@ GLEE_EXTERN GLboolean _GLEE_EXT_packed_depth_stencil;
 #define GL_TEXTURE_STENCIL_SIZE_EXT                        0x88F1
 #define GL_TEXTURE_STENCIL_SIZE_EXT                        0x88F1
 #endif
 #endif
 
 
+/* GL_EXT_texture_compression_s3tc */
+
+#ifndef GL_EXT_texture_compression_s3tc
+#define GL_EXT_texture_compression_s3tc 1
+#define __GLEE_GL_EXT_texture_compression_s3tc 1
+/* Constants */
 #define GL_COMPRESSED_RGB_S3TC_DXT1_EXT                    0x83F0
 #define GL_COMPRESSED_RGB_S3TC_DXT1_EXT                    0x83F0
 #define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT                   0x83F1
 #define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT                   0x83F1
 #define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT                   0x83F2
 #define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT                   0x83F2
 #define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT                   0x83F3
 #define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT                   0x83F3
+#endif
+
+/* GL_EXT_texture_filter_anisotropic */
+
+#ifndef GL_EXT_texture_filter_anisotropic
+#define GL_EXT_texture_filter_anisotropic 1
+#define __GLEE_GL_EXT_texture_filter_anisotropic 1
+/* Constants */
 #define GL_TEXTURE_MAX_ANISOTROPY_EXT                      0x84FE
 #define GL_TEXTURE_MAX_ANISOTROPY_EXT                      0x84FE
 #define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT                  0x84FF
 #define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT                  0x84FF
+#endif
+
+/* GL_ARB_texture_float */
 
 
+#ifndef GL_ARB_texture_float
+#define GL_ARB_texture_float 1
+#define __GLEE_GL_ARB_texture_float 1
+/* Constants */
+#define GL_TEXTURE_RED_TYPE_ARB                            0x8C10
+#define GL_TEXTURE_GREEN_TYPE_ARB                          0x8C11
+#define GL_TEXTURE_BLUE_TYPE_ARB                           0x8C12
+#define GL_TEXTURE_ALPHA_TYPE_ARB                          0x8C13
+#define GL_TEXTURE_LUMINANCE_TYPE_ARB                      0x8C14
+#define GL_TEXTURE_INTENSITY_TYPE_ARB                      0x8C15
+#define GL_TEXTURE_DEPTH_TYPE_ARB                          0x8C16
+#define GL_UNSIGNED_NORMALIZED_ARB                         0x8C17
+#define GL_RGBA32F_ARB                                     0x8814
+#define GL_RGB32F_ARB                                      0x8815
+#define GL_ALPHA32F_ARB                                    0x8816
+#define GL_INTENSITY32F_ARB                                0x8817
+#define GL_LUMINANCE32F_ARB                                0x8818
+#define GL_LUMINANCE_ALPHA32F_ARB                          0x8819
+#define GL_RGBA16F_ARB                                     0x881A
+#define GL_RGB16F_ARB                                      0x881B
+#define GL_ALPHA16F_ARB                                    0x881C
+#define GL_INTENSITY16F_ARB                                0x881D
+#define GL_LUMINANCE16F_ARB                                0x881E
+#endif
 
 
 /*****************************************************************
 /*****************************************************************
  * GLee functions
  * GLee functions