From Paul Martz and David Glenn,

"From David Glenn and Paul Martz. This change adds support for the NO_COLOR bit in the Vertex records' flags field. If NO_COLOR is set, and PACKED_COLOR is not set, the code will now properly default to using the face color at those vertices. See the osg-users thread "Open Flight characteristic not reflected in the current OSG" for more info."

and

"In consultation with David Glenn, it appears we needed to change a second file to correct how OpenFlight handles transparency when vertices have NO_COLOR. "
This commit is contained in:
Robert Osfield
2011-12-23 17:40:31 +00:00
parent a53308f7e8
commit 3aab31f198
2 changed files with 28 additions and 5 deletions

View File

@@ -254,7 +254,10 @@ public:
{
// Use face color if vertex color is -1 in a gouraud polygon.
// http://www.multigen-paradigm.com/ubb/Forum1/HTML/000967.html
colors->push_back(_primaryColor);
// Incorporate Face transparency per osg-users thread "Open Flight
// characteristic not reflected in the current OSG" (Sept/Oct 2011)
colors->push_back(osg::Vec4(_primaryColor.r(), _primaryColor.g(),
_primaryColor.b(), ( 1.0 - getTransparency() ) ));
}
}

View File

@@ -68,8 +68,13 @@ class VertexC : public Record
// color
if (flags & PACKED_COLOR)
vertex.setColor(packedColor); // Packed color
else if (colorIndex >= 0)
else if( ( (flags & NO_COLOR) == 0 ) &&
( colorIndex >= 0 ) )
{
// Only use the color index if the NO_COLOR bit is _not_ set
// and the index isn't negative.
vertex.setColor(getColorFromPool(colorIndex, document.getColorPool())); // Color from pool
}
if (_parent.valid())
_parent->addVertex(vertex);
@@ -108,8 +113,13 @@ class VertexCN : public Record
// color
if (flags & PACKED_COLOR)
vertex.setColor(packedColor); // Packed color
else if (colorIndex >= 0)
else if( ( (flags & NO_COLOR) == 0 ) &&
( colorIndex >= 0 ) )
{
// Only use the color index if the NO_COLOR bit is _not_ set
// and the index isn't negative.
vertex.setColor(getColorFromPool(colorIndex, document.getColorPool())); // Color from pool
}
if (_parent.valid())
_parent->addVertex(vertex);
@@ -148,8 +158,13 @@ class VertexCT : public Record
// color
if (flags & PACKED_COLOR)
vertex.setColor(packedColor); // Packed color
else if (colorIndex >= 0)
else if( ( (flags & NO_COLOR) == 0 ) &&
( colorIndex >= 0 ) )
{
// Only use the color index if the NO_COLOR bit is _not_ set
// and the index isn't negative.
vertex.setColor(getColorFromPool(colorIndex, document.getColorPool())); // Color from pool
}
if (_parent.valid())
_parent->addVertex(vertex);
@@ -206,8 +221,13 @@ class VertexCNT : public Record
// color
if (flags & PACKED_COLOR)
vertex.setColor(packedColor); // Packed color
else if (colorIndex >= 0)
else if( ( (flags & NO_COLOR) == 0 ) &&
( colorIndex >= 0 ) )
{
// Only use the color index if the NO_COLOR bit is _not_ set
// and the index isn't negative.
vertex.setColor(getColorFromPool(colorIndex, document.getColorPool())); // Color from pool
}
if (_parent.valid())
_parent->addVertex(vertex);