From Andreas Goebel, (submitted by Paul Martz) "A fix for the FLT exporter. This change adds support for normals with OVERALL binding (and improves support for normals with PER_PRIMITIVE binding -- still not correct, but at least it doesn't index off the end of the array anymore)."
This commit is contained in:
@@ -279,33 +279,47 @@ VertexPaletteManager::writeRecords( const osg::Vec3dArray* v, const osg::Vec4Arr
|
||||
_vertices->writeInt16( flags ); // Flags
|
||||
_vertices->writeVec3d( (*v)[ idx ] ); // Vertex
|
||||
|
||||
// Now write record-specific field.
|
||||
// Now write record-specific fields.
|
||||
switch( recType )
|
||||
{
|
||||
case VERTEX_C:
|
||||
{
|
||||
_vertices->writeInt32( packedColor ); // Packed color
|
||||
_vertices->writeUInt32( 0 ); // Vertex color index
|
||||
break;
|
||||
}
|
||||
case VERTEX_CN:
|
||||
_vertices->writeVec3f( (*n)[ idx ] ); // Normal
|
||||
{
|
||||
if (!normalPerVertex) // Normal
|
||||
_vertices->writeVec3f( (*n)[ 0 ] );
|
||||
else
|
||||
_vertices->writeVec3f( (*n)[ idx ] );
|
||||
_vertices->writeInt32( packedColor ); // Packed color
|
||||
_vertices->writeUInt32( 0 ); // Vertex color index
|
||||
if (_fltOpt.getFlightFileVersionNumber() > ExportOptions::VERSION_15_7)
|
||||
_vertices->writeUInt32( 0 ); // Reserved
|
||||
break;
|
||||
}
|
||||
case VERTEX_CNT:
|
||||
_vertices->writeVec3f( (*n)[ idx ] ); // Normal
|
||||
{
|
||||
if (!normalPerVertex) // Normal
|
||||
_vertices->writeVec3f( (*n)[ 0 ] );
|
||||
else
|
||||
_vertices->writeVec3f( (*n)[ idx ] );
|
||||
_vertices->writeVec2f( (*t)[ idx ] ); // Tex coord
|
||||
_vertices->writeInt32( packedColor ); // Packed color
|
||||
_vertices->writeUInt32( 0 ); // Vertex color index
|
||||
_vertices->writeUInt32( 0 ); // Reserved
|
||||
break;
|
||||
}
|
||||
case VERTEX_CT:
|
||||
{
|
||||
_vertices->writeVec2f( (*t)[ idx ] ); // Tex coord
|
||||
_vertices->writeInt32( packedColor ); // Packed color
|
||||
_vertices->writeUInt32( 0 ); // Vertex color index
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user