From Trajce Nikolov, "small fix for the flt loader - the back color of the bidirectional light points"

This commit is contained in:
Robert Osfield 2006-02-21 12:39:47 +00:00
parent 7d5c81bf5e
commit 4a0a0a30ea
3 changed files with 15 additions and 3 deletions

View File

@ -80,6 +80,7 @@ void LightPointRecord::endian()
ENDIAN( pSLightPoint->sfSignificance );
ENDIAN( pSLightPoint->sfDrawOrder );
ENDIAN( pSLightPoint->sfFlags );
ENDIAN( pSLightPoint->dwBackColor );
pSLightPoint->animRot.endian();
}

View File

@ -17,7 +17,7 @@ struct SLightPoint
char szIdent[8]; // 7 char ASCII ID; 0 terminates
int16 iMaterial; // Surface material code (for DFAD)
int16 iFeature; // Feature ID (for DFAD)
color32 dwBackColor; // Back color for all bidirectional points
int32 dwBackColor; // Back color for all bidirectional points
int32 diMode; // Display mode
// 0 = RASTER
// 1 = CALLIGRAPHIC
@ -134,7 +134,7 @@ struct SLightPointIndex
int32 iAppearanceIndex; // Index into lt pt appearance palette
int32 iAnimationIndex; // Index into lt pt animation palette
int32 iDrawOrder; // Calligraphic draw order
int32 iReserved_0; // Reserved
int32 iReserved_0; // Reserved
};
class LightPointIndexRecord : public PrimNodeRecord

View File

@ -184,6 +184,7 @@ osg::Group* ConvertFromFLT::visitAncillary(osg::Group& osgParent, osg::Group& os
// ancillary records. We need just one of these to put into the scenegraph
// Nick.
bool mxFound = false;
static int numVerts = 0;
osg::Group* parent = &osgParent;
// Visit ancillary records
@ -255,18 +256,22 @@ osg::Group* ConvertFromFLT::visitAncillary(osg::Group& osgParent, osg::Group& os
case VERTEX_C_OP:
visitVertex(osgPrimary, (VertexRecord*)child);
numVerts++;
break;
case VERTEX_CN_OP:
visitNormalVertex(osgPrimary, (NormalVertexRecord*)child);
numVerts++;
break;
case VERTEX_CNT_OP:
visitNormalTextureVertex(osgPrimary, (NormalTextureVertexRecord*)child);
numVerts++;
break;
case VERTEX_CT_OP:
visitTextureVertex(osgPrimary, (TextureVertexRecord*)child);
numVerts++;
break;
default:
@ -2879,7 +2884,13 @@ void ConvertFromFLT::visitLightPoint(osg::Group& osgParent, LightPointRecord* re
{
DPRINT(stderr, " ** LP is BIdirectional...\n") ;
osg::Vec4 backcolor = pSLightPoint->dwBackColor.get() ;
// pSLightPoint->dwBackColor is not a color, it is handle
// Get the color from the ColorPool
// Nick
// osg::Vec4 backcolor = pSLightPoint->dwBackColor.get() ;
ColorPool* pColorPool = rec->getFltFile()->getColorPool();
osg::Vec4 backcolor = pColorPool->getColor(pSLightPoint->dwBackColor);
if ( backcolor.w() == 0.0 ) backcolor[3] = 1.0 ;
osgSim::LightPoint lp2( true, coords[ nl], backcolor, 1.0f, pointRadius);
DPRINT(stderr, " Backface Color = %f, %f, %f, %f\n", backcolor.x(), backcolor.y(), backcolor.z(), backcolor.w()) ;