#include "programdata.h"
#include "renderable.h"
#include "renderer.h"
+#include "sampler.h"
#include "texture.h"
#include "texturing.h"
#include "texunit.h"
changed |= MATRIX;
}
-void Renderer::set_texture(const Texture *t)
+void Renderer::set_texture(const Texture *t, const Sampler *s)
{
state->texture = t;
+ state->sampler = s;
state->texturing = 0;
}
{
state->texturing = t;
state->texture = 0;
+ state->sampler = 0;
}
unsigned Renderer::allocate_effect_texunit()
{
Texturing::unbind();
if(state->texture)
+ {
+ if(state->sampler)
+ state->sampler->bind_to(0);
+ else
+ Sampler::unbind_from(0);
state->texture->bind_to(0);
+ }
else
Texture::unbind_from(0);
}
class Lighting;
class Program;
class Renderable;
+class Sampler;
class Texture;
class Texturing;
class VertexSetup;
const Camera *camera;
Matrix modelview_matrix;
const Texture *texture;
+ const Sampler *sampler;
const Texturing *texturing;
unsigned lowest_effect_texunit;
const Material *material;
/** Returns the current modelview matrix. */
const Matrix &get_matrix() const { return state->modelview_matrix; }
- void set_texture(const Texture *);
+ void set_texture(const Texture *, const Sampler * = 0);
void set_texturing(const Texturing *);
unsigned allocate_effect_texunit();
void set_material(const Material *);