From Daniel Sjölie, support for reading comment records into description fields.
This commit is contained in:
@@ -20,8 +20,8 @@ namespace flt {
|
||||
|
||||
struct SComment
|
||||
{
|
||||
SRecHeader RecHeader;
|
||||
// TODO
|
||||
SRecHeader RecHeader;
|
||||
char szComment[1]; // (Length - 4) ASCII ID of node
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
#include "Input.h"
|
||||
#include "GeoSetBuilder.h"
|
||||
#include "LongIDRecord.h"
|
||||
#include "CommentRecord.h"
|
||||
#include "InstanceRecords.h"
|
||||
#include "LocalVertexPoolRecord.h"
|
||||
#include "MultiTextureRecord.h"
|
||||
@@ -163,7 +164,7 @@ osg::Group* ConvertFromFLT::visitAncillary(osg::Group& osgParent, osg::Group& os
|
||||
break;
|
||||
|
||||
case COMMENT_OP:
|
||||
// visitComment(osgPrimary, (CommentRecord*)child);
|
||||
visitComment(osgPrimary, (CommentRecord*)child);
|
||||
break;
|
||||
|
||||
case COLOR_PALETTE_OP:
|
||||
@@ -333,6 +334,30 @@ void ConvertFromFLT::visitLongID(osg::Group& osgParent, LongIDRecord* rec)
|
||||
}
|
||||
|
||||
|
||||
void ConvertFromFLT::visitComment(osg::Group& osgParent, CommentRecord* rec)
|
||||
{
|
||||
SComment *pSComment = (SComment*)rec->getData();
|
||||
|
||||
//std::cout << "ConvertFromFLT::visitComment '"<<std::string(pSComment->szComment,pSComment->RecHeader.length()-4)<<"'"<<std::endl;
|
||||
//std::cout << "ConvertFromFLT::visitComment cstyle string '"<<pSComment->szComment<<"'"<<std::endl;
|
||||
|
||||
char* commentline = pSComment->szComment;
|
||||
char* eol;
|
||||
int lineno = 1;
|
||||
// add all lines followed by \n
|
||||
while ( commentline && (eol = strchr( commentline, '\n' ) ) ) {
|
||||
*eol = '\0';
|
||||
osgParent.addDescription( commentline );
|
||||
//std::cerr << "Line " << lineno << ": " << commentline << "\n";
|
||||
++lineno;
|
||||
commentline = ++eol;
|
||||
}
|
||||
// add the last line
|
||||
osgParent.addDescription( commentline );
|
||||
//std::cerr << "Line " << lineno << ": " << commentline << "\n";
|
||||
}
|
||||
|
||||
|
||||
osg::Group* ConvertFromFLT::visitHeader(HeaderRecord* rec)
|
||||
{
|
||||
SHeader *pSHeader = (SHeader*)rec->getData();
|
||||
|
||||
@@ -50,6 +50,7 @@ class LightPointRecord;
|
||||
class VertexListRecord;
|
||||
class LocalVertexPoolRecord;
|
||||
class LongIDRecord;
|
||||
class CommentRecord;
|
||||
class InstanceDefinitionRecord;
|
||||
class InstanceReferenceRecord;
|
||||
class MultiTextureRecord;
|
||||
@@ -119,6 +120,7 @@ class ConvertFromFLT
|
||||
// Ancillary records
|
||||
osg::Group* visitMatrix(osg::Group& osgParent, const osg::Group& osgPrimary, MatrixRecord* rec);
|
||||
void visitLongID(osg::Group& osgParent, LongIDRecord* rec);
|
||||
void visitComment(osg::Group& osgParent, CommentRecord* rec);
|
||||
|
||||
// Palette records
|
||||
void visitColorPalette(osg::Group& osgParent, ColorPaletteRecord* rec);
|
||||
|
||||
Reference in New Issue
Block a user