Skip to content

Commit

Permalink
pCesium -> pAsset.
Browse files Browse the repository at this point in the history
  • Loading branch information
kring committed Oct 29, 2024
1 parent 6b7f4af commit adec72e
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Source/CesiumRuntime/Private/CesiumGltfTextures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ SharedFuture<void> createTextureInLoadThread(
const ExtensionImageAssetUnreal& extension =
ExtensionImageAssetUnreal::getOrCreate(
asyncSystem,
*pImage->pCesium,
*pImage->pAsset,
sRGB,
needsMips,
std::nullopt);
Expand Down
5 changes: 1 addition & 4 deletions Source/CesiumRuntime/Private/CesiumTextureUtility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,10 +304,7 @@ TUniquePtr<LoadedTextureResult> loadTextureFromModelAnyThreadPart(
model.getSafe(model.samplers, texture.sampler);

TUniquePtr<LoadedTextureResult> result =
loadTextureFromImageAndSamplerAnyThreadPart(
*image.pCesium,
sampler,
sRGB);
loadTextureFromImageAndSamplerAnyThreadPart(*image.pAsset, sampler, sRGB);

if (result) {
extension.pTexture = result->pTexture;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ void FCesiumFeatureIdTextureSpec::Define() {
It("constructs valid instance for texture with nonexistent texcoord attribute",
[this]() {
Image& image = model.images.emplace_back();
image.pCesium.emplace();
image.pCesium->width = image.pCesium->height = 1;
image.pCesium->channels = 1;
image.pCesium->pixelData.push_back(std::byte(42));
image.pAsset.emplace();
image.pAsset->width = image.pAsset->height = 1;
image.pAsset->channels = 1;
image.pAsset->pixelData.push_back(std::byte(42));

Sampler& sampler = model.samplers.emplace_back();
sampler.wrapS = Sampler::WrapS::CLAMP_TO_EDGE;
Expand Down Expand Up @@ -176,10 +176,10 @@ void FCesiumFeatureIdTextureSpec::Define() {
It("constructs valid instance for texture with invalid texcoord accessor",
[this]() {
Image& image = model.images.emplace_back();
image.pCesium.emplace();
image.pCesium->width = image.pCesium->height = 1;
image.pCesium->channels = 1;
image.pCesium->pixelData.push_back(std::byte(42));
image.pAsset.emplace();
image.pAsset->width = image.pAsset->height = 1;
image.pAsset->channels = 1;
image.pAsset->pixelData.push_back(std::byte(42));

Sampler& sampler = model.samplers.emplace_back();
sampler.wrapS = Sampler::WrapS::CLAMP_TO_EDGE;
Expand Down
12 changes: 6 additions & 6 deletions Source/CesiumRuntime/Private/Tests/CesiumGltfSpecUtility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ CesiumGltf::FeatureId& AddFeatureIDsAsTextureToModel(
const int32_t samplerWrapS,
const int32_t samplerWrapT) {
CesiumGltf::Image& image = model.images.emplace_back();
image.pCesium.emplace();
image.pCesium->bytesPerChannel = 1;
image.pCesium->channels = 1;
image.pCesium->width = imageWidth;
image.pCesium->height = imageHeight;
image.pAsset.emplace();
image.pAsset->bytesPerChannel = 1;
image.pAsset->channels = 1;
image.pAsset->width = imageWidth;
image.pAsset->height = imageHeight;

std::vector<std::byte>& data = image.pCesium->pixelData;
std::vector<std::byte>& data = image.pAsset->pixelData;
data.resize(imageWidth * imageHeight);
std::memcpy(data.data(), featureIDs.data(), data.size());

Expand Down
16 changes: 8 additions & 8 deletions Source/CesiumRuntime/Private/Tests/CesiumGltfSpecUtility.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,16 +200,16 @@ CesiumGltf::PropertyTextureProperty& AddPropertyTexturePropertyToModel(
classProperty.componentType = componentType;

CesiumGltf::Image& image = model.images.emplace_back();
image.pCesium.emplace();
image.pCesium->width = 2;
image.pCesium->height = 2;
image.pCesium->channels = sizeof(T);
image.pCesium->bytesPerChannel = 1;
image.pCesium->pixelData.resize(values.size() * sizeof(T));
image.pAsset.emplace();
image.pAsset->width = 2;
image.pAsset->height = 2;
image.pAsset->channels = sizeof(T);
image.pAsset->bytesPerChannel = 1;
image.pAsset->pixelData.resize(values.size() * sizeof(T));
std::memcpy(
image.pCesium->pixelData.data(),
image.pAsset->pixelData.data(),
values.data(),
image.pCesium->pixelData.size());
image.pAsset->pixelData.size());

CesiumGltf::Sampler& sampler = model.samplers.emplace_back();
sampler.wrapS = CesiumGltf::Sampler::WrapS::CLAMP_TO_EDGE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ void CesiumTextureUtilitySpec::RunTests() {
Model model;

Image& image = model.images.emplace_back();
image.pCesium = pImageAsset;
image.pAsset = pImageAsset;

Sampler& sampler = model.samplers.emplace_back();
sampler.minFilter = Sampler::MinFilter::LINEAR_MIPMAP_LINEAR;
Expand Down Expand Up @@ -232,7 +232,7 @@ void CesiumTextureUtilitySpec::RunTests() {
Model model;

Image& image = model.images.emplace_back();
image.pCesium = pImageAsset;
image.pAsset = pImageAsset;

Sampler& sampler1 = model.samplers.emplace_back();
sampler1.minFilter = Sampler::MinFilter::LINEAR_MIPMAP_LINEAR;
Expand Down Expand Up @@ -299,7 +299,7 @@ void CesiumTextureUtilitySpec::RunTests() {
Model model;

Image& image = model.images.emplace_back();
image.pCesium = pImageAsset;
image.pAsset = pImageAsset;

Sampler& sampler = model.samplers.emplace_back();
sampler.minFilter = Sampler::MinFilter::LINEAR_MIPMAP_LINEAR;
Expand Down Expand Up @@ -348,7 +348,7 @@ void CesiumTextureUtilitySpec::RunTests() {
Model model;

Image& image = model.images.emplace_back();
image.pCesium = pImageAsset;
image.pAsset = pImageAsset;

Sampler& sampler = model.samplers.emplace_back();
sampler.minFilter = Sampler::MinFilter::LINEAR_MIPMAP_LINEAR;
Expand Down

0 comments on commit adec72e

Please sign in to comment.