Skip to content

Commit

Permalink
Move SharedAsset[Depot] to CesiumAsync.
Browse files Browse the repository at this point in the history
  • Loading branch information
kring committed Oct 10, 2024
1 parent e397591 commit a9516a0
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 19 deletions.
1 change: 0 additions & 1 deletion Cesium3DTilesSelection/src/TilesetContentManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <Cesium3DTilesSelection/TilesetLoadFailureDetails.h>
#include <Cesium3DTilesSelection/TilesetOptions.h>
#include <CesiumAsync/IAssetAccessor.h>
#include <CesiumGltf/SharedAssetDepot.h>
#include <CesiumUtility/CreditSystem.h>
#include <CesiumUtility/ReferenceCounted.h>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#pragma once

#include <CesiumGltf/SharedAssetDepot.h>
#include <CesiumAsync/SharedAssetDepot.h>
#include <CesiumUtility/ExtensibleObject.h>
#include <CesiumUtility/IntrusivePointer.h>

#include <atomic>

namespace CesiumGltf {
namespace CesiumAsync {

/**
* @brief An asset that is potentially shared between multiple objects, such as
Expand All @@ -21,7 +21,7 @@ namespace CesiumGltf {
* `class MyClass : public SharedAsset<MyClass> { ... };`
*/
template <typename T>
class CESIUMGLTF_API SharedAsset : public CesiumUtility::ExtensibleObject {
class CESIUMASYNC_API SharedAsset : public CesiumUtility::ExtensibleObject {
public:
// Assets can be copied, but the fresh instance has no references and is not
// in the asset depot.
Expand Down Expand Up @@ -120,4 +120,4 @@ class CESIUMGLTF_API SharedAsset : public CesiumUtility::ExtensibleObject {
friend class SharedAssetDepot<T>;
};

} // namespace CesiumGltf
} // namespace CesiumAsync
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <unordered_map>
#include <vector>

namespace CesiumGltf {
namespace CesiumAsync {

template <typename T> class SharedAsset;

Expand All @@ -26,8 +26,9 @@ template <typename T> class SharedAsset;
* be derived from {@link SharedAsset}.
*/
template <typename AssetType>
class SharedAssetDepot : public CesiumUtility::ReferenceCountedThreadSafe<
SharedAssetDepot<AssetType>> {
class CESIUMASYNC_API SharedAssetDepot
: public CesiumUtility::ReferenceCountedThreadSafe<
SharedAssetDepot<AssetType>> {
public:
/**
* @brief The maximum total byte usage of assets that have been loaded but are
Expand Down Expand Up @@ -273,4 +274,4 @@ class SharedAssetDepot : public CesiumUtility::ReferenceCountedThreadSafe<
friend class SharedAsset<AssetType>;
};

} // namespace CesiumGltf
} // namespace CesiumAsync
2 changes: 1 addition & 1 deletion CesiumGltf/include/CesiumGltf/Image.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "CesiumGltf/ImageSpec.h"
#include "CesiumGltf/Library.h"

#include <CesiumGltf/SharedAssetDepot.h>
#include <CesiumAsync/SharedAssetDepot.h>

namespace CesiumGltf {
/** @copydoc ImageSpec */
Expand Down
5 changes: 3 additions & 2 deletions CesiumGltf/include/CesiumGltf/ImageCesium.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

#include "CesiumAsync/SharedAsset.h"
#include "CesiumGltf/Ktx2TranscodeTargets.h"
#include "CesiumGltf/Library.h"
#include "CesiumGltf/SharedAsset.h"

#include <cstddef>
#include <cstdint>
Expand Down Expand Up @@ -30,7 +30,8 @@ struct CESIUMGLTF_API ImageCesiumMipPosition {
* @brief Holds {@link Image} properties that are specific to the glTF loader
* rather than part of the glTF spec.
*/
struct CESIUMGLTF_API ImageCesium final : public SharedAsset<ImageCesium> {
struct CESIUMGLTF_API ImageCesium final
: public CesiumAsync::SharedAsset<ImageCesium> {
/**
* @brief The width of the image in pixels.
*/
Expand Down
7 changes: 4 additions & 3 deletions CesiumGltf/include/CesiumGltf/SharedAssetSystem.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <CesiumAsync/SharedAssetDepot.h>
#include <CesiumAsync/SharedFuture.h>
#include <CesiumGltf/SharedAssetDepot.h>

namespace CesiumGltf {

Expand Down Expand Up @@ -36,10 +36,11 @@ class SharedAssetSystem
->getOrFetch(asyncSystem, pAssetAccessor, factory, uri, headers);
}

const SharedAssetDepot<CesiumGltf::ImageCesium>& image();
const CesiumAsync::SharedAssetDepot<CesiumGltf::ImageCesium>& image();

private:
CesiumUtility::IntrusivePointer<SharedAssetDepot<CesiumGltf::ImageCesium>>
CesiumUtility::IntrusivePointer<
CesiumAsync::SharedAssetDepot<CesiumGltf::ImageCesium>>
_pImages;
};

Expand Down
1 change: 0 additions & 1 deletion CesiumGltf/include/CesiumGltf/TextureView.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <CesiumGltf/ImageCesium.h>
#include <CesiumGltf/KhrTextureTransform.h>
#include <CesiumGltf/Sampler.h>
#include <CesiumGltf/SharedAssetDepot.h>
#include <CesiumGltf/TextureInfo.h>
#include <CesiumUtility/IntrusivePointer.h>

Expand Down
5 changes: 3 additions & 2 deletions CesiumGltf/src/SharedAssetSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
namespace CesiumGltf {

SharedAssetSystem::SharedAssetSystem() noexcept
: _pImages(new SharedAssetDepot<CesiumGltf::ImageCesium>()) {}
: _pImages(new CesiumAsync::SharedAssetDepot<CesiumGltf::ImageCesium>()) {}

SharedAssetSystem::~SharedAssetSystem() noexcept = default;

const SharedAssetDepot<CesiumGltf::ImageCesium>& SharedAssetSystem::image() {
const CesiumAsync::SharedAssetDepot<CesiumGltf::ImageCesium>&
SharedAssetSystem::image() {
return *this->_pImages;
}

Expand Down
2 changes: 1 addition & 1 deletion CesiumGltfReader/src/GltfReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
#include <CesiumAsync/IAssetAccessor.h>
#include <CesiumAsync/IAssetRequest.h>
#include <CesiumAsync/IAssetResponse.h>
#include <CesiumAsync/SharedAssetDepot.h>
#include <CesiumGltf/ExtensionKhrTextureBasisu.h>
#include <CesiumGltf/ExtensionTextureWebp.h>
#include <CesiumGltf/ImageCesium.h>
#include <CesiumGltf/Ktx2TranscodeTargets.h>
#include <CesiumGltf/SharedAssetDepot.h>
#include <CesiumJsonReader/JsonHandler.h>
#include <CesiumJsonReader/JsonReader.h>
#include <CesiumJsonReader/JsonReaderOptions.h>
Expand Down

0 comments on commit a9516a0

Please sign in to comment.