Skip to content

Commit

Permalink
updates from PR
Browse files Browse the repository at this point in the history
  • Loading branch information
corybarr committed Feb 13, 2024
1 parent 47dd9dd commit 8902d6c
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,8 @@ def build_common_raster_overlay_properties(add_overlay_render_method=False):
CustomLayoutProperty("cesium:alpha", build_fn=build_slider(0, 1))
if add_overlay_render_method:
CustomLayoutProperty("cesium:overlayRenderMethod")
with CustomLayoutGroup("Maximum Screen Space Error"):
CustomLayoutProperty("cesium:maximumScreenSpaceError")
with CustomLayoutGroup("Maximum Texture Size"):
CustomLayoutProperty("cesium:maximumTextureSize")
with CustomLayoutGroup("Maximum Simultaneous Tile Loads"):
CustomLayoutProperty("cesium:maximumSimultaneousTileLoads")
with CustomLayoutGroup("Sub Tile Cache Bytes"):
CustomLayoutProperty("cesium:subTileCacheBytes")
with CustomLayoutGroup("Credit Display"):
CustomLayoutProperty("cesium:showCreditsOnScreen")
CustomLayoutProperty("cesium:maximumScreenSpaceError")
CustomLayoutProperty("cesium:maximumTextureSize")
CustomLayoutProperty("cesium:maximumSimultaneousTileLoads")
CustomLayoutProperty("cesium:subTileCacheBytes")
CustomLayoutProperty("cesium:showCreditsOnScreen")
6 changes: 3 additions & 3 deletions src/core/include/cesium/omniverse/OmniRasterOverlay.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ class OmniRasterOverlay {
[[nodiscard]] int getMaximumSimultaneousTileLoads() const;
[[nodiscard]] int getSubTileCacheBytes() const;

[[nodiscard]] CesiumRasterOverlays::RasterOverlayOptions getUsdOptions();
[[nodiscard]] CesiumRasterOverlays::RasterOverlayOptions createRasterOverlayOptions() const;

[[nodiscard]] virtual CesiumRasterOverlays::RasterOverlay* getRasterOverlay() const = 0;
void updateRasterOverlayOptions(CesiumRasterOverlays::RasterOverlayOptions& options);
void updateRasterOverlayOptions() const;
virtual void reload() = 0;

protected:
Context* _pContext;
pxr::SdfPath _path;

private:
void setOptionsFromUsd(CesiumRasterOverlays::RasterOverlayOptions& options);
void setRasterOverlayOptionsFromUsd(CesiumRasterOverlays::RasterOverlayOptions& options) const;
};
} // namespace cesium::omniverse
2 changes: 1 addition & 1 deletion src/core/src/OmniIonRasterOverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void OmniIonRasterOverlay::reload() {

const auto rasterOverlayName = UsdUtil::getName(_pContext->getUsdStage(), _path);

auto options = getUsdOptions();
auto options = createRasterOverlayOptions();

options.loadErrorCallback = [this, rasterOverlayIonAssetId, rasterOverlayName](
const CesiumRasterOverlays::RasterOverlayLoadFailureDetails& error) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/src/OmniPolygonRasterOverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void OmniPolygonRasterOverlay::reload() {

const auto projection = CesiumGeospatial::GeographicProjection(*pEllipsoid);

auto options = getUsdOptions();
auto options = createRasterOverlayOptions();

options.loadErrorCallback = [this](const CesiumRasterOverlays::RasterOverlayLoadFailureDetails& error) {
_pContext->getLogger()->error(error.message);
Expand Down
15 changes: 9 additions & 6 deletions src/core/src/OmniRasterOverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,22 @@ FabricOverlayRenderMethod OmniRasterOverlay::getOverlayRenderMethod() const {
return FabricOverlayRenderMethod::OVERLAY;
}

CesiumRasterOverlays::RasterOverlayOptions OmniRasterOverlay::getUsdOptions() {
CesiumRasterOverlays::RasterOverlayOptions OmniRasterOverlay::createRasterOverlayOptions() const {
CesiumRasterOverlays::RasterOverlayOptions options;
setOptionsFromUsd(options);
options.ktx2TranscodeTargets = GltfUtil::getKtx2TranscodeTargets();
setRasterOverlayOptionsFromUsd(options);
return options;
}

void OmniRasterOverlay::updateRasterOverlayOptions(CesiumRasterOverlays::RasterOverlayOptions& options) {
setOptionsFromUsd(options);
void OmniRasterOverlay::updateRasterOverlayOptions() const {
const auto pRasterOverlay = getRasterOverlay();
if (pRasterOverlay) {
setRasterOverlayOptionsFromUsd(pRasterOverlay->getOptions());
}
}

void OmniRasterOverlay::setOptionsFromUsd(CesiumRasterOverlays::RasterOverlayOptions& options) {
void OmniRasterOverlay::setRasterOverlayOptionsFromUsd(CesiumRasterOverlays::RasterOverlayOptions& options) const {
options.showCreditsOnScreen = getShowCreditsOnScreen();
options.ktx2TranscodeTargets = GltfUtil::getKtx2TranscodeTargets();
options.maximumScreenSpaceError = getMaximumScreenSpaceError();
options.maximumTextureSize = getMaximumTextureSize();
options.maximumSimultaneousTileLoads = getMaximumSimultaneousTileLoads();
Expand Down
2 changes: 1 addition & 1 deletion src/core/src/OmniWebMapServiceRasterOverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ std::string OmniWebMapServiceRasterOverlay::getLayers() const {
void OmniWebMapServiceRasterOverlay::reload() {
const auto rasterOverlayName = UsdUtil::getName(_pContext->getUsdStage(), _path);

auto options = getUsdOptions();
auto options = createRasterOverlayOptions();

options.loadErrorCallback = [this](const CesiumRasterOverlays::RasterOverlayLoadFailureDetails& error) {
_pContext->getLogger()->error(error.message);
Expand Down
3 changes: 1 addition & 2 deletions src/core/src/UsdNotificationHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,7 @@ void processCesiumRasterOverlayChanged(
}

if (updateRasterOverlayOptions) {
auto pNativeOverlay = pRasterOverlay->getRasterOverlay();
pRasterOverlay->updateRasterOverlayOptions(pNativeOverlay->getOptions());
pRasterOverlay->updateRasterOverlayOptions();
}
}

Expand Down

0 comments on commit 8902d6c

Please sign in to comment.