From Gino, "According to the 1.4.1 COLLADA spec (2nd ed) the standard behavior for fx_sampler_wrap_common is as follows

CLAMP ->GL_CLAMP_TO_EDGE
NONE->GL_CLAMP_TO_BORDER

The current 2.5.0 daePlugin assumes the following binding

CLAMP ->GL_CLAMP
NONE->GL_REPEAT

Notably the GL_CLAMP binding will result in visible black seams on input files that use otherwise matching textures. Replacing GL_CLAMP by GL_CLAMP_TO_EDGE solves this problem. I've updated both the read and write functions.
"
This commit is contained in:
Robert Osfield
2008-05-26 21:32:05 +00:00
parent ee6f055bc5
commit 8f6ca1dc6c
2 changed files with 7 additions and 7 deletions

View File

@@ -672,7 +672,6 @@ osg::StateAttribute *daeReader::processTexture( domCommon_color_or_texture_type_
osg::Texture::WrapMode wrap;
switch( sampler->getWrap_s()->getValue() )
{
case FX_SAMPLER_WRAP_COMMON_NONE:
case FX_SAMPLER_WRAP_COMMON_WRAP:
wrap = osg::Texture::REPEAT;
break;
@@ -680,8 +679,9 @@ osg::StateAttribute *daeReader::processTexture( domCommon_color_or_texture_type_
wrap = osg::Texture::MIRROR;
break;
case FX_SAMPLER_WRAP_COMMON_CLAMP:
wrap = osg::Texture::CLAMP;
wrap = osg::Texture::CLAMP_TO_EDGE;
break;
case FX_SAMPLER_WRAP_COMMON_NONE:
case FX_SAMPLER_WRAP_COMMON_BORDER:
wrap = osg::Texture::CLAMP_TO_BORDER;
break;
@@ -700,7 +700,6 @@ osg::StateAttribute *daeReader::processTexture( domCommon_color_or_texture_type_
osg::Texture::WrapMode wrap;
switch( sampler->getWrap_t()->getValue() )
{
case FX_SAMPLER_WRAP_COMMON_NONE:
case FX_SAMPLER_WRAP_COMMON_WRAP:
wrap = osg::Texture::REPEAT;
break;
@@ -708,12 +707,13 @@ osg::StateAttribute *daeReader::processTexture( domCommon_color_or_texture_type_
wrap = osg::Texture::MIRROR;
break;
case FX_SAMPLER_WRAP_COMMON_CLAMP:
wrap = osg::Texture::CLAMP;
wrap = osg::Texture::CLAMP_TO_EDGE;
break;
case FX_SAMPLER_WRAP_COMMON_NONE:
case FX_SAMPLER_WRAP_COMMON_BORDER:
wrap = osg::Texture::CLAMP_TO_BORDER;
break;
default:
default:
wrap = osg::Texture::CLAMP;
break;
}

View File

@@ -126,10 +126,10 @@ void daeWriter::processMaterial( osg::StateSet *ss, domInstance_geometry *ig, co
switch( wrap )
{
case osg::Texture::CLAMP:
case osg::Texture::CLAMP_TO_EDGE:
wrap_s->setValue( FX_SAMPLER_WRAP_COMMON_CLAMP );
break;
case osg::Texture::CLAMP_TO_BORDER:
case osg::Texture::CLAMP_TO_EDGE:
wrap_s->setValue( FX_SAMPLER_WRAP_COMMON_BORDER );
break;
case osg::Texture::REPEAT:
@@ -148,10 +148,10 @@ void daeWriter::processMaterial( osg::StateSet *ss, domInstance_geometry *ig, co
switch( wrap )
{
case osg::Texture::CLAMP:
case osg::Texture::CLAMP_TO_EDGE:
wrap_t->setValue( FX_SAMPLER_WRAP_COMMON_CLAMP );
break;
case osg::Texture::CLAMP_TO_BORDER:
case osg::Texture::CLAMP_TO_EDGE:
wrap_t->setValue( FX_SAMPLER_WRAP_COMMON_BORDER );
break;
case osg::Texture::REPEAT: