Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Material variants support #693

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#pragma once

#include "Library.h"

#include <string>
#include <vector>

namespace Cesium3DTilesSelection {

/**
*/
struct CESIUM3DTILESSELECTION_API MaterialVariants {
public:
std::vector<std::string> tilesetMaterialVariantNames;
std::vector<std::vector<std::string>> groupsMaterialVariantNames;
};

} // namespace Cesium3DTilesSelection
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include "Library.h"
#include "MaterialVariants.h";
#include "RasterOverlayCollection.h"
#include "Tile.h"
#include "TilesetContentLoader.h"
Expand Down Expand Up @@ -154,6 +155,8 @@ class CESIUM3DTILESSELECTION_API Tileset final {
/** @copydoc Tileset::getOverlays() */
const RasterOverlayCollection& getOverlays() const noexcept;

const MaterialVariants& getMaterialVariants() const noexcept;

/**
* @brief Updates this view but waits for all tiles that meet sse to finish
* loading and ready to be rendered before returning the function. This method
Expand Down
1 change: 1 addition & 0 deletions Cesium3DTilesSelection/src/LayerJsonTerrainLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ convertToTilesetContentLoaderResult(LoadLayersResult&& loadLayersResult) {
std::move(pLoader),
std::move(pRootTile),
std::move(credits),
MaterialVariants{},
std::vector<IAssetAccessor::THeader>{},
std::move(loadLayersResult.errors)};
}
Expand Down
4 changes: 4 additions & 0 deletions Cesium3DTilesSelection/src/Tileset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ const RasterOverlayCollection& Tileset::getOverlays() const noexcept {
return this->_pTilesetContentManager->getRasterOverlayCollection();
}

const MaterialVariants& Tileset::getMaterialVariants() const noexcept {
return this->_pTilesetContentManager->getMaterialVariants();
}

static bool
operator<(const FogDensityAtHeight& fogDensity, double height) noexcept {
return fogDensity.cameraHeight < height;
Expand Down
7 changes: 7 additions & 0 deletions Cesium3DTilesSelection/src/TilesetContentLoaderResult.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <Cesium3DTilesSelection/ErrorList.h>
#include <Cesium3DTilesSelection/MaterialVariants.h>
#include <Cesium3DTilesSelection/Tile.h>
#include <CesiumAsync/IAssetAccessor.h>
#include <CesiumGeometry/Axis.h>
Expand All @@ -23,11 +24,13 @@ template <class TilesetContentLoaderType> struct TilesetContentLoaderResult {
std::unique_ptr<TilesetContentLoaderType>&& pLoader_,
std::unique_ptr<Tile>&& pRootTile_,
std::vector<LoaderCreditResult>&& credits_,
MaterialVariants&& materialVariants_,
std::vector<CesiumAsync::IAssetAccessor::THeader>&& requestHeaders_,
ErrorList&& errors_)
: pLoader{std::move(pLoader_)},
pRootTile{std::move(pRootTile_)},
credits{std::move(credits_)},
materialVariants{std::move(materialVariants_)},
requestHeaders{std::move(requestHeaders_)},
errors{std::move(errors_)} {}

Expand All @@ -54,6 +57,7 @@ template <class TilesetContentLoaderType> struct TilesetContentLoaderResult {
: pLoader{std::move(rhs.pLoader)},
pRootTile{std::move(rhs.pRootTile)},
credits{std::move(rhs.credits)},
materialVariants{std::move(rhs.materialVariants)},
requestHeaders{std::move(rhs.requestHeaders)},
errors{std::move(rhs.errors)} {}

Expand All @@ -71,6 +75,7 @@ template <class TilesetContentLoaderType> struct TilesetContentLoaderResult {
swap(this->pLoader, rhs.pLoader);
swap(this->pRootTile, rhs.pRootTile);
swap(this->credits, rhs.credits);
swap(this->materialVariants, rhs.materialVariants);
swap(this->requestHeaders, rhs.requestHeaders);
swap(this->errors, rhs.errors);

Expand All @@ -83,6 +88,8 @@ template <class TilesetContentLoaderType> struct TilesetContentLoaderResult {

std::vector<LoaderCreditResult> credits;

MaterialVariants materialVariants;

std::vector<CesiumAsync::IAssetAccessor::THeader> requestHeaders;

ErrorList errors;
Expand Down
Loading