diff --git a/VisualStudio/osgPlugins/flt/flt.dsp b/VisualStudio/osgPlugins/flt/flt.dsp index 856e4ad5b..65dda7961 100644 --- a/VisualStudio/osgPlugins/flt/flt.dsp +++ b/VisualStudio/osgPlugins/flt/flt.dsp @@ -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 diff --git a/src/osgPlugins/flt/BSPRecord.cpp b/src/osgPlugins/flt/BSPRecord.cpp new file mode 100644 index 000000000..efc82884c --- /dev/null +++ b/src/osgPlugins/flt/BSPRecord.cpp @@ -0,0 +1,39 @@ +// BSPRecord.cpp +// +// Author: Michael M. Morrison +// + +#include "flt.h" +#include "Registry.h" +#include "BSPRecord.h" + +using namespace flt; + +//////////////////////////////////////////////////////////////////// +// +// BSPRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy 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 ); +} diff --git a/src/osgPlugins/flt/BSPRecord.h b/src/osgPlugins/flt/BSPRecord.h new file mode 100644 index 000000000..97d9d053d --- /dev/null +++ b/src/osgPlugins/flt/BSPRecord.h @@ -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 + diff --git a/src/osgPlugins/flt/GNUmakefile b/src/osgPlugins/flt/GNUmakefile index 2e5a756f5..e1e2938da 100644 --- a/src/osgPlugins/flt/GNUmakefile +++ b/src/osgPlugins/flt/GNUmakefile @@ -45,6 +45,7 @@ CXXFILES =\ ReaderWriterATTR.cpp\ MultiTextureRecord.cpp\ UVListRecord.cpp\ + BSPRecord.cpp\ # PointLight.cpp\ diff --git a/src/osgPlugins/flt/flt2osg.cpp b/src/osgPlugins/flt/flt2osg.cpp index fa277f2bb..11a41069e 100644 --- a/src/osgPlugins/flt/flt2osg.cpp +++ b/src/osgPlugins/flt/flt2osg.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(); diff --git a/src/osgPlugins/flt/flt2osg.h b/src/osgPlugins/flt/flt2osg.h index 09530527e..6d86aee78 100644 --- a/src/osgPlugins/flt/flt2osg.h +++ b/src/osgPlugins/flt/flt2osg.h @@ -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); diff --git a/src/osgPlugins/flt/opcodes.h b/src/osgPlugins/flt/opcodes.h index 60f3e1277..fa6bdc515 100644 --- a/src/osgPlugins/flt/opcodes.h +++ b/src/osgPlugins/flt/opcodes.h @@ -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