From Michael Morrison, added support for the OpenFlight BSPRecord, simply
mapping it to a Group.
This commit is contained in:
parent
c7b96d18b7
commit
bd686c4598
@ -93,6 +93,10 @@ LINK32=link.exe
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\flt\BSPRecord.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\flt\BoundingVolumeRecords.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -273,6 +277,10 @@ SOURCE=..\..\..\src\osgPlugins\flt\AttrData.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\flt\BSPRecord.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\flt\BoundingVolumeRecords.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
39
src/osgPlugins/flt/BSPRecord.cpp
Normal file
39
src/osgPlugins/flt/BSPRecord.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
// BSPRecord.cpp
|
||||
//
|
||||
// Author: Michael M. Morrison
|
||||
//
|
||||
|
||||
#include "flt.h"
|
||||
#include "Registry.h"
|
||||
#include "BSPRecord.h"
|
||||
|
||||
using namespace flt;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// BSPRecord
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
RegisterRecordProxy<BSPRecord> g_BSPProxy;
|
||||
|
||||
BSPRecord::BSPRecord()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// virtual
|
||||
BSPRecord::~BSPRecord()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void BSPRecord::endian()
|
||||
{
|
||||
SBSP *pSBSP = (SBSP*)getData();
|
||||
|
||||
ENDIAN( pSBSP->planeA );
|
||||
ENDIAN( pSBSP->planeB );
|
||||
ENDIAN( pSBSP->planeC );
|
||||
ENDIAN( pSBSP->planeD );
|
||||
}
|
54
src/osgPlugins/flt/BSPRecord.h
Normal file
54
src/osgPlugins/flt/BSPRecord.h
Normal file
@ -0,0 +1,54 @@
|
||||
//
|
||||
// BSPRecord.h
|
||||
//
|
||||
// Author: Michael M. Morrison
|
||||
//
|
||||
|
||||
#ifndef __FLT_BSP_RECORD_H
|
||||
#define __FLT_BSP_RECORD_H
|
||||
|
||||
|
||||
#include "opcodes.h"
|
||||
#include "Record.h"
|
||||
#include "RecordVisitor.h"
|
||||
|
||||
|
||||
namespace flt {
|
||||
|
||||
struct SBSP
|
||||
{
|
||||
SRecHeader RecHeader;
|
||||
char szIdent[8]; // 7 char ASCII ID; 0 terminates
|
||||
uint32 reserved; // Reserved
|
||||
float64 planeA; // Plane Equation A
|
||||
float64 planeB; // Plane Equation B
|
||||
float64 planeC; // Plane Equation C
|
||||
float64 planeD; // Plane Equation D
|
||||
};
|
||||
|
||||
class BSPRecord : public PrimNodeRecord
|
||||
{
|
||||
public:
|
||||
BSPRecord();
|
||||
|
||||
virtual Record* clone() const { return new BSPRecord(); }
|
||||
virtual const char* className() const { return "BSPRecord"; }
|
||||
virtual int classOpcode() const { return BSP_OP; }
|
||||
virtual size_t sizeofData() const { return sizeof(SBSP); }
|
||||
virtual void accept(RecordVisitor& rv) { rv.apply(*this); }
|
||||
// virtual void traverse(RecordVisitor& rv);
|
||||
|
||||
SBSP* getData() const { return (SBSP*)_pData; }
|
||||
|
||||
protected:
|
||||
virtual ~BSPRecord();
|
||||
|
||||
virtual void endian();
|
||||
};
|
||||
|
||||
|
||||
|
||||
}; // end namespace flt
|
||||
|
||||
#endif
|
||||
|
@ -45,6 +45,7 @@ CXXFILES =\
|
||||
ReaderWriterATTR.cpp\
|
||||
MultiTextureRecord.cpp\
|
||||
UVListRecord.cpp\
|
||||
BSPRecord.cpp\
|
||||
# PointLight.cpp\
|
||||
|
||||
|
||||
|
@ -73,6 +73,7 @@
|
||||
#include "LightSourceRecord.h"
|
||||
#include "LightSourcePaletteRecord.h"
|
||||
#include "AttrData.h"
|
||||
#include "BSPRecord.h"
|
||||
|
||||
|
||||
|
||||
@ -293,6 +294,9 @@ osg::Group* ConvertFromFLT::visitPrimaryNode(osg::Group& osgParent, PrimNodeReco
|
||||
case DOF_OP:
|
||||
osgPrim = visitDOF(osgParent, (DofRecord*)child);
|
||||
break;
|
||||
case BSP_OP:
|
||||
osgPrim = visitBSP(osgParent, (BSPRecord*)child);
|
||||
break;
|
||||
case SWITCH_OP:
|
||||
osgPrim = visitSwitch(osgParent, (SwitchRecord*)child);
|
||||
break;
|
||||
@ -629,6 +633,18 @@ void ConvertFromFLT::visitNormalTextureVertex(osg::Group& , NormalTextureVertexR
|
||||
}
|
||||
|
||||
|
||||
osg::Group* ConvertFromFLT::visitBSP(osg::Group& osgParent, BSPRecord* rec)
|
||||
{
|
||||
// create group node for the time being
|
||||
osg::Group* group = new osg::Group;
|
||||
group->setName(rec->getData()->szIdent);
|
||||
|
||||
visitAncillary(osgParent, *group, rec)->addChild( group );
|
||||
visitPrimaryNode(*group, rec);
|
||||
|
||||
return group;
|
||||
}
|
||||
|
||||
osg::Group* ConvertFromFLT::visitGroup(osg::Group& osgParent, GroupRecord* rec)
|
||||
{
|
||||
|
||||
@ -971,6 +987,7 @@ osg::Group* ConvertFromFLT::visitDOF(osg::Group& osgParent, DofRecord* rec)
|
||||
}
|
||||
|
||||
|
||||
|
||||
osg::Group* ConvertFromFLT::visitSwitch(osg::Group& osgParent, SwitchRecord* rec)
|
||||
{
|
||||
SSwitch *pSSwitch = (SSwitch*)rec->getData();
|
||||
|
@ -57,6 +57,7 @@ class MultiTextureRecord;
|
||||
class UVListRecord;
|
||||
class LightSourceRecord;
|
||||
class LightSourcePaletteRecord;
|
||||
class BSPRecord;
|
||||
struct SFace;
|
||||
|
||||
//class GeoSetBuilder;
|
||||
@ -139,6 +140,7 @@ class ConvertFromFLT
|
||||
// Primary records
|
||||
osg::Group* visitHeader(HeaderRecord* rec);
|
||||
osg::Group* visitGroup(osg::Group& osgParent, GroupRecord* rec);
|
||||
osg::Group* visitBSP(osg::Group& osgParent, BSPRecord* rec);
|
||||
osg::Group* visitLightSource(osg::Group& osgParent, LightSourceRecord* rec);
|
||||
osg::Group* visitRoadConstruction(osg::Group& osgParent, GroupRecord* rec);
|
||||
osg::Group* visitLOD(osg::Group& osgParent, LodRecord* rec);
|
||||
|
@ -34,6 +34,7 @@ Ignore 40-48
|
||||
#define VECTOR_OP 50
|
||||
#define MULTI_TEXTURE_OP 52
|
||||
#define UV_LIST_OP 53
|
||||
#define BSP_OP 55
|
||||
#define REPLICATE_OP 60
|
||||
#define INSTANCE_REFERENCE_OP 61
|
||||
#define INSTANCE_DEFINITION_OP 62
|
||||
|
Loading…
Reference in New Issue
Block a user