]> git.tdb.fi Git - libs/gl.git/blobdiff - source/resources.cpp
Implement 2D array textures
[libs/gl.git] / source / resources.cpp
index 2fd6950370df6580fe08cdf54139bef9b6d50316..32709e30e2ebf521bd6bcf69eeb262069f517e4f 100644 (file)
@@ -1,4 +1,5 @@
 #include <msp/fs/utils.h>
+#include <msp/gl/extensions/sgis_generate_mipmap.h>
 #include "animation.h"
 #include "armature.h"
 #include "font.h"
@@ -11,7 +12,9 @@
 #include "resourcemanager.h"
 #include "resources.h"
 #include "technique.h"
+#include "texture1d.h"
 #include "texture2d.h"
+#include "texture2darray.h"
 #include "texturecube.h"
 
 using namespace std;
@@ -20,7 +23,7 @@ namespace Msp {
 namespace GL {
 
 Resources::Resources():
-       default_tex_filter(LINEAR_MIPMAP_LINEAR),
+       default_tex_filter(SGIS_generate_mipmap ? LINEAR_MIPMAP_LINEAR : LINEAR),
        srgb_conversion(false),
        resource_manager(0)
 {
@@ -34,8 +37,11 @@ Resources::Resources():
        add_type<Pose>().keyword("pose");
        add_type<Program>().keyword("shader");
        add_type<Technique>().suffix(".tech").keyword("technique");
+       add_type<Texture1D>().base<Texture>().suffix(".tex1d").keyword("texture1d");
        add_type<Texture2D>().base<Texture>().suffix(".tex2d").suffix(".png").suffix(".jpg").keyword("texture2d").creator(&Resources::create_texture2d);
+       add_type<Texture3D>().base<Texture>().suffix(".tex3d").keyword("texture3d");
        add_type<TextureCube>().base<Texture>().suffix(".texcb").keyword("texture_cube");
+       add_type<Texture2DArray>().base<Texture>().suffix(".tex2da").keyword("texture2d_array");
 }
 
 void Resources::set_default_texture_filter(TextureFilter tf)
@@ -92,7 +98,6 @@ Texture2D *Resources::create_texture2d(const string &name)
                        tex->set_mag_filter(default_tex_filter);
                tex->set_min_filter(default_tex_filter);
 
-               // TODO Somehow pass the srgb flag if a resource manager is in use
                if(resource_manager)
                        resource_manager->set_resource_location(*tex, *this, name);
                else