From 07cf3ecd113a49726acdd2b2fbf54afbfaf3744d Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 28 May 2009 13:29:20 +0000 Subject: [PATCH] From Gregory Jaegy and Robert Osfield, added support for static linking of OpenFlight plugin --- .../OpenFlight/AncillaryRecords.cpp | 74 +++++++------ src/osgPlugins/OpenFlight/ControlRecords.cpp | 24 ++-- src/osgPlugins/OpenFlight/GeometryRecords.cpp | 18 ++- .../OpenFlight/LightPointRecords.cpp | 9 +- src/osgPlugins/OpenFlight/PaletteRecords.cpp | 45 +++++--- src/osgPlugins/OpenFlight/PrimaryRecords.cpp | 35 ++++-- src/osgPlugins/OpenFlight/ReaderWriterFLT.cpp | 104 ++++++++++++++++++ src/osgPlugins/OpenFlight/Registry.h | 21 ++++ src/osgPlugins/OpenFlight/ReservedRecords.cpp | 17 +-- src/osgPlugins/OpenFlight/RoadRecords.cpp | 8 +- src/osgPlugins/OpenFlight/VertexRecords.cpp | 21 ++-- 11 files changed, 279 insertions(+), 97 deletions(-) diff --git a/src/osgPlugins/OpenFlight/AncillaryRecords.cpp b/src/osgPlugins/OpenFlight/AncillaryRecords.cpp index b299a1fee..a5e7ffdef 100644 --- a/src/osgPlugins/OpenFlight/AncillaryRecords.cpp +++ b/src/osgPlugins/OpenFlight/AncillaryRecords.cpp @@ -84,7 +84,8 @@ class Comment : public Record } }; -RegisterRecordProxy g_Comment(COMMENT_OP); +REGISTER_FLTRECORD(Comment, COMMENT_OP) + /** LongID - @@ -111,7 +112,8 @@ class LongID : public Record } }; -RegisterRecordProxy g_LongID(LONG_ID_OP); +REGISTER_FLTRECORD(LongID, LONG_ID_OP) + /** Matrix - @@ -150,7 +152,8 @@ class Matrix : public Record } }; -RegisterRecordProxy g_Matrix(MATRIX_OP); +REGISTER_FLTRECORD(Matrix, MATRIX_OP) + /** Multitexture - @@ -228,7 +231,8 @@ class Multitexture : public Record } }; -RegisterRecordProxy g_Multitexture(MULTITEXTURE_OP); +REGISTER_FLTRECORD(Multitexture, MULTITEXTURE_OP) + /** UVList - Texture coordinates used with multitexture. @@ -284,7 +288,7 @@ class UVList : public Record } }; -RegisterRecordProxy g_UVList(UV_LIST_OP); +REGISTER_FLTRECORD(UVList, UV_LIST_OP) /** Replicate - @@ -310,38 +314,38 @@ class Replicate : public Record } }; -RegisterRecordProxy g_Replicate(REPLICATE_OP); - +REGISTER_FLTRECORD(Replicate, REPLICATE_OP) // Prevent "unknown record" message for the following ancillary records: -RegisterRecordProxy g_OldTranslate(OLD_TRANSLATE2_OP); -RegisterRecordProxy g_OldRotateAboutPoint(OLD_ROTATE_ABOUT_POINT_OP); -RegisterRecordProxy g_OldRotateAboutEdge(OLD_ROTATE_ABOUT_EDGE_OP); -RegisterRecordProxy g_OldScale(OLD_SCALE_OP); -RegisterRecordProxy g_OldTranslate2(OLD_TRANSLATE_OP); -RegisterRecordProxy g_OldNonuniformScale(OLD_NONUNIFORM_SCALE_OP); -RegisterRecordProxy g_OldRotateAboutPoint2(OLD_ROTATE_ABOUT_POINT2_OP); -RegisterRecordProxy g_OldRotateScaleToPoint(OLD_ROTATE_SCALE_TO_POINT_OP); -RegisterRecordProxy g_OldPutTransform(OLD_PUT_TRANSFORM_OP); -RegisterRecordProxy g_OldBoundingBox(OLD_BOUNDING_BOX_OP); -RegisterRecordProxy g_IndexedString(INDEXED_STRING_OP); -RegisterRecordProxy g_RoadZone(ROAD_ZONE_OP); -RegisterRecordProxy g_RotateAboutEdge(ROTATE_ABOUT_EDGE_OP); -RegisterRecordProxy g_Translate(TRANSLATE_OP); -RegisterRecordProxy g_Scale(NONUNIFORM_SCALE_OP); -RegisterRecordProxy g_RotateAboutPoint(ROTATE_ABOUT_POINT_OP); -RegisterRecordProxy g_RotateScaleToPoint(ROTATE_SCALE_TO_POINT_OP); -RegisterRecordProxy g_PutTransform(PUT_TRANSFORM_OP); -RegisterRecordProxy g_GeneralMatrix(GENERAL_MATRIX_OP); -RegisterRecordProxy g_Vector(VECTOR_OP); -RegisterRecordProxy g_BoundingBox(BOUNDING_BOX_OP); -RegisterRecordProxy g_BoundingSphere(BOUNDING_SPHERE_OP); -RegisterRecordProxy g_BoundingCylinder(BOUNDING_CYLINDER_OP); -RegisterRecordProxy g_BoundingConvexHull(BOUNDING_CONVEX_HULL_OP); -RegisterRecordProxy g_BoundingHistogram(BOUNDING_HISTOGRAM); -RegisterRecordProxy g_BoundingVolumeCenter(BOUNDING_VOLUME_CENTER_OP); -RegisterRecordProxy g_BoundingVolumeOrientation(BOUNDING_VOLUME_ORIENTATION_OP); -RegisterRecordProxy g_HistogramBoundingVolume(HISTOGRAM_BOUNDING_VOLUME_OP); +REGISTER_FLTRECORD(DummyRecord, OLD_TRANSLATE2_OP) +REGISTER_FLTRECORD(DummyRecord, OLD_ROTATE_ABOUT_POINT_OP) +REGISTER_FLTRECORD(DummyRecord, OLD_ROTATE_ABOUT_EDGE_OP) +REGISTER_FLTRECORD(DummyRecord, OLD_SCALE_OP) +REGISTER_FLTRECORD(DummyRecord, OLD_TRANSLATE_OP) +REGISTER_FLTRECORD(DummyRecord, OLD_NONUNIFORM_SCALE_OP) +REGISTER_FLTRECORD(DummyRecord, OLD_ROTATE_ABOUT_POINT2_OP) +REGISTER_FLTRECORD(DummyRecord, OLD_ROTATE_SCALE_TO_POINT_OP) +REGISTER_FLTRECORD(DummyRecord, OLD_PUT_TRANSFORM_OP) +REGISTER_FLTRECORD(DummyRecord, OLD_BOUNDING_BOX_OP) +REGISTER_FLTRECORD(DummyRecord, INDEXED_STRING_OP) +REGISTER_FLTRECORD(DummyRecord, ROAD_ZONE_OP) +REGISTER_FLTRECORD(DummyRecord, ROTATE_ABOUT_EDGE_OP) +REGISTER_FLTRECORD(DummyRecord, TRANSLATE_OP) +REGISTER_FLTRECORD(DummyRecord, NONUNIFORM_SCALE_OP) +REGISTER_FLTRECORD(DummyRecord, ROTATE_ABOUT_POINT_OP) +REGISTER_FLTRECORD(DummyRecord, ROTATE_SCALE_TO_POINT_OP) +REGISTER_FLTRECORD(DummyRecord, PUT_TRANSFORM_OP) +REGISTER_FLTRECORD(DummyRecord, GENERAL_MATRIX_OP) +REGISTER_FLTRECORD(DummyRecord, VECTOR_OP) +REGISTER_FLTRECORD(DummyRecord, BOUNDING_BOX_OP) +REGISTER_FLTRECORD(DummyRecord, BOUNDING_SPHERE_OP) +REGISTER_FLTRECORD(DummyRecord, BOUNDING_CYLINDER_OP) +REGISTER_FLTRECORD(DummyRecord, BOUNDING_CONVEX_HULL_OP) +REGISTER_FLTRECORD(DummyRecord, BOUNDING_HISTOGRAM) +REGISTER_FLTRECORD(DummyRecord, BOUNDING_VOLUME_CENTER_OP) +REGISTER_FLTRECORD(DummyRecord, BOUNDING_VOLUME_ORIENTATION_OP) +REGISTER_FLTRECORD(DummyRecord, HISTOGRAM_BOUNDING_VOLUME_OP) + } // end namespace diff --git a/src/osgPlugins/OpenFlight/ControlRecords.cpp b/src/osgPlugins/OpenFlight/ControlRecords.cpp index 3eb05b1d6..89d2b4966 100644 --- a/src/osgPlugins/OpenFlight/ControlRecords.cpp +++ b/src/osgPlugins/OpenFlight/ControlRecords.cpp @@ -48,7 +48,8 @@ class PushLevel : public Record virtual ~PushLevel() {} }; -RegisterRecordProxy g_PushLevel(PUSH_LEVEL_OP); +REGISTER_FLTRECORD(PushLevel, PUSH_LEVEL_OP) + /** PophLevel @@ -86,7 +87,8 @@ class PopLevel : public Record virtual ~PopLevel() {} }; -RegisterRecordProxy g_PopLevel(POP_LEVEL_OP); +REGISTER_FLTRECORD(PopLevel, POP_LEVEL_OP) + /** PushSubface @@ -109,7 +111,8 @@ class PushSubface : public Record virtual ~PushSubface() {} }; -RegisterRecordProxy g_PushSubface(PUSH_SUBFACE_OP); +REGISTER_FLTRECORD(PushSubface, PUSH_SUBFACE_OP) + /** PopSubface @@ -132,7 +135,8 @@ class PopSubface : public Record virtual ~PopSubface() {} }; -RegisterRecordProxy g_PopSubface(POP_SUBFACE_OP); +REGISTER_FLTRECORD(PopSubface, POP_SUBFACE_OP) + /** PushExtension @@ -156,7 +160,8 @@ class PushExtension : public Record virtual ~PushExtension() {} }; -RegisterRecordProxy g_PushExtension(PUSH_EXTENSION_OP); +REGISTER_FLTRECORD(PushExtension, PUSH_EXTENSION_OP) + /** PopExtension @@ -180,7 +185,8 @@ class PopExtension : public Record virtual ~PopExtension() {} }; -RegisterRecordProxy g_PopExtension(POP_EXTENSION_OP); +REGISTER_FLTRECORD(PopExtension, POP_EXTENSION_OP) + /** PushAttribute - Reserved subtree @@ -203,7 +209,8 @@ class PushAttribute : public Record virtual ~PushAttribute() {} }; -RegisterRecordProxy g_PushAttribute(PUSH_ATTRIBUTE_OP); +REGISTER_FLTRECORD(PushAttribute, PUSH_ATTRIBUTE_OP) + /** PopAttribute @@ -226,7 +233,8 @@ class PopAttribute : public Record virtual ~PopAttribute() {} }; -RegisterRecordProxy g_PopAttribute(POP_ATTRIBUTE_OP); +REGISTER_FLTRECORD(PopAttribute, POP_ATTRIBUTE_OP) + } // end namespace diff --git a/src/osgPlugins/OpenFlight/GeometryRecords.cpp b/src/osgPlugins/OpenFlight/GeometryRecords.cpp index 7827769dc..fddfd69e1 100644 --- a/src/osgPlugins/OpenFlight/GeometryRecords.cpp +++ b/src/osgPlugins/OpenFlight/GeometryRecords.cpp @@ -536,7 +536,8 @@ protected: } }; -RegisterRecordProxy g_Face(FACE_OP); +REGISTER_FLTRECORD(Face, FACE_OP) + /** VertexList - @@ -592,7 +593,8 @@ protected: }; -RegisterRecordProxy g_VertexList(VERTEX_LIST_OP); +REGISTER_FLTRECORD(VertexListRecord, VERTEX_LIST_OP) + /** MorphVertexList - @@ -681,7 +683,8 @@ protected: } }; -RegisterRecordProxy g_MorphVertexList(MORPH_VERTEX_LIST_OP); +REGISTER_FLTRECORD(MorphVertexList, MORPH_VERTEX_LIST_OP) + /* Mesh record @@ -1016,7 +1019,8 @@ protected: } }; -RegisterRecordProxy g_Mesh(MESH_OP); +REGISTER_FLTRECORD(Mesh, MESH_OP) + @@ -1133,7 +1137,8 @@ protected: } }; -RegisterRecordProxy g_LocalVertexPool(LOCAL_VERTEX_POOL_OP); +REGISTER_FLTRECORD(LocalVertexPool, LOCAL_VERTEX_POOL_OP) + @@ -1271,7 +1276,8 @@ protected: } }; -RegisterRecordProxy g_MeshPrimitive(MESH_PRIMITIVE_OP); +REGISTER_FLTRECORD(MeshPrimitive, MESH_PRIMITIVE_OP) + } // end namespace diff --git a/src/osgPlugins/OpenFlight/LightPointRecords.cpp b/src/osgPlugins/OpenFlight/LightPointRecords.cpp index dc7fc299d..aa03eaf1f 100644 --- a/src/osgPlugins/OpenFlight/LightPointRecords.cpp +++ b/src/osgPlugins/OpenFlight/LightPointRecords.cpp @@ -234,7 +234,8 @@ protected: } }; -RegisterRecordProxy g_LightPoint(LIGHT_POINT_OP); +REGISTER_FLTRECORD(LightPoint, LIGHT_POINT_OP) + /** IndexedLightPoint @@ -416,7 +417,8 @@ protected: } }; -RegisterRecordProxy g_IndexedLightPoint(INDEXED_LIGHT_POINT_OP); +REGISTER_FLTRECORD(IndexedLightPoint, INDEXED_LIGHT_POINT_OP) + /** LightPointSystem @@ -508,5 +510,6 @@ protected: } }; -RegisterRecordProxy g_LightPointSystem(LIGHT_POINT_SYSTEM_OP); +REGISTER_FLTRECORD(LightPointSystem, LIGHT_POINT_SYSTEM_OP) + diff --git a/src/osgPlugins/OpenFlight/PaletteRecords.cpp b/src/osgPlugins/OpenFlight/PaletteRecords.cpp index 1f441a64b..c1f63bd24 100644 --- a/src/osgPlugins/OpenFlight/PaletteRecords.cpp +++ b/src/osgPlugins/OpenFlight/PaletteRecords.cpp @@ -60,7 +60,8 @@ protected: } }; -RegisterRecordProxy g_VertexPalette(VERTEX_PALETTE_OP); +REGISTER_FLTRECORD(VertexPalette, VERTEX_PALETTE_OP) + class ColorPalette : public Record @@ -140,7 +141,8 @@ protected: }; -RegisterRecordProxy g_ColorPalette(COLOR_PALETTE_OP); +REGISTER_FLTRECORD(ColorPalette, COLOR_PALETTE_OP) + class NameTable : public Record @@ -160,7 +162,8 @@ protected: } }; -RegisterRecordProxy g_NameTable(NAME_TABLE_OP); +REGISTER_FLTRECORD(NameTable, NAME_TABLE_OP) + class MaterialPalette : public Record @@ -204,7 +207,8 @@ protected: } }; -RegisterRecordProxy g_MaterialPalette(MATERIAL_PALETTE_OP); +REGISTER_FLTRECORD(MaterialPalette, MATERIAL_PALETTE_OP) + class OldMaterialPalette : public Record @@ -251,7 +255,8 @@ protected: }; -RegisterRecordProxy g_OldMaterialPalette(OLD_MATERIAL_PALETTE_OP); +REGISTER_FLTRECORD(OldMaterialPalette, OLD_MATERIAL_PALETTE_OP) + class TexturePalette : public Record @@ -466,7 +471,8 @@ protected: } }; -RegisterRecordProxy g_TexturePalette(TEXTURE_PALETTE_OP); +REGISTER_FLTRECORD(TexturePalette, TEXTURE_PALETTE_OP) + class EyepointAndTrackplanePalette : public Record @@ -484,7 +490,8 @@ protected: virtual void readRecord(RecordInputStream& /*in*/, Document& /*document*/) {} }; -RegisterRecordProxy g_EyepointAndTrackplanePalette(EYEPOINT_AND_TRACKPLANE_PALETTE_OP); +REGISTER_FLTRECORD(EyepointAndTrackplanePalette, EYEPOINT_AND_TRACKPLANE_PALETTE_OP) + class LinkagePalette : public Record @@ -502,7 +509,8 @@ protected: virtual void readRecord(RecordInputStream& /*in*/, Document& /*document*/) {} }; -RegisterRecordProxy g_LinkagePalette(LINKAGE_PALETTE_OP); +REGISTER_FLTRECORD(LinkagePalette, LINKAGE_PALETTE_OP) + class SoundPalette : public Record @@ -520,7 +528,8 @@ protected: virtual void readRecord(RecordInputStream& /*in*/, Document& /*document*/) {} }; -RegisterRecordProxy g_SoundPalette(SOUND_PALETTE_OP); +REGISTER_FLTRECORD(SoundPalette, SOUND_PALETTE_OP) + class LightSourcePalette : public Record @@ -599,7 +608,8 @@ protected: } }; -RegisterRecordProxy g_LightSourcePalette(LIGHT_SOURCE_PALETTE_OP); +REGISTER_FLTRECORD(LightSourcePalette, LIGHT_SOURCE_PALETTE_OP) + class LightPointAppearancePalette : public Record @@ -681,7 +691,8 @@ protected: }; -RegisterRecordProxy g_LightPointAppearancePalette(LIGHT_POINT_APPEARANCE_PALETTE_OP); +REGISTER_FLTRECORD(LightPointAppearancePalette, LIGHT_POINT_APPEARANCE_PALETTE_OP) + class LightPointAnimationPalette : public Record @@ -739,7 +750,8 @@ protected: } }; -RegisterRecordProxy g_LightPointAnimationPalette(LIGHT_POINT_ANIMATION_PALETTE_OP); +REGISTER_FLTRECORD(LightPointAnimationPalette, LIGHT_POINT_ANIMATION_PALETTE_OP) + class LineStylePalette : public Record @@ -759,7 +771,8 @@ protected: } }; -RegisterRecordProxy g_LineStylePalette(LINE_STYLE_PALETTE_OP); +REGISTER_FLTRECORD(LineStylePalette, LINE_STYLE_PALETTE_OP) + class TextureMappingPalette : public Record @@ -779,7 +792,8 @@ protected: } }; -RegisterRecordProxy g_TextureMappingPalette(TEXTURE_MAPPING_PALETTE_OP); +REGISTER_FLTRECORD(TextureMappingPalette, TEXTURE_MAPPING_PALETTE_OP) + class ShaderPalette : public Record @@ -876,7 +890,8 @@ protected: } }; -RegisterRecordProxy g_ShaderPalette(SHADER_PALETTE_OP); +REGISTER_FLTRECORD(ShaderPalette, SHADER_PALETTE_OP) + } // end namespace diff --git a/src/osgPlugins/OpenFlight/PrimaryRecords.cpp b/src/osgPlugins/OpenFlight/PrimaryRecords.cpp index 6de694041..135f4c512 100644 --- a/src/osgPlugins/OpenFlight/PrimaryRecords.cpp +++ b/src/osgPlugins/OpenFlight/PrimaryRecords.cpp @@ -153,7 +153,7 @@ protected: } }; -RegisterRecordProxy
g_Header(HEADER_OP); +REGISTER_FLTRECORD(Header, HEADER_OP) /** Group @@ -292,7 +292,8 @@ protected: } }; -RegisterRecordProxy g_Group(GROUP_OP); +REGISTER_FLTRECORD(Group, GROUP_OP) + /** DegreeOfFreedom @@ -457,7 +458,8 @@ protected: } }; -RegisterRecordProxy g_DegreeOfFreedom(DOF_OP); +REGISTER_FLTRECORD(DegreeOfFreedom, DOF_OP) + /** LevelOfDetail - To recreate the LevelOfDetail record in OSG we have to create a LOD node with one Group node under it. @@ -513,7 +515,8 @@ protected: }; -RegisterRecordProxy g_LevelOfDetail(LOD_OP); +REGISTER_FLTRECORD(LevelOfDetail, LOD_OP) + /** OldLevelOfDetail @@ -569,7 +572,8 @@ protected: }; -RegisterRecordProxy g_OldLevelOfDetail(OLD_LOD_OP); +REGISTER_FLTRECORD(OldLevelOfDetail, OLD_LOD_OP) + /** Switch @@ -645,7 +649,8 @@ protected: } }; -RegisterRecordProxy g_Switch(SWITCH_OP); +REGISTER_FLTRECORD(Switch, SWITCH_OP) + /** ExternalReference @@ -729,7 +734,8 @@ protected: }; -RegisterRecordProxy g_ExternalReference(EXTERNAL_REFERENCE_OP); +REGISTER_FLTRECORD(ExternalReference, EXTERNAL_REFERENCE_OP) + /** InstanceDefinition @@ -778,7 +784,8 @@ protected: }; -RegisterRecordProxy g_InstanceDefinition(INSTANCE_DEFINITION_OP); +REGISTER_FLTRECORD(InstanceDefinition, INSTANCE_DEFINITION_OP) + /** InstanceReference @@ -809,7 +816,8 @@ protected: } }; -RegisterRecordProxy g_InstanceReference(INSTANCE_REFERENCE_OP); +REGISTER_FLTRECORD(InstanceReference, INSTANCE_REFERENCE_OP) + /** Extension @@ -848,7 +856,8 @@ protected: } }; -RegisterRecordProxy g_Extension(EXTENSION_OP); +REGISTER_FLTRECORD(Extension, EXTENSION_OP) + /** Object @@ -952,7 +961,8 @@ protected: }; -RegisterRecordProxy g_Object(OBJECT_OP); +REGISTER_FLTRECORD(Object, OBJECT_OP) + /** LightSource @@ -1035,7 +1045,8 @@ protected: } }; -RegisterRecordProxy g_LightSource(LIGHT_SOURCE_OP); +REGISTER_FLTRECORD(LightSource, LIGHT_SOURCE_OP) + } // end namespace diff --git a/src/osgPlugins/OpenFlight/ReaderWriterFLT.cpp b/src/osgPlugins/OpenFlight/ReaderWriterFLT.cpp index a794cb8d9..39ac4165f 100644 --- a/src/osgPlugins/OpenFlight/ReaderWriterFLT.cpp +++ b/src/osgPlugins/OpenFlight/ReaderWriterFLT.cpp @@ -40,6 +40,110 @@ using namespace flt; using namespace osg; using namespace osgDB; +// pull in symbols from attr plugin +USE_OSGPLUGIN(attr) + +// pull in symbols from individual .o's to enable the static build to work +// note, following USE_FLTRECORD list was generated by running: +// grep REGISTER_FLTRECORD * -h | grep -v "#define" | sed 's/REGISTER_FLTRECORD/USE_FLTRECORD/g' +USE_FLTRECORD(Comment, COMMENT_OP) +USE_FLTRECORD(LongID, LONG_ID_OP) +USE_FLTRECORD(Matrix, MATRIX_OP) +USE_FLTRECORD(Multitexture, MULTITEXTURE_OP) +USE_FLTRECORD(UVList, UV_LIST_OP) +USE_FLTRECORD(Replicate, REPLICATE_OP) +USE_FLTRECORD(DummyRecord, OLD_TRANSLATE2_OP) +USE_FLTRECORD(DummyRecord, OLD_ROTATE_ABOUT_POINT_OP) +USE_FLTRECORD(DummyRecord, OLD_ROTATE_ABOUT_EDGE_OP) +USE_FLTRECORD(DummyRecord, OLD_SCALE_OP) +USE_FLTRECORD(DummyRecord, OLD_TRANSLATE_OP) +USE_FLTRECORD(DummyRecord, OLD_NONUNIFORM_SCALE_OP) +USE_FLTRECORD(DummyRecord, OLD_ROTATE_ABOUT_POINT2_OP) +USE_FLTRECORD(DummyRecord, OLD_ROTATE_SCALE_TO_POINT_OP) +USE_FLTRECORD(DummyRecord, OLD_PUT_TRANSFORM_OP) +USE_FLTRECORD(DummyRecord, OLD_BOUNDING_BOX_OP) +USE_FLTRECORD(DummyRecord, INDEXED_STRING_OP) +USE_FLTRECORD(DummyRecord, ROAD_ZONE_OP) +USE_FLTRECORD(DummyRecord, ROTATE_ABOUT_EDGE_OP) +USE_FLTRECORD(DummyRecord, TRANSLATE_OP) +USE_FLTRECORD(DummyRecord, NONUNIFORM_SCALE_OP) +USE_FLTRECORD(DummyRecord, ROTATE_ABOUT_POINT_OP) +USE_FLTRECORD(DummyRecord, ROTATE_SCALE_TO_POINT_OP) +USE_FLTRECORD(DummyRecord, PUT_TRANSFORM_OP) +USE_FLTRECORD(DummyRecord, GENERAL_MATRIX_OP) +USE_FLTRECORD(DummyRecord, VECTOR_OP) +USE_FLTRECORD(DummyRecord, BOUNDING_BOX_OP) +USE_FLTRECORD(DummyRecord, BOUNDING_SPHERE_OP) +USE_FLTRECORD(DummyRecord, BOUNDING_CYLINDER_OP) +USE_FLTRECORD(DummyRecord, BOUNDING_CONVEX_HULL_OP) +USE_FLTRECORD(DummyRecord, BOUNDING_HISTOGRAM) +USE_FLTRECORD(DummyRecord, BOUNDING_VOLUME_CENTER_OP) +USE_FLTRECORD(DummyRecord, BOUNDING_VOLUME_ORIENTATION_OP) +USE_FLTRECORD(DummyRecord, HISTOGRAM_BOUNDING_VOLUME_OP) +USE_FLTRECORD(PushLevel, PUSH_LEVEL_OP) +USE_FLTRECORD(PopLevel, POP_LEVEL_OP) +USE_FLTRECORD(PushSubface, PUSH_SUBFACE_OP) +USE_FLTRECORD(PopSubface, POP_SUBFACE_OP) +USE_FLTRECORD(PushExtension, PUSH_EXTENSION_OP) +USE_FLTRECORD(PopExtension, POP_EXTENSION_OP) +USE_FLTRECORD(PushAttribute, PUSH_ATTRIBUTE_OP) +USE_FLTRECORD(PopAttribute, POP_ATTRIBUTE_OP) +USE_FLTRECORD(Face, FACE_OP) +USE_FLTRECORD(VertexListRecord, VERTEX_LIST_OP) +USE_FLTRECORD(MorphVertexList, MORPH_VERTEX_LIST_OP) +USE_FLTRECORD(Mesh, MESH_OP) +USE_FLTRECORD(LocalVertexPool, LOCAL_VERTEX_POOL_OP) +USE_FLTRECORD(MeshPrimitive, MESH_PRIMITIVE_OP) +USE_FLTRECORD(LightPoint, LIGHT_POINT_OP) +USE_FLTRECORD(IndexedLightPoint, INDEXED_LIGHT_POINT_OP) +USE_FLTRECORD(LightPointSystem, LIGHT_POINT_SYSTEM_OP) +USE_FLTRECORD(VertexPalette, VERTEX_PALETTE_OP) +USE_FLTRECORD(ColorPalette, COLOR_PALETTE_OP) +USE_FLTRECORD(NameTable, NAME_TABLE_OP) +USE_FLTRECORD(MaterialPalette, MATERIAL_PALETTE_OP) +USE_FLTRECORD(OldMaterialPalette, OLD_MATERIAL_PALETTE_OP) +USE_FLTRECORD(TexturePalette, TEXTURE_PALETTE_OP) +USE_FLTRECORD(EyepointAndTrackplanePalette, EYEPOINT_AND_TRACKPLANE_PALETTE_OP) +USE_FLTRECORD(LinkagePalette, LINKAGE_PALETTE_OP) +USE_FLTRECORD(SoundPalette, SOUND_PALETTE_OP) +USE_FLTRECORD(LightSourcePalette, LIGHT_SOURCE_PALETTE_OP) +USE_FLTRECORD(LightPointAppearancePalette, LIGHT_POINT_APPEARANCE_PALETTE_OP) +USE_FLTRECORD(LightPointAnimationPalette, LIGHT_POINT_ANIMATION_PALETTE_OP) +USE_FLTRECORD(LineStylePalette, LINE_STYLE_PALETTE_OP) +USE_FLTRECORD(TextureMappingPalette, TEXTURE_MAPPING_PALETTE_OP) +USE_FLTRECORD(ShaderPalette, SHADER_PALETTE_OP) +USE_FLTRECORD(Header, HEADER_OP) +USE_FLTRECORD(Group, GROUP_OP) +USE_FLTRECORD(DegreeOfFreedom, DOF_OP) +USE_FLTRECORD(LevelOfDetail, LOD_OP) +USE_FLTRECORD(OldLevelOfDetail, OLD_LOD_OP) +USE_FLTRECORD(Switch, SWITCH_OP) +USE_FLTRECORD(ExternalReference, EXTERNAL_REFERENCE_OP) +USE_FLTRECORD(InstanceDefinition, INSTANCE_DEFINITION_OP) +USE_FLTRECORD(InstanceReference, INSTANCE_REFERENCE_OP) +USE_FLTRECORD(Extension, EXTENSION_OP) +USE_FLTRECORD(Object, OBJECT_OP) +USE_FLTRECORD(LightSource, LIGHT_SOURCE_OP) +USE_FLTRECORD(DummyRecord, 103) +USE_FLTRECORD(DummyRecord, 104) +USE_FLTRECORD(DummyRecord, 117) +USE_FLTRECORD(DummyRecord, 118) +USE_FLTRECORD(DummyRecord, 120) +USE_FLTRECORD(DummyRecord, 121) +USE_FLTRECORD(DummyRecord, 124) +USE_FLTRECORD(DummyRecord, 125) +USE_FLTRECORD(RoadSegment, ROAD_SEGMENT_OP) +USE_FLTRECORD(RoadConstruction, ROAD_CONSTRUCTION_OP) +USE_FLTRECORD(RoadPath, ROAD_PATH_OP) +USE_FLTRECORD(VertexC, VERTEX_C_OP) +USE_FLTRECORD(VertexCN, VERTEX_CN_OP) +USE_FLTRECORD(VertexCT, VERTEX_CT_OP) +USE_FLTRECORD(VertexCNT, VERTEX_CNT_OP) +USE_FLTRECORD(AbsoluteVertex, OLD_ABSOLUTE_VERTEX_OP) +USE_FLTRECORD(ShadedVertex, OLD_SHADED_VERTEX_OP) +USE_FLTRECORD(NormalVertex, OLD_NORMAL_VERTEX_OP) + + class ReadExternalsVisitor : public osg::NodeVisitor { diff --git a/src/osgPlugins/OpenFlight/Registry.h b/src/osgPlugins/OpenFlight/Registry.h index 49d53cc54..b7cb941f2 100644 --- a/src/osgPlugins/OpenFlight/Registry.h +++ b/src/osgPlugins/OpenFlight/Registry.h @@ -122,6 +122,27 @@ class RegisterRecordProxy ~RegisterRecordProxy() {} }; +////////////////////////////////////////////////////////////////////////// + +extern "C" +{ + typedef void (* CRecordFunction) (void); +} + +struct RecordFunctionProxy +{ + RecordFunctionProxy(CRecordFunction function) { (function)(); } +}; + +#define USE_FLTRECORD(recname, opcode) \ + extern "C" void osgfltrec_##recname_##opcode(void); \ + static flt::RecordFunctionProxy proxy_fltrecord_##recname_##opcode(osgfltrec_##recname_##opcode); + +#define REGISTER_FLTRECORD(recname, opcode) \ + extern "C" void osgfltrec_##recname_##opcode(void) {} \ + static flt::RegisterRecordProxy g_proxy_fltrecord_##recname_##opcode(opcode); + + } // end namespace #endif diff --git a/src/osgPlugins/OpenFlight/ReservedRecords.cpp b/src/osgPlugins/OpenFlight/ReservedRecords.cpp index 639b9a512..c3569ac33 100644 --- a/src/osgPlugins/OpenFlight/ReservedRecords.cpp +++ b/src/osgPlugins/OpenFlight/ReservedRecords.cpp @@ -22,14 +22,15 @@ using namespace flt; // Prevent "unknown record" message for the following reserved records: -RegisterRecordProxy g_Reserved_103(103); -RegisterRecordProxy g_Reserved_104(104); -RegisterRecordProxy g_Reserved_117(117); -RegisterRecordProxy g_Reserved_118(118); -RegisterRecordProxy g_Reserved_120(120); -RegisterRecordProxy g_Reserved_121(121); -RegisterRecordProxy g_Reserved_124(124); -RegisterRecordProxy g_Reserved_125(125); +REGISTER_FLTRECORD(DummyRecord, 103) +REGISTER_FLTRECORD(DummyRecord, 104) +REGISTER_FLTRECORD(DummyRecord, 117) +REGISTER_FLTRECORD(DummyRecord, 118) +REGISTER_FLTRECORD(DummyRecord, 120) +REGISTER_FLTRECORD(DummyRecord, 121) +REGISTER_FLTRECORD(DummyRecord, 124) +REGISTER_FLTRECORD(DummyRecord, 125) + diff --git a/src/osgPlugins/OpenFlight/RoadRecords.cpp b/src/osgPlugins/OpenFlight/RoadRecords.cpp index d64cd8a54..5c41efb2a 100644 --- a/src/osgPlugins/OpenFlight/RoadRecords.cpp +++ b/src/osgPlugins/OpenFlight/RoadRecords.cpp @@ -60,7 +60,7 @@ class RoadSegment : public PrimaryRecord } }; -RegisterRecordProxy g_RoadSegment(ROAD_SEGMENT_OP); +REGISTER_FLTRECORD(RoadSegment, ROAD_SEGMENT_OP) /** RoadConstruction @@ -98,7 +98,8 @@ class RoadConstruction : public PrimaryRecord } }; -RegisterRecordProxy g_RoadConstruction(ROAD_CONSTRUCTION_OP); +REGISTER_FLTRECORD(RoadConstruction, ROAD_CONSTRUCTION_OP) + /** RoadPath @@ -132,7 +133,8 @@ class RoadPath : public PrimaryRecord } }; -RegisterRecordProxy g_RoadPath(ROAD_PATH_OP); +REGISTER_FLTRECORD(RoadPath, ROAD_PATH_OP) + } // end namespace diff --git a/src/osgPlugins/OpenFlight/VertexRecords.cpp b/src/osgPlugins/OpenFlight/VertexRecords.cpp index 80777c367..30c5cbb8f 100644 --- a/src/osgPlugins/OpenFlight/VertexRecords.cpp +++ b/src/osgPlugins/OpenFlight/VertexRecords.cpp @@ -76,7 +76,8 @@ class VertexC : public Record } }; -RegisterRecordProxy g_VertexC(VERTEX_C_OP); +REGISTER_FLTRECORD(VertexC, VERTEX_C_OP) + class VertexCN : public Record @@ -115,7 +116,8 @@ class VertexCN : public Record } }; -RegisterRecordProxy g_VertexCN(VERTEX_CN_OP); +REGISTER_FLTRECORD(VertexCN, VERTEX_CN_OP) + class VertexCT : public Record @@ -154,7 +156,8 @@ class VertexCT : public Record } }; -RegisterRecordProxy g_VertexCT(VERTEX_CT_OP); +REGISTER_FLTRECORD(VertexCT, VERTEX_CT_OP) + class VertexCNT : public Record @@ -211,7 +214,8 @@ class VertexCNT : public Record } }; -RegisterRecordProxy g_VertexCNT(VERTEX_CNT_OP); +REGISTER_FLTRECORD(VertexCNT, VERTEX_CNT_OP) + /** Absolute Vertex - @@ -252,7 +256,8 @@ class AbsoluteVertex : public Record } }; -RegisterRecordProxy g_AbsoluteVertex(OLD_ABSOLUTE_VERTEX_OP); +REGISTER_FLTRECORD(AbsoluteVertex, OLD_ABSOLUTE_VERTEX_OP) + /** Shaded Vertex @@ -300,7 +305,8 @@ class ShadedVertex : public Record } }; -RegisterRecordProxy g_ShadedVertex(OLD_SHADED_VERTEX_OP); +REGISTER_FLTRECORD(ShadedVertex, OLD_SHADED_VERTEX_OP) + /** Normal Vertex @@ -348,6 +354,7 @@ class NormalVertex : public Record } }; -RegisterRecordProxy g_NormalVertex(OLD_NORMAL_VERTEX_OP); +REGISTER_FLTRECORD(NormalVertex, OLD_NORMAL_VERTEX_OP) + } // end namespace