Skip to content

Commit

Permalink
Work on compressed arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonbeverage committed Mar 8, 2024
1 parent 0e658c5 commit ea34782
Show file tree
Hide file tree
Showing 5 changed files with 773 additions and 1 deletion.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ find_package(WEBP)
find_package(Blend2D)
find_package(Blosc)
find_package(spdlog)
find_package(meshoptimizer)

if(OSGEARTH_BUILD_CESIUM_NODEKIT)
find_package(CesiumNative)
Expand Down
6 changes: 6 additions & 0 deletions src/osgEarth/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ IF(WIN32)
LIST(APPEND TARGET_EXTERNAL_LIBRARIES psapi)
ENDIF(WIN32)


LIST(APPEND TARGET_EXTERNAL_LIBRARIES meshoptimizer::meshoptimizer)


# Generate the Version header.
# set(OSGEARTH_SOVERSION_VALUE "${OSGEARTH_SOVERSION}")
set(OSGEARTH_VERSION_HEADER "${OSGEARTH_BUILDTIME_INCLUDE_DIR}/osgEarth/Version")
Expand Down Expand Up @@ -114,6 +118,7 @@ SET(LIB_PUBLIC_HEADERS
ColorFilter
Common
Composite
CompressedArray
CompositeTiledModelLayer
Config
Containers
Expand Down Expand Up @@ -552,6 +557,7 @@ set(TARGET_SRC
Composite.cpp
CompositeTiledModelLayer.cpp
Compressors.cpp
CompressedArray.cpp
Config.cpp
CoverageLayer.cpp
Cube.cpp
Expand Down
102 changes: 102 additions & 0 deletions src/osgEarth/CompressedArray
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#ifndef OSGEARTHUTIL_COMPRESSED_ARRAY_H
#define OSGEARTHUTIL_COMPRESSED_ARRAY_H

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

#include <osgEarth/PlaceNode>

namespace osgEarth
{
using namespace osgEarth;

class OSGEARTH_EXPORT CompressedVec3Array : public osg::Vec3Array
{
public:
enum QuantizationType
{
QUANTIZE_NONE,
QUANTIZE_VERTEX,
QUANTIZE_NORMAL,
QUANTIZE_HALF
};

CompressedVec3Array();

CompressedVec3Array(osg::Vec3Array& va, QuantizationType quantization = CompressedVec3Array::QUANTIZE_NONE);

CompressedVec3Array(const CompressedVec3Array& rhs, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);

META_Object(osgEarth, CompressedVec3Array);

QuantizationType getQuantization() const { return _quantization; }
void setQuantization(QuantizationType quantization) { _quantization = quantization; }

private:
QuantizationType _quantization = QUANTIZE_NONE;
};

class OSGEARTH_EXPORT CompressedVec2Array : public osg::Vec2Array
{
public:
CompressedVec2Array();

CompressedVec2Array(osg::Vec2Array& va);

CompressedVec2Array(const CompressedVec2Array& rhs, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);

META_Object(osgEarth, CompressedVec2Array);
};

class OSGEARTH_EXPORT CompressedDrawElementsUShort : public osg::DrawElementsUShort
{
public:
CompressedDrawElementsUShort();

CompressedDrawElementsUShort(osg::DrawElementsUShort& de);

CompressedDrawElementsUShort(const CompressedDrawElementsUShort& rhs, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);

META_Object(osgEarth, CompressedDrawElementsUShort);
};

class OSGEARTH_EXPORT CompressedDrawElementsUByte : public osg::DrawElementsUByte
{
public:
CompressedDrawElementsUByte();

CompressedDrawElementsUByte(osg::DrawElementsUByte& de);

CompressedDrawElementsUByte(const CompressedDrawElementsUByte& rhs, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);

META_Object(osgEarth, CompressedDrawElementsUByte);
};

class OSGEARTH_EXPORT CompressedDrawElementsUInt : public osg::DrawElementsUInt
{
public:
CompressedDrawElementsUInt();

CompressedDrawElementsUInt(osg::DrawElementsUInt& de);

CompressedDrawElementsUInt(const CompressedDrawElementsUInt& rhs, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);

META_Object(osgEarth, CompressedDrawElementsUInt);
};

class OSGEARTH_EXPORT CompressedUIntArray : public osg::UIntArray
{
public:
CompressedUIntArray();

CompressedUIntArray(osg::UIntArray& array);

CompressedUIntArray(const CompressedUIntArray& rhs, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);

META_Object(osgEarth, CompressedUIntArray);
};


}

#endif
Loading

0 comments on commit ea34782

Please sign in to comment.