Skip to content

Commit

Permalink
Added new experimental CompressedArray classes which use MeshOptimize…
Browse files Browse the repository at this point in the history
…r to compress and compress data to osgdb files
  • Loading branch information
jasonbeverage committed Apr 1, 2024
1 parent a948d36 commit 62596f0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ if(draco_FOUND)
set(OSGEARTH_HAVE_DRACO ON)
endif(draco_FOUND)

if (meshoptimizer_FOUND)
set(OSGEARTH_HAVE_MESH_OPTIMIZER ON)
endif()

if(OSGEARTH_BUILD_CESIUM_NODEKIT)
find_package(CesiumNative)
endif()
Expand Down
1 change: 1 addition & 0 deletions src/osgEarth/BuildConfig.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
#cmakedefine OSGEARTH_HAVE_DRACO
#cmakedefine OSGEARTH_HAVE_GEOCODER
#cmakedefine OSGEARTH_HAVE_BLEND2D
#cmakedefine OSGEARTH_HAVE_MESH_OPTIMIZER

#endif // OSGEARTH_BUILDCONFIG_H
9 changes: 7 additions & 2 deletions src/osgEarth/CompressedArray
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
#define OSGEARTHUTIL_COMPRESSED_ARRAY_H

#include <osgEarth/Common>
#include <osg/Node>

#include <osgEarth/PlaceNode>
#ifdef OSGEARTH_HAVE_MESH_OPTIMIZER

#include <osg/Array>
#include <osg/PrimitiveSet>

namespace osgEarth
{
Expand Down Expand Up @@ -98,5 +100,8 @@ namespace osgEarth


}
#else
#pragma message("Warning: MeshOptimizer not available. CompressedArray classes will not be available.")
#endif

#endif
10 changes: 8 additions & 2 deletions src/osgEarth/CompressedArray.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
#include <osgEarth/CompressedArray>

#ifdef OSGEARTH_HAVE_MESH_OPTIMIZER
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
#include <osgDB/ObjectWrapper>
#include <osgDB/Registry>

#include <meshoptimizer.h>

using namespace osgEarth;
Expand Down Expand Up @@ -638,5 +645,4 @@ namespace osgEarth {
}
}



#endif // OSGEARTH_HAVE_MESH_OPTIMIZER

0 comments on commit 62596f0

Please sign in to comment.