Commit f9e8f3d5 authored by Michele Bosi's avatar Michele Bosi

Vivid: added support for 1D, 2D, 3D textures.

parent eaa1a149
......@@ -828,7 +828,15 @@ void VividRenderer::renderQueue(const RenderQueue* render_queue, GLSLProgram* cu
// texture mapping
if( shader->getUniform("vl_Vivid.enableTextureMapping")->getUniformI() == 1 ) {
// enable texture
shader->getTextureSampler( Vivid::UserTexture )->apply( Vivid::UserTexture, NULL, opengl_context );
// set texture dimension
switch( shader->getTextureSampler( Vivid::UserTexture )->texture()->dimension() ) {
case vl::TD_TEXTURE_1D: const_cast<Shader*>(shader)->getUniform("vl_Vivid.textureDimension")->setUniformI( 1 ); break;
case vl::TD_TEXTURE_2D: const_cast<Shader*>(shader)->getUniform("vl_Vivid.textureDimension")->setUniformI( 2 ); break;
case vl::TD_TEXTURE_3D: const_cast<Shader*>(shader)->getUniform("vl_Vivid.textureDimension")->setUniformI( 3 ); break;
}
VL_CHECK_OGL();
} else {
TextureSampler::reset( Vivid::UserTexture, opengl_context );
......
......@@ -138,8 +138,11 @@ ref<Effect> VividRendering::makeVividEffect(Effect* effect) {
texture->getTexParameter()->setMagFilter( vl::TPF_LINEAR );
texture->getTexParameter()->setWrap( vl::TPW_CLAMP_TO_EDGE );
fx->shader()->gocTextureSampler( vl::Vivid::UserTexture )->setTexture( texture.get() );
fx->shader()->gocUniform( "vl_UserTexture" )->setUniformI( vl::Vivid::UserTexture );
fx->shader()->gocUniform( "vl_UserTexture1D" )->setUniformI( vl::Vivid::UserTexture );
fx->shader()->gocUniform( "vl_UserTexture2D" )->setUniformI( vl::Vivid::UserTexture );
fx->shader()->gocUniform( "vl_UserTexture3D" )->setUniformI( vl::Vivid::UserTexture );
fx->shader()->gocUniform( "vl_Vivid.enableTextureMapping" )->setUniformI( 0 );
fx->shader()->gocUniform( "vl_Vivid.textureDimension" )->setUniformI( 0 );
// Used by the fast renderer - ignored by depth peeling
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment