X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftexunit.cpp;h=0659d6154e80523ffaa0baf75f6bf00ff96a05f2;hb=47bfbdc8cf844aa079995fca34a3b906b49a4f66;hp=9277c27704ebd8347c3c6a782fc1b6ff05fc8658;hpb=0f890ce60a560ba2ccc0719229be304bb597d919;p=libs%2Fgl.git diff --git a/source/texunit.cpp b/source/texunit.cpp index 9277c277..0659d615 100644 --- a/source/texunit.cpp +++ b/source/texunit.cpp @@ -1,9 +1,9 @@ #include #include #include -#include #include "gl.h" #include "misc.h" +#include "texture.h" #include "texunit.h" using namespace std; @@ -15,17 +15,21 @@ vector TexUnit::units; TexUnit *TexUnit::cur_unit = 0; TexUnit::TexUnit(): - legacy(false), texture(0), - tex_legacy(false) + sampler(0) { } -bool TexUnit::set_texture(const Texture *tex, bool lgc) +bool TexUnit::set_texture(const Texture *tex) { - lgc = (lgc && legacy && tex); - bool result = (tex!=texture || lgc!=tex_legacy); + bool result = (tex!=texture); texture = tex; - tex_legacy = lgc; + return result; +} + +bool TexUnit::set_sampler(const Sampler *samp) +{ + bool result = (samp!=sampler); + sampler = samp; return result; } @@ -51,19 +55,6 @@ unsigned TexUnit::get_n_units() return count; } -unsigned TexUnit::get_n_legacy_units() -{ - static int count = -1; - if(count<0) - { - if(MSP_legacy_features) - count = get_i(GL_MAX_TEXTURE_UNITS); - else - count = 0; - } - return count; -} - TexUnit &TexUnit::get_unit(unsigned n) { if(n>0) @@ -74,13 +65,9 @@ TexUnit &TexUnit::get_unit(unsigned n) if(units.size()<=n) { unsigned i = units.size(); - unsigned n_legacy = get_n_legacy_units(); units.resize(n+1, TexUnit()); for(; i