소스 검색

Added Graphics::GetFloatFormat().

Lasse Öörni 14 년 전
부모
커밋
a3c6e580c3

+ 1 - 0
Docs/ScriptAPI.dox

@@ -62,6 +62,7 @@
 - uint GetLuminanceAlphaFormat()
 - uint GetRGBFormat()
 - uint GetRGBAFormat()
+- uint GetFloatFormat()
 - uint GetDepthStencilFormat()
 - void DelayedExecute(float, const String&, const Variant[]@)
 - void DelayedExecute(float, const String&)

+ 1 - 0
Engine/Engine/GraphicsAPI.cpp

@@ -258,6 +258,7 @@ static void RegisterTextures(asIScriptEngine* engine)
     engine->RegisterGlobalFunction("uint GetLuminanceAlphaFormat()", asFUNCTION(Graphics::GetLuminanceAlphaFormat), asCALL_CDECL);
     engine->RegisterGlobalFunction("uint GetRGBFormat()", asFUNCTION(Graphics::GetRGBFormat), asCALL_CDECL);
     engine->RegisterGlobalFunction("uint GetRGBAFormat()", asFUNCTION(Graphics::GetRGBAFormat), asCALL_CDECL);
+    engine->RegisterGlobalFunction("uint GetFloatFormat()", asFUNCTION(Graphics::GetFloatFormat), asCALL_CDECL);
     engine->RegisterGlobalFunction("uint GetDepthStencilFormat()", asFUNCTION(Graphics::GetDepthStencilFormat), asCALL_CDECL);
 }
 

+ 5 - 0
Engine/Graphics/Direct3D9/D3D9Graphics.cpp

@@ -1878,6 +1878,11 @@ unsigned Graphics::GetRGBAFormat()
     return D3DFMT_A8R8G8B8;
 }
 
+unsigned Graphics::GetFloatFormat()
+{
+    return D3DFMT_R32F;
+}
+
 unsigned Graphics::GetLinearDepthFormat()
 {
     return D3DFMT_R32F;

+ 2 - 0
Engine/Graphics/Direct3D9/D3D9Graphics.h

@@ -319,6 +319,8 @@ public:
     static unsigned GetRGBFormat();
     /// Return the API-specific RGBA texture format.
     static unsigned GetRGBAFormat();
+    /// Return the API-specific single channel float texture format.
+    static unsigned GetFloatFormat();
     /// Return the API-specific linear depth texture format.
     static unsigned GetLinearDepthFormat();
     /// Return the API-specific readable hardware depth-stencil texture format.

+ 5 - 0
Engine/Graphics/OpenGL/OGLGraphics.cpp

@@ -1820,6 +1820,11 @@ unsigned Graphics::GetRGBAFormat()
     return GL_RGBA;
 }
 
+unsigned Graphics::GetFloatFormat()
+{
+    return GL_LUMINANCE32F_ARB;
+}
+
 unsigned Graphics::GetLinearDepthFormat()
 {
     // OpenGL FBO specs state that color attachments must have the same format; therefore must encode linear depth to RGBA

+ 2 - 0
Engine/Graphics/OpenGL/OGLGraphics.h

@@ -345,6 +345,8 @@ public:
     static unsigned GetRGBFormat();
     /// Return the API-specific RGBA texture format.
     static unsigned GetRGBAFormat();
+    /// Return the API-specific single channel float texture format.
+    static unsigned GetFloatFormat();
     /// Return the API-specific linear depth texture format.
     static unsigned GetLinearDepthFormat();
     /// Return the API-specific readable hardware depth-stencil texture format.