]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/textures.cpp
Implement buffer operations
[xonotic/netradiant.git] / radiant / textures.cpp
index 93ce42a8cdbec549f21f9b64926896c5f357d650..d5b82429543fa28faeef19cbeccf4784105bb5bc 100644 (file)
@@ -19,6 +19,7 @@
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <util/buffer.h>
 #include "textures.h"
 
 #include "debugging/debugging.h"
@@ -137,12 +138,13 @@ ETexturesMode g_texture_mode = eTextures_LINEAR_MIPMAP_LINEAR;
 
 
 
-byte g_gammatable[256];
+u::BufferVal<256> g_gammatable;
 void ResampleGamma( float fGamma ){
        int i,inf;
-       if ( fGamma == 1.0 ) {
+       auto buf = g_gammatable.mut();
+       if (fGamma == 1.0 ) {
                for ( i = 0; i < 256; i++ )
-                       g_gammatable[i] = i;
+                       buf[i] = i;
        }
        else
        {
@@ -155,7 +157,7 @@ void ResampleGamma( float fGamma ){
                        if ( inf > 255 ) {
                                inf = 255;
                        }
-                       g_gammatable[i] = inf;
+                       buf[i] = inf;
                }
        }
 }
@@ -274,7 +276,7 @@ void Texture_InitPalette( byte *pal ){
        int r,g,b;
        int i;
        int inf;
-       byte gammatable[256];
+       auto gammatable = u::buffer<256>();
        float gamma;
 
        gamma = g_texture_globals.fGamma;