diff --git a/Source/CesiumRuntime/Private/CesiumGltfComponent.cpp b/Source/CesiumRuntime/Private/CesiumGltfComponent.cpp index f321d578d..b2781a59a 100644 --- a/Source/CesiumRuntime/Private/CesiumGltfComponent.cpp +++ b/Source/CesiumRuntime/Private/CesiumGltfComponent.cpp @@ -67,7 +67,6 @@ #include "ScopedTransaction.h" #endif -using namespace CesiumGltf; using namespace CesiumTextureUtility; using namespace CreateGltfOptions; using namespace LoadGltfResult; @@ -99,12 +98,13 @@ template struct IsAccessorView; template struct IsAccessorView : std::false_type {}; -template struct IsAccessorView> : std::true_type {}; +template +struct IsAccessorView> : std::true_type {}; template static uint32_t updateTextureCoordinates( - const Model& model, - const MeshPrimitive& primitive, + const CesiumGltf::Model& model, + const CesiumGltf::MeshPrimitive& primitive, bool duplicateVertices, TArray& vertices, const TArray& indices, @@ -125,8 +125,8 @@ static uint32_t updateTextureCoordinates( } uint32_t updateTextureCoordinates( - const Model& model, - const MeshPrimitive& primitive, + const CesiumGltf::Model& model, + const CesiumGltf::MeshPrimitive& primitive, bool duplicateVertices, TArray& vertices, const TArray& indices, @@ -148,8 +148,8 @@ uint32_t updateTextureCoordinates( size_t textureCoordinateIndex = gltfToUnrealTexCoordMap.size(); gltfToUnrealTexCoordMap[uvAccessorID] = textureCoordinateIndex; - AccessorView uvAccessor(model, uvAccessorID); - if (uvAccessor.status() != AccessorViewStatus::Valid) { + CesiumGltf::AccessorView uvAccessor(model, uvAccessorID); + if (uvAccessor.status() != CesiumGltf::AccessorViewStatus::Valid) { return 0; } @@ -324,18 +324,21 @@ BuildChaosTriangleMeshes( const TArray& vertexData, const TArray& indices); -static const Material defaultMaterial; -static const MaterialPBRMetallicRoughness defaultPbrMetallicRoughness; +static const CesiumGltf::Material defaultMaterial; +static const CesiumGltf::MaterialPBRMetallicRoughness + defaultPbrMetallicRoughness; struct ColorVisitor { bool duplicateVertices; TArray& StaticMeshBuildVertices; const TArray& indices; - bool operator()(AccessorView&& invalidView) { return false; } + bool operator()(CesiumGltf::AccessorView&& invalidView) { + return false; + } template bool operator()(TColorView&& colorView) { - if (colorView.status() != AccessorViewStatus::Valid) { + if (colorView.status() != CesiumGltf::AccessorViewStatus::Valid) { return false; } @@ -366,8 +369,9 @@ struct ColorVisitor { } template - static bool - convertColor(const AccessorTypes::VEC3& color, FColor& out) { + static bool convertColor( + const CesiumGltf::AccessorTypes::VEC3& color, + FColor& out) { out.A = 255; return convertElement(color.value[0], out.R) && convertElement(color.value[1], out.G) && @@ -375,8 +379,9 @@ struct ColorVisitor { } template - static bool - convertColor(const AccessorTypes::VEC4& color, FColor& out) { + static bool convertColor( + const CesiumGltf::AccessorTypes::VEC4& color, + FColor& out) { return convertElement(color.value[0], out.R) && convertElement(color.value[1], out.G) && convertElement(color.value[2], out.B) && @@ -432,8 +437,8 @@ static TUniquePtr loadTexture( } static void applyWaterMask( - Model& model, - const MeshPrimitive& primitive, + CesiumGltf::Model& model, + const CesiumGltf::MeshPrimitive& primitive, LoadPrimitiveResult& primitiveResult) { // Initialize water mask if needed. auto onlyWaterIt = primitive.extras.find("OnlyWater"); @@ -452,7 +457,7 @@ static void applyWaterMask( waterMaskTextureIdIt->second.isInt64()) { int32_t waterMaskTextureId = static_cast( waterMaskTextureIdIt->second.getInt64OrDefault(-1)); - TextureInfo waterMaskInfo; + CesiumGltf::TextureInfo waterMaskInfo; waterMaskInfo.index = waterMaskTextureId; if (waterMaskTextureId >= 0 && waterMaskTextureId < model.textures.size()) { @@ -504,7 +509,7 @@ static bool hasMaterialTextureConflicts( const CesiumGltf::Material& material, int32_t imageIndex) { if (material.pbrMetallicRoughness) { - const std::optional& maybeBaseColorTexture = + const std::optional& maybeBaseColorTexture = material.pbrMetallicRoughness->baseColorTexture; if (maybeBaseColorTexture && textureUsesSpecifiedImage( model, @@ -513,8 +518,9 @@ static bool hasMaterialTextureConflicts( return true; } - const std::optional& maybeMetallicRoughnessTexture = - material.pbrMetallicRoughness->metallicRoughnessTexture; + const std::optional& + maybeMetallicRoughnessTexture = + material.pbrMetallicRoughness->metallicRoughnessTexture; if (maybeMetallicRoughnessTexture && textureUsesSpecifiedImage( model, @@ -554,8 +560,8 @@ static bool hasMaterialTextureConflicts( * without requiring UVs in the physics bodies. */ static void createTexCoordAccessorsForFeaturesMetadata( - const Model& model, - const MeshPrimitive& primitive, + const CesiumGltf::Model& model, + const CesiumGltf::MeshPrimitive& primitive, const FCesiumPrimitiveFeatures& primitiveFeatures, const FCesiumPrimitiveMetadata& primitiveMetadata, const FCesiumModelMetadata& modelMetadata, @@ -626,8 +632,8 @@ static void createTexCoordAccessorsForFeaturesMetadata( * coordinates for attribute and implicit feature ID sets. */ static void updateTextureCoordinatesForFeaturesMetadata( - const Model& model, - const MeshPrimitive& primitive, + const CesiumGltf::Model& model, + const CesiumGltf::MeshPrimitive& primitive, bool duplicateVertices, TArray& vertices, const TArray& indices, @@ -789,8 +795,8 @@ static void updateTextureCoordinatesForFeaturesMetadata( PRAGMA_DISABLE_DEPRECATION_WARNINGS static void updateTextureCoordinatesForMetadata_DEPRECATED( - const Model& model, - const MeshPrimitive& primitive, + const CesiumGltf::Model& model, + const CesiumGltf::MeshPrimitive& primitive, bool duplicateVertices, TArray& vertices, const TArray& indices, @@ -843,8 +849,8 @@ static void updateTextureCoordinatesForMetadata_DEPRECATED( } } - const ExtensionExtMeshFeatures* pFeatures = - primitive.getExtension(); + const CesiumGltf::ExtensionExtMeshFeatures* pFeatures = + primitive.getExtension(); if (pFeatures) { for (const CesiumEncodedMetadataUtility::EncodedFeatureIdAttribute& @@ -915,8 +921,8 @@ static void loadPrimitiveFeaturesMetadata( TArray& vertices, const TArray& indices) { - ExtensionExtMeshFeatures* pFeatures = - primitive.getExtension(); + CesiumGltf::ExtensionExtMeshFeatures* pFeatures = + primitive.getExtension(); if (pFeatures) { int32_t materialIndex = primitive.material; @@ -954,8 +960,9 @@ static void loadPrimitiveFeaturesMetadata( } } - const ExtensionMeshPrimitiveExtStructuralMetadata* pMetadata = - primitive.getExtension(); + const CesiumGltf::ExtensionMeshPrimitiveExtStructuralMetadata* pMetadata = + primitive.getExtension< + CesiumGltf::ExtensionMeshPrimitiveExtStructuralMetadata>(); const CreateGltfOptions::CreateModelOptions* pModelOptions = options.pMeshOptions->pNodeOptions->pModelOptions; @@ -1129,20 +1136,22 @@ static void loadPrimitive( LoadPrimitiveResult& primitiveResult, const glm::dmat4x4& transform, const CreatePrimitiveOptions& options, - const Accessor& positionAccessor, - const AccessorView& positionView, + const CesiumGltf::Accessor& positionAccessor, + const CesiumGltf::AccessorView& positionView, const TIndexAccessor& indicesView, const CesiumGeospatial::Ellipsoid& ellipsoid) { TRACE_CPUPROFILER_EVENT_SCOPE(Cesium::loadPrimitive) - Model& model = *options.pMeshOptions->pNodeOptions->pModelOptions->pModel; - Mesh& mesh = model.meshes[options.pMeshOptions->meshIndex]; - MeshPrimitive& primitive = mesh.primitives[options.primitiveIndex]; + CesiumGltf::Model& model = + *options.pMeshOptions->pNodeOptions->pModelOptions->pModel; + CesiumGltf::Mesh& mesh = model.meshes[options.pMeshOptions->meshIndex]; + CesiumGltf::MeshPrimitive& primitive = + mesh.primitives[options.primitiveIndex]; - if (primitive.mode != MeshPrimitive::Mode::TRIANGLES && - primitive.mode != MeshPrimitive::Mode::TRIANGLE_STRIP && - primitive.mode != MeshPrimitive::Mode::POINTS) { + if (primitive.mode != CesiumGltf::MeshPrimitive::Mode::TRIANGLES && + primitive.mode != CesiumGltf::MeshPrimitive::Mode::TRIANGLE_STRIP && + primitive.mode != CesiumGltf::MeshPrimitive::Mode::POINTS) { // TODO: add support for other primitive types. UE_LOG( LogCesium, @@ -1163,7 +1172,9 @@ static void loadPrimitive( auto meshIt = std::find_if( model.meshes.begin(), model.meshes.end(), - [&mesh](const Mesh& candidate) { return &candidate == &mesh; }); + [&mesh](const CesiumGltf::Mesh& candidate) { + return &candidate == &mesh; + }); if (meshIt != model.meshes.end()) { int64_t meshIndex = meshIt - model.meshes.begin(); name += " mesh " + std::to_string(meshIndex); @@ -1172,7 +1183,7 @@ static void loadPrimitive( auto primitiveIt = std::find_if( mesh.primitives.begin(), mesh.primitives.end(), - [&primitive](const MeshPrimitive& candidate) { + [&primitive](const CesiumGltf::MeshPrimitive& candidate) { return &candidate == &primitive; }); if (primitiveIt != mesh.primitives.end()) { @@ -1182,7 +1193,7 @@ static void loadPrimitive( primitiveResult.name = name; - if (positionView.status() != AccessorViewStatus::Valid) { + if (positionView.status() != CesiumGltf::AccessorViewStatus::Valid) { UE_LOG( LogCesium, Warning, @@ -1192,7 +1203,7 @@ static void loadPrimitive( } if constexpr (IsAccessorView::value) { - if (indicesView.status() != AccessorViewStatus::Valid) { + if (indicesView.status() != CesiumGltf::AccessorViewStatus::Valid) { UE_LOG( LogCesium, Warning, @@ -1203,12 +1214,14 @@ static void loadPrimitive( } auto normalAccessorIt = primitive.attributes.find("NORMAL"); - AccessorView normalAccessor; + CesiumGltf::AccessorView normalAccessor; bool hasNormals = false; if (normalAccessorIt != primitive.attributes.end()) { int normalAccessorID = normalAccessorIt->second; - normalAccessor = AccessorView(model, normalAccessorID); - hasNormals = normalAccessor.status() == AccessorViewStatus::Valid; + normalAccessor = + CesiumGltf::AccessorView(model, normalAccessorID); + hasNormals = + normalAccessor.status() == CesiumGltf::AccessorViewStatus::Valid; if (!hasNormals) { UE_LOG( LogCesium, @@ -1220,7 +1233,7 @@ static void loadPrimitive( } int materialID = primitive.material; - const Material& material = + const CesiumGltf::Material& material = materialID >= 0 && materialID < model.materials.size() ? model.materials[materialID] : defaultMaterial; @@ -1228,31 +1241,34 @@ static void loadPrimitive( primitiveResult.materialIndex = materialID; primitiveResult.isUnlit = - material.hasExtension() && + material.hasExtension() && !options.pMeshOptions->pNodeOptions->pModelOptions ->ignoreKhrMaterialsUnlit; // We can't calculate flat normals for points or lines, so we have to force // them to be unlit if no normals are specified. Otherwise this causes a // crash when attempting to calculate flat normals. - bool isTriangles = primitive.mode == MeshPrimitive::Mode::TRIANGLES || - primitive.mode == MeshPrimitive::Mode::TRIANGLE_FAN || - primitive.mode == MeshPrimitive::Mode::TRIANGLE_STRIP; + bool isTriangles = + primitive.mode == CesiumGltf::MeshPrimitive::Mode::TRIANGLES || + primitive.mode == CesiumGltf::MeshPrimitive::Mode::TRIANGLE_FAN || + primitive.mode == CesiumGltf::MeshPrimitive::Mode::TRIANGLE_STRIP; if (!isTriangles && !hasNormals) { primitiveResult.isUnlit = true; } - const MaterialPBRMetallicRoughness& pbrMetallicRoughness = + const CesiumGltf::MaterialPBRMetallicRoughness& pbrMetallicRoughness = material.pbrMetallicRoughness ? material.pbrMetallicRoughness.value() : defaultPbrMetallicRoughness; bool hasNormalMap = material.normalTexture.has_value(); if (hasNormalMap) { - const CesiumGltf::Texture* pTexture = - Model::getSafe(&model.textures, material.normalTexture->index); - hasNormalMap = pTexture != nullptr && - Model::getSafe(&model.images, pTexture->source) != nullptr; + const CesiumGltf::Texture* pTexture = CesiumGltf::Model::getSafe( + &model.textures, + material.normalTexture->index); + hasNormalMap = + pTexture != nullptr && + CesiumGltf::Model::getSafe(&model.images, pTexture->source) != nullptr; } bool needsTangents = @@ -1261,11 +1277,13 @@ static void loadPrimitive( bool hasTangents = false; auto tangentAccessorIt = primitive.attributes.find("TANGENT"); - AccessorView tangentAccessor; + CesiumGltf::AccessorView tangentAccessor; if (tangentAccessorIt != primitive.attributes.end()) { int tangentAccessorID = tangentAccessorIt->second; - tangentAccessor = AccessorView(model, tangentAccessorID); - hasTangents = tangentAccessor.status() == AccessorViewStatus::Valid; + tangentAccessor = + CesiumGltf::AccessorView(model, tangentAccessorID); + hasTangents = + tangentAccessor.status() == CesiumGltf::AccessorViewStatus::Valid; if (!hasTangents) { UE_LOG( LogCesium, @@ -1328,8 +1346,8 @@ static void loadPrimitive( } TArray indices; - if (primitive.mode == MeshPrimitive::Mode::TRIANGLES || - primitive.mode == MeshPrimitive::Mode::POINTS) { + if (primitive.mode == CesiumGltf::MeshPrimitive::Mode::TRIANGLES || + primitive.mode == CesiumGltf::MeshPrimitive::Mode::POINTS) { TRACE_CPUPROFILER_EVENT_SCOPE(Cesium::CopyIndices) indices.SetNum(static_cast::SizeType>(indicesView.size())); @@ -1363,8 +1381,8 @@ static void loadPrimitive( bool needToGenerateFlatNormals = normalsAreRequired && !hasNormals; bool needToGenerateTangents = needsTangents && !hasTangents; bool duplicateVertices = needToGenerateFlatNormals || needToGenerateTangents; - duplicateVertices = - duplicateVertices && primitive.mode != MeshPrimitive::Mode::POINTS; + duplicateVertices = duplicateVertices && + primitive.mode != CesiumGltf::MeshPrimitive::Mode::POINTS; TArray StaticMeshBuildVertices; StaticMeshBuildVertices.SetNum( @@ -1672,7 +1690,8 @@ static void loadPrimitive( section.FirstIndex = 0; section.MinVertexIndex = 0; section.MaxVertexIndex = StaticMeshBuildVertices.Num() - 1; - section.bEnableCollision = primitive.mode != MeshPrimitive::Mode::POINTS; + section.bEnableCollision = + primitive.mode != CesiumGltf::MeshPrimitive::Mode::POINTS; section.bCastShadow = true; section.MaterialIndex = 0; @@ -1703,7 +1722,7 @@ static void loadPrimitive( primitiveResult.transform = transform * yInvertMatrix * scaleMatrix; - if (primitive.mode != MeshPrimitive::Mode::POINTS && + if (primitive.mode != CesiumGltf::MeshPrimitive::Mode::POINTS && options.pMeshOptions->pNodeOptions->pModelOptions->createPhysicsMeshes) { if (StaticMeshBuildVertices.Num() != 0 && indices.Num() != 0) { TRACE_CPUPROFILER_EVENT_SCOPE(Cesium::ChaosCook) @@ -1723,18 +1742,20 @@ static void loadIndexedPrimitive( LoadPrimitiveResult& primitiveResult, const glm::dmat4x4& transform, const CreatePrimitiveOptions& options, - const Accessor& positionAccessor, - const AccessorView& positionView, + const CesiumGltf::Accessor& positionAccessor, + const CesiumGltf::AccessorView& positionView, const CesiumGeospatial::Ellipsoid& ellipsoid) { - const Model& model = + const CesiumGltf::Model& model = *options.pMeshOptions->pNodeOptions->pModelOptions->pModel; - const MeshPrimitive& primitive = model.meshes[options.pMeshOptions->meshIndex] - .primitives[options.primitiveIndex]; + const CesiumGltf::MeshPrimitive& primitive = + model.meshes[options.pMeshOptions->meshIndex] + .primitives[options.primitiveIndex]; - const Accessor& indexAccessorGltf = model.accessors[primitive.indices]; + const CesiumGltf::Accessor& indexAccessorGltf = + model.accessors[primitive.indices]; if (indexAccessorGltf.componentType == - Accessor::ComponentType::UNSIGNED_BYTE) { - AccessorView indexAccessor(model, primitive.indices); + CesiumGltf::Accessor::ComponentType::UNSIGNED_BYTE) { + CesiumGltf::AccessorView indexAccessor(model, primitive.indices); loadPrimitive( primitiveResult, transform, @@ -1746,8 +1767,8 @@ static void loadIndexedPrimitive( primitiveResult.IndexAccessor = indexAccessor; } else if ( indexAccessorGltf.componentType == - Accessor::ComponentType::UNSIGNED_SHORT) { - AccessorView indexAccessor(model, primitive.indices); + CesiumGltf::Accessor::ComponentType::UNSIGNED_SHORT) { + CesiumGltf::AccessorView indexAccessor(model, primitive.indices); loadPrimitive( primitiveResult, transform, @@ -1759,8 +1780,8 @@ static void loadIndexedPrimitive( primitiveResult.IndexAccessor = indexAccessor; } else if ( indexAccessorGltf.componentType == - Accessor::ComponentType::UNSIGNED_INT) { - AccessorView indexAccessor(model, primitive.indices); + CesiumGltf::Accessor::ComponentType::UNSIGNED_INT) { + CesiumGltf::AccessorView indexAccessor(model, primitive.indices); loadPrimitive( primitiveResult, transform, @@ -1787,10 +1808,11 @@ static void loadPrimitive( const CesiumGeospatial::Ellipsoid& ellipsoid) { TRACE_CPUPROFILER_EVENT_SCOPE(Cesium::loadPrimitive) - const Model& model = + const CesiumGltf::Model& model = *options.pMeshOptions->pNodeOptions->pModelOptions->pModel; - const MeshPrimitive& primitive = model.meshes[options.pMeshOptions->meshIndex] - .primitives[options.primitiveIndex]; + const CesiumGltf::MeshPrimitive& primitive = + model.meshes[options.pMeshOptions->meshIndex] + .primitives[options.primitiveIndex]; auto positionAccessorIt = primitive.attributes.find("POSITION"); if (positionAccessorIt == primitive.attributes.end()) { @@ -1799,14 +1821,16 @@ static void loadPrimitive( } int positionAccessorID = positionAccessorIt->second; - const Accessor* pPositionAccessor = - Model::getSafe(&model.accessors, positionAccessorID); + const CesiumGltf::Accessor* pPositionAccessor = + CesiumGltf::Model::getSafe(&model.accessors, positionAccessorID); if (!pPositionAccessor) { // Position accessor does not exist, so ignore this primitive. return; } - AccessorView positionView(model, *pPositionAccessor); + CesiumGltf::AccessorView positionView( + model, + *pPositionAccessor); if (primitive.indices < 0 || primitive.indices >= model.accessors.size()) { std::vector syntheticIndexBuffer(positionView.size()); @@ -1842,8 +1866,8 @@ static void loadMesh( TRACE_CPUPROFILER_EVENT_SCOPE(Cesium::loadMesh) - Model& model = *options.pNodeOptions->pModelOptions->pModel; - Mesh& mesh = model.meshes[options.meshIndex]; + CesiumGltf::Model& model = *options.pNodeOptions->pModelOptions->pModel; + CesiumGltf::Mesh& mesh = model.meshes[options.meshIndex]; result = LoadMeshResult(); result->primitiveResults.reserve(mesh.primitives.size()); @@ -1882,19 +1906,20 @@ inline constexpr bool is_int_quat_v = is_int_quat::value; } // namespace static void loadInstancingData( - const Model& model, + const CesiumGltf::Model& model, LoadNodeResult& result, - const ExtensionExtMeshGpuInstancing* pGpuInstancing) { - auto getInstanceAccessor = [&](const char* name) -> const Accessor* { + const CesiumGltf::ExtensionExtMeshGpuInstancing* pGpuInstancing) { + auto getInstanceAccessor = + [&](const char* name) -> const CesiumGltf::Accessor* { if (auto accessorItr = pGpuInstancing->attributes.find(name); accessorItr != pGpuInstancing->attributes.end()) { - return Model::getSafe(&model.accessors, accessorItr->second); + return CesiumGltf::Model::getSafe(&model.accessors, accessorItr->second); } return nullptr; }; - const Accessor* translations = getInstanceAccessor("TRANSLATION"); - const Accessor* rotations = getInstanceAccessor("ROTATION"); - const Accessor* scales = getInstanceAccessor("SCALE"); + const CesiumGltf::Accessor* translations = getInstanceAccessor("TRANSLATION"); + const CesiumGltf::Accessor* rotations = getInstanceAccessor("ROTATION"); + const CesiumGltf::Accessor* scales = getInstanceAccessor("SCALE"); int64_t count = 0; if (translations) { @@ -1945,8 +1970,10 @@ static void loadInstancingData( // argument by the new transform. E.g., translate() does *not* translate the // matrix. if (translations) { - AccessorView translationAccessor(model, *translations); - if (translationAccessor.status() == AccessorViewStatus::Valid) { + CesiumGltf::AccessorView translationAccessor( + model, + *translations); + if (translationAccessor.status() == CesiumGltf::AccessorViewStatus::Valid) { for (int64_t i = 0; i < count; ++i) { glm::dvec3 translation(translationAccessor[i]); instanceTransforms[i] = glm::translate( @@ -1986,7 +2013,7 @@ static void loadInstancingData( }); } if (scales) { - AccessorView scaleAccessor(model, *scales); + CesiumGltf::AccessorView scaleAccessor(model, *scales); for (int64_t i = 0; i < count; ++i) { glm::dvec3 scaleFactors(scaleAccessor[i]); instanceTransforms[i] = glm::scale(instanceTransforms[i], scaleFactors); @@ -2029,8 +2056,8 @@ static void loadNode( 0.0, 1.0}; - Model& model = *options.pModelOptions->pModel; - const Node& node = *options.pNode; + CesiumGltf::Model& model = *options.pModelOptions->pModel; + const CesiumGltf::Node& node = *options.pNode; LoadNodeResult& result = loadNodeResults.emplace_back(); @@ -2083,7 +2110,7 @@ static void loadNode( int meshId = node.mesh; if (meshId >= 0 && meshId < model.meshes.size()) { if (const auto* pGpuInstancingExtension = - node.getExtension()) { + node.getExtension()) { loadInstancingData(model, result, pGpuInstancingExtension); } CreateMeshOptions meshOptions = {&options, &result, meshId}; @@ -2119,7 +2146,9 @@ namespace { * @param model The glTF model * @param rootTransform The matrix that will be multiplied with the transform */ -void applyGltfUpAxisTransform(const Model& model, glm::dmat4x4& rootTransform) { +void applyGltfUpAxisTransform( + const CesiumGltf::Model& model, + glm::dmat4x4& rootTransform) { auto gltfUpAxisIt = model.extras.find("gltfUpAxis"); if (gltfUpAxisIt == model.extras.end()) { @@ -2150,10 +2179,10 @@ void applyGltfUpAxisTransform(const Model& model, glm::dmat4x4& rootTransform) { static void loadModelMetadata(LoadModelResult& result, const CreateModelOptions& options) { - Model& model = *options.pModel; + CesiumGltf::Model& model = *options.pModel; - ExtensionModelExtStructuralMetadata* pModelMetadata = - model.getExtension(); + CesiumGltf::ExtensionModelExtStructuralMetadata* pModelMetadata = + model.getExtension(); if (!pModelMetadata) { return; } @@ -2166,9 +2195,9 @@ loadModelMetadata(LoadModelResult& result, const CreateModelOptions& options) { CesiumGltf::Mesh& /*mesh*/, CesiumGltf::MeshPrimitive& primitive, const glm::dmat4& /*nodeTransform*/) { - const ExtensionMeshPrimitiveExtStructuralMetadata* pPrimitiveMetadata = - primitive - .getExtension(); + const CesiumGltf::ExtensionMeshPrimitiveExtStructuralMetadata* + pPrimitiveMetadata = primitive.getExtension< + CesiumGltf::ExtensionMeshPrimitiveExtStructuralMetadata>(); if (!pPrimitiveMetadata) { return; } @@ -2257,7 +2286,7 @@ loadModelAnyThreadPart( glm::dmat4x4 rootTransform = transform; - Model& model = *options.pModel; + CesiumGltf::Model& model = *options.pModel; { rootTransform = CesiumGltfContent::GltfUtilities::applyRtcCenter( @@ -2268,7 +2297,7 @@ loadModelAnyThreadPart( if (model.scene >= 0 && model.scene < model.scenes.size()) { // Show the default scene - const Scene& defaultScene = model.scenes[model.scene]; + const CesiumGltf::Scene& defaultScene = model.scenes[model.scene]; for (int nodeId : defaultScene.nodes) { CreateNodeOptions nodeOptions = { &options, @@ -2282,7 +2311,7 @@ loadModelAnyThreadPart( } } else if (model.scenes.size() > 0) { // There's no default, so show the first scene - const Scene& defaultScene = model.scenes[0]; + const CesiumGltf::Scene& defaultScene = model.scenes[0]; for (int nodeId : defaultScene.nodes) { CreateNodeOptions nodeOptions = { &options, @@ -2358,8 +2387,8 @@ bool applyTexture( static void SetGltfParameterValues( CesiumGltf::Model& model, LoadPrimitiveResult& loadResult, - const Material& material, - const MaterialPBRMetallicRoughness& pbr, + const CesiumGltf::Material& material, + const CesiumGltf::MaterialPBRMetallicRoughness& pbr, UMaterialInstanceDynamic* pMaterial, EMaterialParameterAssociation association, int32 index) { @@ -2429,16 +2458,19 @@ static void SetGltfParameterValues( FMaterialParameterInfo("occlusionTexture", association, index), loadResult.occlusionTexture.Get()); - KhrTextureTransform textureTransform; + CesiumGltf::KhrTextureTransform textureTransform; FLinearColor baseColorMetallicRoughnessRotation(0.0f, 1.0f, 0.0f, 1.0f); - const ExtensionKhrTextureTransform* pBaseColorTextureTransform = + const CesiumGltf::ExtensionKhrTextureTransform* pBaseColorTextureTransform = pbr.baseColorTexture - ? pbr.baseColorTexture->getExtension() + ? pbr.baseColorTexture + ->getExtension() : nullptr; if (pBaseColorTextureTransform) { - textureTransform = KhrTextureTransform(*pBaseColorTextureTransform); - if (textureTransform.status() == KhrTextureTransformStatus::Valid) { + textureTransform = + CesiumGltf::KhrTextureTransform(*pBaseColorTextureTransform); + if (textureTransform.status() == + CesiumGltf::KhrTextureTransformStatus::Valid) { const glm::dvec2& scale = textureTransform.scale(); const glm::dvec2& offset = textureTransform.offset(); pMaterial->SetVectorParameterValueByInfo( @@ -2452,15 +2484,18 @@ static void SetGltfParameterValues( } } - const ExtensionKhrTextureTransform* pMetallicRoughnessTextureTransform = - pbr.metallicRoughnessTexture - ? pbr.metallicRoughnessTexture - ->getExtension() - : nullptr; + const CesiumGltf::ExtensionKhrTextureTransform* + pMetallicRoughnessTextureTransform = + pbr.metallicRoughnessTexture + ? pbr.metallicRoughnessTexture + ->getExtension() + : nullptr; if (pMetallicRoughnessTextureTransform) { - textureTransform = KhrTextureTransform(*pMetallicRoughnessTextureTransform); - if (textureTransform.status() == KhrTextureTransformStatus::Valid) { + textureTransform = + CesiumGltf::KhrTextureTransform(*pMetallicRoughnessTextureTransform); + if (textureTransform.status() == + CesiumGltf::KhrTextureTransformStatus::Valid) { const glm::dvec2& scale = textureTransform.scale(); const glm::dvec2& offset = textureTransform.offset(); pMaterial->SetVectorParameterValueByInfo( @@ -2488,14 +2523,15 @@ static void SetGltfParameterValues( FLinearColor emissiveNormalRotation(0.0f, 1.0f, 0.0f, 1.0f); - const ExtensionKhrTextureTransform* pEmissiveTextureTransform = + const CesiumGltf::ExtensionKhrTextureTransform* pEmissiveTextureTransform = material.emissiveTexture ? material.emissiveTexture - ->getExtension() + ->getExtension() : nullptr; if (pEmissiveTextureTransform) { - textureTransform = KhrTextureTransform(*pEmissiveTextureTransform); + textureTransform = + CesiumGltf::KhrTextureTransform(*pEmissiveTextureTransform); const glm::dvec2& scale = textureTransform.scale(); const glm::dvec2& offset = textureTransform.offset(); pMaterial->SetVectorParameterValueByInfo( @@ -2508,13 +2544,15 @@ static void SetGltfParameterValues( emissiveNormalRotation.G = rotationSineCosine[1]; } - const ExtensionKhrTextureTransform* pNormalTextureTransform = + const CesiumGltf::ExtensionKhrTextureTransform* pNormalTextureTransform = material.normalTexture - ? material.normalTexture->getExtension() + ? material.normalTexture + ->getExtension() : nullptr; if (pNormalTextureTransform) { - textureTransform = KhrTextureTransform(*pNormalTextureTransform); + textureTransform = + CesiumGltf::KhrTextureTransform(*pNormalTextureTransform); const glm::dvec2& scale = textureTransform.scale(); const glm::dvec2& offset = textureTransform.offset(); pMaterial->SetVectorParameterValueByInfo( @@ -2532,14 +2570,14 @@ static void SetGltfParameterValues( emissiveNormalRotation); } - const ExtensionKhrTextureTransform* pOcclusionTransform = + const CesiumGltf::ExtensionKhrTextureTransform* pOcclusionTransform = material.occlusionTexture ? material.occlusionTexture - ->getExtension() + ->getExtension() : nullptr; if (pOcclusionTransform) { - textureTransform = KhrTextureTransform(*pOcclusionTransform); + textureTransform = CesiumGltf::KhrTextureTransform(*pOcclusionTransform); const glm::dvec2& scale = textureTransform.scale(); const glm::dvec2& offset = textureTransform.offset(); pMaterial->SetVectorParameterValueByInfo( @@ -2847,12 +2885,12 @@ static void loadPrimitiveGameThreadPart( const Cesium3DTilesSelection::BoundingVolume& boundingVolume = tile.getContentBoundingVolume().value_or(tile.getBoundingVolume()); - MeshPrimitive& meshPrimitive = + CesiumGltf::MeshPrimitive& meshPrimitive = model.meshes[loadResult.meshIndex].primitives[loadResult.primitiveIndex]; UStaticMeshComponent* pMesh = nullptr; ICesiumPrimitive* pCesiumPrimitive = nullptr; - if (meshPrimitive.mode == MeshPrimitive::Mode::POINTS) { + if (meshPrimitive.mode == CesiumGltf::MeshPrimitive::Mode::POINTS) { UCesiumGltfPointsComponent* pPointMesh = NewObject(pGltf, componentName); pPointMesh->UsesAdditiveRefinement = @@ -2916,11 +2954,11 @@ static void loadPrimitiveGameThreadPart( pStaticMesh->SetRenderData(std::move(loadResult.RenderData)); } - const Material& material = loadResult.materialIndex != -1 - ? model.materials[loadResult.materialIndex] - : defaultMaterial; + const CesiumGltf::Material& material = + loadResult.materialIndex != -1 ? model.materials[loadResult.materialIndex] + : defaultMaterial; - const MaterialPBRMetallicRoughness& pbr = + const CesiumGltf::MaterialPBRMetallicRoughness& pbr = material.pbrMetallicRoughness ? material.pbrMetallicRoughness.value() : defaultPbrMetallicRoughness; diff --git a/Source/CesiumRuntime/Private/CesiumGltfTextures.cpp b/Source/CesiumRuntime/Private/CesiumGltfTextures.cpp index 2d94da1a4..d0787ccc6 100644 --- a/Source/CesiumRuntime/Private/CesiumGltfTextures.cpp +++ b/Source/CesiumRuntime/Private/CesiumGltfTextures.cpp @@ -11,12 +11,13 @@ #include using namespace CesiumAsync; -using namespace CesiumGltf; namespace { // Determines if a glTF primitive is usable for our purposes. -bool isValidPrimitive(const Model& gltf, const MeshPrimitive& primitive); +bool isValidPrimitive( + const CesiumGltf::Model& gltf, + const CesiumGltf::MeshPrimitive& primitive); // Determines if an Accessor's componentType is valid for an index buffer. bool isSupportedIndexComponentType(int32_t componentType); @@ -25,13 +26,15 @@ bool isSupportedIndexComponentType(int32_t componentType); bool isSupportedPrimitiveMode(int32_t primitiveMode); // Determines if the given texture uses mipmaps. -bool doesTextureUseMipmaps(const Model& gltf, const Texture& texture); +bool doesTextureUseMipmaps( + const CesiumGltf::Model& gltf, + const CesiumGltf::Texture& texture); // Creates a single texture in the load thread. SharedFuture createTextureInLoadThread( const AsyncSystem& asyncSystem, - Model& gltf, - TextureInfo& textureInfo, + CesiumGltf::Model& gltf, + CesiumGltf::TextureInfo& textureInfo, bool sRGB, const std::vector& imageNeedsMipmaps); @@ -44,7 +47,7 @@ SharedFuture createTextureInLoadThread( // requires mipmaps. An image requires mipmaps if any of its textures have a // sampler that will use them. std::vector imageNeedsMipmaps(model.images.size(), false); - for (const Texture& texture : model.textures) { + for (const CesiumGltf::Texture& texture : model.textures) { int32_t imageIndex = texture.source; if (imageIndex < 0 || imageIndex >= model.images.size()) { continue; @@ -60,17 +63,17 @@ SharedFuture createTextureInLoadThread( model.forEachPrimitiveInScene( -1, [&imageNeedsMipmaps, &asyncSystem, &futures]( - Model& gltf, - Node& node, - Mesh& mesh, - MeshPrimitive& primitive, + CesiumGltf::Model& gltf, + CesiumGltf::Node& node, + CesiumGltf::Mesh& mesh, + CesiumGltf::MeshPrimitive& primitive, const glm::dmat4& transform) { if (!isValidPrimitive(gltf, primitive)) { return; } - Material* pMaterial = - Model::getSafe(&gltf.materials, primitive.material); + CesiumGltf::Material* pMaterial = + CesiumGltf::Model::getSafe(&gltf.materials, primitive.material); if (!pMaterial) { // A primitive using the default material will not have any textures. return; @@ -134,7 +137,7 @@ SharedFuture createTextureInLoadThread( waterMaskTextureIdIt->second.isInt64()) { int32_t waterMaskTextureId = static_cast( waterMaskTextureIdIt->second.getInt64OrDefault(-1)); - TextureInfo waterMaskInfo; + CesiumGltf::TextureInfo waterMaskInfo; waterMaskInfo.index = waterMaskTextureId; if (waterMaskTextureId >= 0 && waterMaskTextureId < gltf.textures.size()) { @@ -156,15 +159,15 @@ SharedFuture createTextureInLoadThread( namespace { bool isSupportedIndexComponentType(int32_t componentType) { - return componentType == Accessor::ComponentType::UNSIGNED_BYTE || - componentType == Accessor::ComponentType::UNSIGNED_SHORT || - componentType == Accessor::ComponentType::UNSIGNED_INT; + return componentType == CesiumGltf::Accessor::ComponentType::UNSIGNED_BYTE || + componentType == CesiumGltf::Accessor::ComponentType::UNSIGNED_SHORT || + componentType == CesiumGltf::Accessor::ComponentType::UNSIGNED_INT; } bool isSupportedPrimitiveMode(int32_t primitiveMode) { - return primitiveMode == MeshPrimitive::Mode::TRIANGLES || - primitiveMode == MeshPrimitive::Mode::TRIANGLE_STRIP || - primitiveMode == MeshPrimitive::Mode::POINTS; + return primitiveMode == CesiumGltf::MeshPrimitive::Mode::TRIANGLES || + primitiveMode == CesiumGltf::MeshPrimitive::Mode::TRIANGLE_STRIP || + primitiveMode == CesiumGltf::MeshPrimitive::Mode::POINTS; } // Determines if a glTF primitive is usable for our purposes. @@ -177,21 +180,23 @@ bool isValidPrimitive( } auto positionAccessorIt = - primitive.attributes.find(VertexAttributeSemantics::POSITION); + primitive.attributes.find(CesiumGltf::VertexAttributeSemantics::POSITION); if (positionAccessorIt == primitive.attributes.end()) { // This primitive doesn't have a POSITION semantic, so it's not valid. return false; } - AccessorView positionView(gltf, positionAccessorIt->second); - if (positionView.status() != AccessorViewStatus::Valid) { + CesiumGltf::AccessorView positionView( + gltf, + positionAccessorIt->second); + if (positionView.status() != CesiumGltf::AccessorViewStatus::Valid) { // This primitive's POSITION accessor is invalid, so the primitive is not // valid. return false; } - const Accessor* pIndexAccessor = - Model::getSafe(&gltf.accessors, primitive.indices); + const CesiumGltf::Accessor* pIndexAccessor = + CesiumGltf::Model::getSafe(&gltf.accessors, primitive.indices); if (pIndexAccessor && !isSupportedIndexComponentType(pIndexAccessor->componentType)) { // This primitive's indices are not a supported type, so the primitive is @@ -202,8 +207,11 @@ bool isValidPrimitive( return true; } -bool doesTextureUseMipmaps(const Model& gltf, const Texture& texture) { - const Sampler& sampler = Model::getSafe(gltf.samplers, texture.sampler); +bool doesTextureUseMipmaps( + const CesiumGltf::Model& gltf, + const CesiumGltf::Texture& texture) { + const CesiumGltf::Sampler& sampler = + CesiumGltf::Model::getSafe(gltf.samplers, texture.sampler); switch (sampler.minFilter.value_or( CesiumGltf::Sampler::MinFilter::LINEAR_MIPMAP_LINEAR)) { @@ -219,15 +227,17 @@ bool doesTextureUseMipmaps(const Model& gltf, const Texture& texture) { SharedFuture createTextureInLoadThread( const AsyncSystem& asyncSystem, - Model& gltf, - TextureInfo& textureInfo, + CesiumGltf::Model& gltf, + CesiumGltf::TextureInfo& textureInfo, bool sRGB, const std::vector& imageNeedsMipmaps) { - Texture* pTexture = Model::getSafe(&gltf.textures, textureInfo.index); + CesiumGltf::Texture* pTexture = + CesiumGltf::Model::getSafe(&gltf.textures, textureInfo.index); if (pTexture == nullptr) return asyncSystem.createResolvedFuture().share(); - Image* pImage = Model::getSafe(&gltf.images, pTexture->source); + CesiumGltf::Image* pImage = + CesiumGltf::Model::getSafe(&gltf.images, pTexture->source); if (pImage == nullptr) return asyncSystem.createResolvedFuture().share(); diff --git a/Source/CesiumRuntime/Private/Tests/CesiumFeatureIdAttribute.spec.cpp b/Source/CesiumRuntime/Private/Tests/CesiumFeatureIdAttribute.spec.cpp index c2b283985..4cb47a251 100644 --- a/Source/CesiumRuntime/Private/Tests/CesiumFeatureIdAttribute.spec.cpp +++ b/Source/CesiumRuntime/Private/Tests/CesiumFeatureIdAttribute.spec.cpp @@ -5,22 +5,20 @@ #include "CesiumGltfSpecUtility.h" #include "Misc/AutomationTest.h" -using namespace CesiumGltf; - BEGIN_DEFINE_SPEC( FCesiumFeatureIdAttributeSpec, "Cesium.Unit.FeatureIdAttribute", EAutomationTestFlags::ApplicationContextMask | EAutomationTestFlags::ProductFilter) -Model model; -MeshPrimitive* pPrimitive; +CesiumGltf::Model model; +CesiumGltf::MeshPrimitive* pPrimitive; END_DEFINE_SPEC(FCesiumFeatureIdAttributeSpec) void FCesiumFeatureIdAttributeSpec::Define() { Describe("Constructor", [this]() { BeforeEach([this]() { - model = Model(); - Mesh& mesh = model.meshes.emplace_back(); + model = CesiumGltf::Model(); + CesiumGltf::Mesh& mesh = model.meshes.emplace_back(); pPrimitive = &mesh.primitives.emplace_back(); }); @@ -76,9 +74,10 @@ void FCesiumFeatureIdAttributeSpec::Define() { It("constructs invalid instance for attribute with invalid accessor", [this]() { - Accessor& accessor = model.accessors.emplace_back(); - accessor.type = AccessorSpec::Type::VEC2; - accessor.componentType = AccessorSpec::ComponentType::FLOAT; + CesiumGltf::Accessor& accessor = model.accessors.emplace_back(); + accessor.type = CesiumGltf::AccessorSpec::Type::VEC2; + accessor.componentType = + CesiumGltf::AccessorSpec::ComponentType::FLOAT; const int64 attributeIndex = 0; pPrimitive->attributes.insert({"_FEATURE_ID_0", 0}); @@ -127,8 +126,8 @@ void FCesiumFeatureIdAttributeSpec::Define() { Describe("GetVertexCount", [this]() { BeforeEach([this]() { - model = Model(); - Mesh& mesh = model.meshes.emplace_back(); + model = CesiumGltf::Model(); + CesiumGltf::Mesh& mesh = model.meshes.emplace_back(); pPrimitive = &mesh.primitives.emplace_back(); }); @@ -184,8 +183,8 @@ void FCesiumFeatureIdAttributeSpec::Define() { Describe("GetFeatureIDForVertex", [this]() { BeforeEach([this]() { - model = Model(); - Mesh& mesh = model.meshes.emplace_back(); + model = CesiumGltf::Model(); + CesiumGltf::Mesh& mesh = model.meshes.emplace_back(); pPrimitive = &mesh.primitives.emplace_back(); }); diff --git a/Source/CesiumRuntime/Private/Tests/CesiumFeatureIdSet.spec.cpp b/Source/CesiumRuntime/Private/Tests/CesiumFeatureIdSet.spec.cpp index e44678a02..881fe1d0c 100644 --- a/Source/CesiumRuntime/Private/Tests/CesiumFeatureIdSet.spec.cpp +++ b/Source/CesiumRuntime/Private/Tests/CesiumFeatureIdSet.spec.cpp @@ -7,31 +7,29 @@ #include "CesiumGltfSpecUtility.h" #include "Misc/AutomationTest.h" -using namespace CesiumGltf; - BEGIN_DEFINE_SPEC( FCesiumFeatureIdSetSpec, "Cesium.Unit.FeatureIdSet", EAutomationTestFlags::ApplicationContextMask | EAutomationTestFlags::ProductFilter) -Model model; -MeshPrimitive* pPrimitive; +CesiumGltf::Model model; +CesiumGltf::MeshPrimitive* pPrimitive; TObjectPtr pPrimitiveComponent; END_DEFINE_SPEC(FCesiumFeatureIdSetSpec) void FCesiumFeatureIdSetSpec::Define() { Describe("Constructor", [this]() { BeforeEach([this]() { - model = Model(); - Mesh& mesh = model.meshes.emplace_back(); + model = CesiumGltf::Model(); + CesiumGltf::Mesh& mesh = model.meshes.emplace_back(); pPrimitive = &mesh.primitives.emplace_back(); - pPrimitive->addExtension(); + pPrimitive->addExtension(); }); It("constructs from empty feature ID set", [this]() { // This is technically disallowed by the spec, but just make sure it's // handled reasonably. - FeatureId featureId; + CesiumGltf::FeatureId featureId; FCesiumFeatureIdSet featureIDSet(model, *pPrimitive, featureId); TestEqual( @@ -46,7 +44,7 @@ void FCesiumFeatureIdSetSpec::Define() { }); It("constructs implicit feature ID set", [this]() { - FeatureId featureId; + CesiumGltf::FeatureId featureId; featureId.featureCount = 10; FCesiumFeatureIdSet featureIDSet(model, *pPrimitive, featureId); @@ -64,7 +62,7 @@ void FCesiumFeatureIdSetSpec::Define() { It("constructs set with feature ID attribute", [this]() { const int64 attributeIndex = 0; const std::vector featureIDs{0, 0, 0, 1, 1, 1}; - FeatureId& featureID = AddFeatureIDsAsAttributeToModel( + CesiumGltf::FeatureId& featureID = AddFeatureIDsAsAttributeToModel( model, *pPrimitive, featureIDs, @@ -91,7 +89,7 @@ void FCesiumFeatureIdSetSpec::Define() { glm::vec2(0, 0.5), glm::vec2(0.5, 0.5)}; - FeatureId& featureId = AddFeatureIDsAsTextureToModel( + CesiumGltf::FeatureId& featureId = AddFeatureIDsAsTextureToModel( model, *pPrimitive, featureIDs, @@ -114,7 +112,7 @@ void FCesiumFeatureIdSetSpec::Define() { }); It("constructs with null feature ID", [this]() { - FeatureId featureId; + CesiumGltf::FeatureId featureId; featureId.featureCount = 10; featureId.nullFeatureId = 0; @@ -135,7 +133,7 @@ void FCesiumFeatureIdSetSpec::Define() { }); It("constructs with property table index", [this]() { - FeatureId featureId; + CesiumGltf::FeatureId featureId; featureId.featureCount = 10; featureId.propertyTable = 1; @@ -159,13 +157,13 @@ void FCesiumFeatureIdSetSpec::Define() { Describe("GetAsFeatureIDAttribute", [this]() { BeforeEach([this]() { - model = Model(); - Mesh& mesh = model.meshes.emplace_back(); + model = CesiumGltf::Model(); + CesiumGltf::Mesh& mesh = model.meshes.emplace_back(); pPrimitive = &mesh.primitives.emplace_back(); }); It("returns empty instance for non-attribute feature ID set", [this]() { - FeatureId featureId; + CesiumGltf::FeatureId featureId; featureId.featureCount = 10; FCesiumFeatureIdSet featureIDSet(model, *pPrimitive, featureId); @@ -183,7 +181,7 @@ void FCesiumFeatureIdSetSpec::Define() { It("returns valid instance for attribute feature ID set", [this]() { const int64 attributeIndex = 0; const std::vector featureIDs{0, 0, 0, 1, 1, 1}; - FeatureId& featureID = AddFeatureIDsAsAttributeToModel( + CesiumGltf::FeatureId& featureID = AddFeatureIDsAsAttributeToModel( model, *pPrimitive, featureIDs, @@ -208,13 +206,13 @@ void FCesiumFeatureIdSetSpec::Define() { Describe("GetAsFeatureIDTexture", [this]() { BeforeEach([this]() { - model = Model(); - Mesh& mesh = model.meshes.emplace_back(); + model = CesiumGltf::Model(); + CesiumGltf::Mesh& mesh = model.meshes.emplace_back(); pPrimitive = &mesh.primitives.emplace_back(); }); It("returns empty instance for non-texture feature ID set", [this]() { - FeatureId featureId; + CesiumGltf::FeatureId featureId; featureId.featureCount = 10; FCesiumFeatureIdSet featureIDSet(model, *pPrimitive, featureId); @@ -231,7 +229,7 @@ void FCesiumFeatureIdSetSpec::Define() { TestEqual( "FeatureIDTextureViewStatus", featureIDTextureView.status(), - FeatureIdTextureViewStatus::ErrorUninitialized); + CesiumGltf::FeatureIdTextureViewStatus::ErrorUninitialized); }); It("returns valid instance for texture feature ID set", [this]() { @@ -242,7 +240,7 @@ void FCesiumFeatureIdSetSpec::Define() { glm::vec2(0, 0.5), glm::vec2(0.5, 0.5)}; - FeatureId& featureId = AddFeatureIDsAsTextureToModel( + CesiumGltf::FeatureId& featureId = AddFeatureIDsAsTextureToModel( model, *pPrimitive, featureIDs, @@ -266,14 +264,14 @@ void FCesiumFeatureIdSetSpec::Define() { TestEqual( "FeatureIDTextureViewStatus", featureIDTextureView.status(), - FeatureIdTextureViewStatus::Valid); + CesiumGltf::FeatureIdTextureViewStatus::Valid); }); }); Describe("GetFeatureIDForVertex", [this]() { BeforeEach([this]() { - model = Model(); - Mesh& mesh = model.meshes.emplace_back(); + model = CesiumGltf::Model(); + CesiumGltf::Mesh& mesh = model.meshes.emplace_back(); pPrimitive = &mesh.primitives.emplace_back(); }); @@ -288,7 +286,7 @@ void FCesiumFeatureIdSetSpec::Define() { }); It("returns -1 for out of bounds index", [this]() { - FeatureId featureId; + CesiumGltf::FeatureId featureId; featureId.featureCount = 10; FCesiumFeatureIdSet featureIDSet(model, *pPrimitive, featureId); @@ -307,7 +305,7 @@ void FCesiumFeatureIdSetSpec::Define() { }); It("returns correct value for implicit set", [this]() { - FeatureId featureId; + CesiumGltf::FeatureId featureId; featureId.featureCount = 10; FCesiumFeatureIdSet featureIDSet(model, *pPrimitive, featureId); @@ -324,7 +322,7 @@ void FCesiumFeatureIdSetSpec::Define() { It("returns correct value for attribute set", [this]() { const int64 attributeIndex = 0; const std::vector featureIDs{0, 0, 0, 1, 1, 1}; - FeatureId& featureID = AddFeatureIDsAsAttributeToModel( + CesiumGltf::FeatureId& featureID = AddFeatureIDsAsAttributeToModel( model, *pPrimitive, featureIDs, @@ -350,7 +348,7 @@ void FCesiumFeatureIdSetSpec::Define() { glm::vec2(0, 0.5), glm::vec2(0.5, 0.5)}; - FeatureId& featureID = AddFeatureIDsAsTextureToModel( + CesiumGltf::FeatureId& featureID = AddFeatureIDsAsTextureToModel( model, *pPrimitive, featureIDs, @@ -374,8 +372,8 @@ void FCesiumFeatureIdSetSpec::Define() { Describe("GetFeatureIDFromHit", [this]() { BeforeEach([this]() { - model = Model(); - Mesh& mesh = model.meshes.emplace_back(); + model = CesiumGltf::Model(); + CesiumGltf::Mesh& mesh = model.meshes.emplace_back(); pPrimitive = &mesh.primitives.emplace_back(); pPrimitive->mode = CesiumGltf::MeshPrimitive::Mode::TRIANGLES; pPrimitiveComponent = NewObject(); @@ -394,8 +392,8 @@ void FCesiumFeatureIdSetSpec::Define() { model, *pPrimitive, "POSITION", - AccessorSpec::Type::VEC3, - AccessorSpec::ComponentType::FLOAT, + CesiumGltf::AccessorSpec::Type::VEC3, + CesiumGltf::AccessorSpec::ComponentType::FLOAT, positions); }); @@ -410,7 +408,7 @@ void FCesiumFeatureIdSetSpec::Define() { }); It("returns -1 for invalid hit component", [this]() { - FeatureId featureId; + CesiumGltf::FeatureId featureId; featureId.featureCount = 6; CesiumPrimitiveData& primData = pPrimitiveComponent->getPrimitiveData(); primData.PositionAccessor = CesiumGltf::AccessorView( @@ -446,7 +444,7 @@ void FCesiumFeatureIdSetSpec::Define() { glm::vec2(0, 1), glm::vec2(1, 0)}; const std::vector featureIDs{0, 3, 1, 2}; - FeatureId& featureID = AddFeatureIDsAsTextureToModel( + CesiumGltf::FeatureId& featureID = AddFeatureIDsAsTextureToModel( model, *pPrimitive, featureIDs, @@ -461,7 +459,7 @@ void FCesiumFeatureIdSetSpec::Define() { CesiumGltf::AccessorView(model, positionAccessorIndex); primData.TexCoordAccessorMap.emplace( 0, - AccessorView>( + CesiumGltf::AccessorView>( model, static_cast(model.accessors.size() - 1))); @@ -489,7 +487,7 @@ void FCesiumFeatureIdSetSpec::Define() { }); It("returns correct value for implicit set", [this]() { - FeatureId featureId; + CesiumGltf::FeatureId featureId; featureId.featureCount = 6; CesiumPrimitiveData& primData = pPrimitiveComponent->getPrimitiveData(); @@ -526,7 +524,7 @@ void FCesiumFeatureIdSetSpec::Define() { static_cast(model.accessors.size() - 1); const int64 attributeIndex = 0; const std::vector featureIDs{0, 0, 0, 1, 1, 1}; - FeatureId& featureId = AddFeatureIDsAsAttributeToModel( + CesiumGltf::FeatureId& featureId = AddFeatureIDsAsAttributeToModel( model, *pPrimitive, featureIDs, @@ -565,8 +563,8 @@ void FCesiumFeatureIdSetSpec::Define() { Describe("Deprecated", [this]() { BeforeEach([this]() { - model = Model(); - Mesh& mesh = model.meshes.emplace_back(); + model = CesiumGltf::Model(); + CesiumGltf::Mesh& mesh = model.meshes.emplace_back(); pPrimitive = &mesh.primitives.emplace_back(); }); @@ -574,7 +572,7 @@ void FCesiumFeatureIdSetSpec::Define() { [this]() { const int64 attributeIndex = 0; const std::vector featureIDs{0, 0, 0, 1, 1, 1}; - FeatureId& featureID = AddFeatureIDsAsAttributeToModel( + CesiumGltf::FeatureId& featureID = AddFeatureIDsAsAttributeToModel( model, *pPrimitive, featureIDs, @@ -584,9 +582,10 @@ void FCesiumFeatureIdSetSpec::Define() { const std::string expectedName = "PropertyTableName"; - ExtensionModelExtStructuralMetadata& metadataExtension = - model.addExtension(); - PropertyTable& propertyTable = + CesiumGltf::ExtensionModelExtStructuralMetadata& metadataExtension = + model.addExtension< + CesiumGltf::ExtensionModelExtStructuralMetadata>(); + CesiumGltf::PropertyTable& propertyTable = metadataExtension.propertyTables.emplace_back(); propertyTable.name = expectedName; @@ -615,7 +614,7 @@ void FCesiumFeatureIdSetSpec::Define() { glm::vec2(0, 0.5), glm::vec2(0.5, 0.5)}; - FeatureId& featureID = AddFeatureIDsAsTextureToModel( + CesiumGltf::FeatureId& featureID = AddFeatureIDsAsTextureToModel( model, *pPrimitive, featureIDs, @@ -628,9 +627,10 @@ void FCesiumFeatureIdSetSpec::Define() { const std::string expectedName = "PropertyTableName"; - ExtensionModelExtStructuralMetadata& metadataExtension = - model.addExtension(); - PropertyTable& propertyTable = + CesiumGltf::ExtensionModelExtStructuralMetadata& metadataExtension = + model.addExtension< + CesiumGltf::ExtensionModelExtStructuralMetadata>(); + CesiumGltf::PropertyTable& propertyTable = metadataExtension.propertyTables.emplace_back(); propertyTable.name = expectedName; diff --git a/Source/CesiumRuntime/Private/Tests/CesiumFeatureIdTexture.spec.cpp b/Source/CesiumRuntime/Private/Tests/CesiumFeatureIdTexture.spec.cpp index 21712ae9b..370dd3688 100644 --- a/Source/CesiumRuntime/Private/Tests/CesiumFeatureIdTexture.spec.cpp +++ b/Source/CesiumRuntime/Private/Tests/CesiumFeatureIdTexture.spec.cpp @@ -8,15 +8,13 @@ #include #include -using namespace CesiumGltf; - BEGIN_DEFINE_SPEC( FCesiumFeatureIdTextureSpec, "Cesium.Unit.FeatureIdTexture", EAutomationTestFlags::ApplicationContextMask | EAutomationTestFlags::ProductFilter) -Model model; -MeshPrimitive* pPrimitive; +CesiumGltf::Model model; +CesiumGltf::MeshPrimitive* pPrimitive; const std::vector texCoords{ glm::vec2(0, 0), glm::vec2(0.5, 0), @@ -28,8 +26,8 @@ END_DEFINE_SPEC(FCesiumFeatureIdTextureSpec) void FCesiumFeatureIdTextureSpec::Define() { Describe("Constructor", [this]() { BeforeEach([this]() { - model = Model(); - Mesh& mesh = model.meshes.emplace_back(); + model = CesiumGltf::Model(); + CesiumGltf::Mesh& mesh = model.meshes.emplace_back(); pPrimitive = &mesh.primitives.emplace_back(); }); @@ -45,11 +43,11 @@ void FCesiumFeatureIdTextureSpec::Define() { TestEqual( "FeatureIDTextureViewStatus", featureIDTextureView.status(), - FeatureIdTextureViewStatus::ErrorUninitialized); + CesiumGltf::FeatureIdTextureViewStatus::ErrorUninitialized); }); It("constructs invalid instance for nonexistent texture", [this]() { - FeatureIdTexture texture; + CesiumGltf::FeatureIdTexture texture; texture.index = -1; texture.texCoord = 0; texture.channels = {0}; @@ -70,14 +68,14 @@ void FCesiumFeatureIdTextureSpec::Define() { TestEqual( "FeatureIDTextureViewStatus", featureIDTextureView.status(), - FeatureIdTextureViewStatus::ErrorInvalidTexture); + CesiumGltf::FeatureIdTextureViewStatus::ErrorInvalidTexture); }); It("constructs invalid instance for texture with invalid image", [this]() { CesiumGltf::Texture& gltfTexture = model.textures.emplace_back(); gltfTexture.source = -1; - FeatureIdTexture texture; + CesiumGltf::FeatureIdTexture texture; texture.index = 0; texture.texCoord = 0; texture.channels = {0}; @@ -98,13 +96,13 @@ void FCesiumFeatureIdTextureSpec::Define() { TestEqual( "FeatureIDTextureViewStatus", featureIDTextureView.status(), - FeatureIdTextureViewStatus::ErrorInvalidImage); + CesiumGltf::FeatureIdTextureViewStatus::ErrorInvalidImage); }); It("constructs valid instance", [this]() { const std::vector featureIDs{0, 3, 1, 2}; - FeatureId& featureId = AddFeatureIDsAsTextureToModel( + CesiumGltf::FeatureId& featureId = AddFeatureIDsAsTextureToModel( model, *pPrimitive, featureIDs, @@ -130,26 +128,26 @@ void FCesiumFeatureIdTextureSpec::Define() { TestEqual( "FeatureIDTextureViewStatus", featureIDTextureView.status(), - FeatureIdTextureViewStatus::Valid); + CesiumGltf::FeatureIdTextureViewStatus::Valid); }); It("constructs valid instance for texture with nonexistent texcoord attribute", [this]() { - Image& image = model.images.emplace_back(); + CesiumGltf::Image& image = model.images.emplace_back(); 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; - sampler.wrapT = Sampler::WrapT::CLAMP_TO_EDGE; + CesiumGltf::Sampler& sampler = model.samplers.emplace_back(); + sampler.wrapS = CesiumGltf::Sampler::WrapS::CLAMP_TO_EDGE; + sampler.wrapT = CesiumGltf::Sampler::WrapT::CLAMP_TO_EDGE; CesiumGltf::Texture& gltfTexture = model.textures.emplace_back(); gltfTexture.source = 0; gltfTexture.sampler = 0; - FeatureIdTexture texture; + CesiumGltf::FeatureIdTexture texture; texture.index = 0; texture.texCoord = 0; texture.channels = {0}; @@ -170,26 +168,26 @@ void FCesiumFeatureIdTextureSpec::Define() { TestEqual( "FeatureIDTextureViewStatus", featureIDTextureView.status(), - FeatureIdTextureViewStatus::Valid); + CesiumGltf::FeatureIdTextureViewStatus::Valid); }); It("constructs valid instance for texture with invalid texcoord accessor", [this]() { - Image& image = model.images.emplace_back(); + CesiumGltf::Image& image = model.images.emplace_back(); 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; - sampler.wrapT = Sampler::WrapT::CLAMP_TO_EDGE; + CesiumGltf::Sampler& sampler = model.samplers.emplace_back(); + sampler.wrapS = CesiumGltf::Sampler::WrapS::CLAMP_TO_EDGE; + sampler.wrapT = CesiumGltf::Sampler::WrapT::CLAMP_TO_EDGE; CesiumGltf::Texture& gltfTexture = model.textures.emplace_back(); gltfTexture.source = 0; gltfTexture.sampler = 0; - FeatureIdTexture texture; + CesiumGltf::FeatureIdTexture texture; texture.index = 0; texture.texCoord = 0; texture.channels = {0}; @@ -212,14 +210,14 @@ void FCesiumFeatureIdTextureSpec::Define() { TestEqual( "FeatureIDTextureViewStatus", featureIDTextureView.status(), - FeatureIdTextureViewStatus::Valid); + CesiumGltf::FeatureIdTextureViewStatus::Valid); }); }); Describe("GetFeatureIDForUV", [this]() { BeforeEach([this]() { - model = Model(); - Mesh& mesh = model.meshes.emplace_back(); + model = CesiumGltf::Model(); + CesiumGltf::Mesh& mesh = model.meshes.emplace_back(); pPrimitive = &mesh.primitives.emplace_back(); }); @@ -227,7 +225,7 @@ void FCesiumFeatureIdTextureSpec::Define() { CesiumGltf::Texture& gltfTexture = model.textures.emplace_back(); gltfTexture.source = -1; - FeatureIdTexture texture; + CesiumGltf::FeatureIdTexture texture; texture.index = 0; texture.texCoord = 0; texture.channels = {0}; @@ -255,7 +253,7 @@ void FCesiumFeatureIdTextureSpec::Define() { It("returns correct value for valid attribute", [this]() { const std::vector featureIDs{0, 3, 1, 2}; - FeatureId& featureId = AddFeatureIDsAsTextureToModel( + CesiumGltf::FeatureId& featureId = AddFeatureIDsAsTextureToModel( model, *pPrimitive, featureIDs, @@ -295,7 +293,7 @@ void FCesiumFeatureIdTextureSpec::Define() { glm::vec2(0, 1), glm::vec2(1, 1)}; - FeatureId& featureId = AddFeatureIDsAsTextureToModel( + CesiumGltf::FeatureId& featureId = AddFeatureIDsAsTextureToModel( model, *pPrimitive, featureIDs, @@ -304,12 +302,13 @@ void FCesiumFeatureIdTextureSpec::Define() { 2, rawTexCoords, 0, - Sampler::WrapS::REPEAT, - Sampler::WrapT::REPEAT); + CesiumGltf::Sampler::WrapS::REPEAT, + CesiumGltf::Sampler::WrapT::REPEAT); assert(featureId.texture != std::nullopt); - ExtensionKhrTextureTransform& textureTransform = - featureId.texture->addExtension(); + CesiumGltf::ExtensionKhrTextureTransform& textureTransform = + featureId.texture + ->addExtension(); textureTransform.offset = {0.5, -0.5}; textureTransform.rotation = UE_DOUBLE_HALF_PI; textureTransform.scale = {0.5, 0.5}; @@ -345,13 +344,13 @@ void FCesiumFeatureIdTextureSpec::Define() { Describe("GetFeatureIDForVertex", [this]() { BeforeEach([this]() { - model = Model(); - Mesh& mesh = model.meshes.emplace_back(); + model = CesiumGltf::Model(); + CesiumGltf::Mesh& mesh = model.meshes.emplace_back(); pPrimitive = &mesh.primitives.emplace_back(); }); It("returns -1 for invalid texture", [this]() { - FeatureIdTexture texture; + CesiumGltf::FeatureIdTexture texture; texture.index = -1; texture.texCoord = 0; texture.channels = {0}; @@ -379,7 +378,7 @@ void FCesiumFeatureIdTextureSpec::Define() { It("returns -1 for out-of-bounds index", [this]() { const std::vector featureIDs{0, 3, 1, 2}; - FeatureId& featureId = AddFeatureIDsAsTextureToModel( + CesiumGltf::FeatureId& featureId = AddFeatureIDsAsTextureToModel( model, *pPrimitive, featureIDs, @@ -419,7 +418,7 @@ void FCesiumFeatureIdTextureSpec::Define() { It("returns correct value for valid texture", [this]() { const std::vector featureIDs{0, 3, 1, 2}; - FeatureId& featureId = AddFeatureIDsAsTextureToModel( + CesiumGltf::FeatureId& featureId = AddFeatureIDsAsTextureToModel( model, *pPrimitive, featureIDs, @@ -464,8 +463,8 @@ void FCesiumFeatureIdTextureSpec::Define() { model, *pPrimitive, "TEXCOORD_0", - AccessorSpec::Type::VEC2, - AccessorSpec::ComponentType::FLOAT, + CesiumGltf::AccessorSpec::Type::VEC2, + CesiumGltf::AccessorSpec::ComponentType::FLOAT, std::move(values)); const std::vector texCoord1{ @@ -475,7 +474,7 @@ void FCesiumFeatureIdTextureSpec::Define() { glm::vec2(0.0, 0.5)}; const std::vector featureIDs{0, 3, 1, 2}; - FeatureId& featureId = AddFeatureIDsAsTextureToModel( + CesiumGltf::FeatureId& featureId = AddFeatureIDsAsTextureToModel( model, *pPrimitive, featureIDs, @@ -510,8 +509,8 @@ void FCesiumFeatureIdTextureSpec::Define() { Describe("GetFeatureIDFromHit", [this]() { BeforeEach([this]() { - model = Model(); - Mesh& mesh = model.meshes.emplace_back(); + model = CesiumGltf::Model(); + CesiumGltf::Mesh& mesh = model.meshes.emplace_back(); pPrimitive = &mesh.primitives.emplace_back(); pPrimitive->mode = CesiumGltf::MeshPrimitive::Mode::TRIANGLES; pPrimitiveComponent = NewObject(); @@ -530,13 +529,13 @@ void FCesiumFeatureIdTextureSpec::Define() { model, *pPrimitive, "POSITION", - AccessorSpec::Type::VEC3, - AccessorSpec::ComponentType::FLOAT, + CesiumGltf::AccessorSpec::Type::VEC3, + CesiumGltf::AccessorSpec::ComponentType::FLOAT, positions); }); It("returns -1 for invalid texture", [this]() { - FeatureIdTexture texture; + CesiumGltf::FeatureIdTexture texture; texture.index = -1; texture.texCoord = 0; texture.channels = {0}; @@ -583,7 +582,7 @@ void FCesiumFeatureIdTextureSpec::Define() { glm::vec2(1, 0)}; const std::vector featureIDs{0, 3, 1, 2}; - FeatureId& featureId = AddFeatureIDsAsTextureToModel( + CesiumGltf::FeatureId& featureId = AddFeatureIDsAsTextureToModel( model, *pPrimitive, featureIDs, @@ -597,7 +596,7 @@ void FCesiumFeatureIdTextureSpec::Define() { CesiumGltf::AccessorView(model, positionAccessorIndex); primData.TexCoordAccessorMap.emplace( 0, - AccessorView>( + CesiumGltf::AccessorView>( model, static_cast(model.accessors.size() - 1))); @@ -643,7 +642,7 @@ void FCesiumFeatureIdTextureSpec::Define() { glm::vec2(1, 0)}; const std::vector featureIDs{0, 3, 1, 2}; - FeatureId& featureId = AddFeatureIDsAsTextureToModel( + CesiumGltf::FeatureId& featureId = AddFeatureIDsAsTextureToModel( model, *pPrimitive, featureIDs, @@ -658,7 +657,7 @@ void FCesiumFeatureIdTextureSpec::Define() { CesiumGltf::AccessorView(model, positionAccessorIndex); primData.TexCoordAccessorMap.emplace( 1, - AccessorView>( + CesiumGltf::AccessorView>( model, static_cast(model.accessors.size() - 1))); @@ -704,7 +703,7 @@ void FCesiumFeatureIdTextureSpec::Define() { glm::vec2(1, 0)}; const std::vector featureIDs{0, 3, 1, 2}; - FeatureId& featureId = AddFeatureIDsAsTextureToModel( + CesiumGltf::FeatureId& featureId = AddFeatureIDsAsTextureToModel( model, *pPrimitive, featureIDs, @@ -719,7 +718,7 @@ void FCesiumFeatureIdTextureSpec::Define() { CesiumGltf::AccessorView(model, positionAccessorIndex); primData.TexCoordAccessorMap.emplace( 0, - AccessorView>( + CesiumGltf::AccessorView>( model, static_cast(model.accessors.size() - 1))); @@ -771,7 +770,7 @@ void FCesiumFeatureIdTextureSpec::Define() { glm::vec2(1, 0)}; const std::vector featureIDs{0, 3, 1, 2}; - FeatureId& featureId = AddFeatureIDsAsTextureToModel( + CesiumGltf::FeatureId& featureId = AddFeatureIDsAsTextureToModel( model, *pPrimitive, featureIDs, @@ -786,7 +785,7 @@ void FCesiumFeatureIdTextureSpec::Define() { CesiumGltf::AccessorView(model, positionAccessorIndex); primData.TexCoordAccessorMap.emplace( 0, - AccessorView>( + CesiumGltf::AccessorView>( model, static_cast(model.accessors.size() - 1))); @@ -841,8 +840,8 @@ void FCesiumFeatureIdTextureSpec::Define() { model, *pPrimitive, "TEXCOORD_0", - AccessorSpec::Type::VEC2, - AccessorSpec::ComponentType::FLOAT, + CesiumGltf::AccessorSpec::Type::VEC2, + CesiumGltf::AccessorSpec::ComponentType::FLOAT, GetValuesAsBytes(texCoords0)); int32 texCoord0AccessorIndex = static_cast(model.accessors.size() - 1); @@ -856,7 +855,7 @@ void FCesiumFeatureIdTextureSpec::Define() { glm::vec2(1, 0), }; const std::vector featureIDs{0, 3, 1, 2}; - FeatureId& featureId = AddFeatureIDsAsTextureToModel( + CesiumGltf::FeatureId& featureId = AddFeatureIDsAsTextureToModel( model, *pPrimitive, featureIDs, @@ -877,15 +876,17 @@ void FCesiumFeatureIdTextureSpec::Define() { CesiumGltf::AccessorView(model, positionAccessorIndex); primData.TexCoordAccessorMap.emplace( 0, - AccessorView>( + CesiumGltf::AccessorView>( model, texCoord0AccessorIndex)); primData.TexCoordAccessorMap.emplace( 0, - AccessorView>(model, 1)); + CesiumGltf::AccessorView>( + model, + 1)); primData.TexCoordAccessorMap.emplace( 1, - AccessorView>( + CesiumGltf::AccessorView>( model, static_cast(model.accessors.size() - 1))); diff --git a/Source/CesiumRuntime/Private/Tests/CesiumGltfSpecUtility.cpp b/Source/CesiumRuntime/Private/Tests/CesiumGltfSpecUtility.cpp index 93107ac13..3af0ffc69 100644 --- a/Source/CesiumRuntime/Private/Tests/CesiumGltfSpecUtility.cpp +++ b/Source/CesiumRuntime/Private/Tests/CesiumGltfSpecUtility.cpp @@ -1,7 +1,5 @@ #include "CesiumGltfSpecUtility.h" -using namespace CesiumGltf; - int32_t AddBufferToModel( CesiumGltf::Model& model, const std::string& type, @@ -22,8 +20,8 @@ int32_t AddBufferToModel( accessor.componentType = componentType; const int64_t elementByteSize = - Accessor::computeByteSizeOfComponent(componentType) * - Accessor::computeNumberOfComponents(type); + CesiumGltf::Accessor::computeByteSizeOfComponent(componentType) * + CesiumGltf::Accessor::computeNumberOfComponents(type); accessor.count = buffer.byteLength / elementByteSize; return static_cast(model.accessors.size() - 1); @@ -45,13 +43,14 @@ CesiumGltf::FeatureId& AddFeatureIDsAsAttributeToModel( CesiumGltf::AccessorSpec::ComponentType::UNSIGNED_BYTE, std::move(values)); - ExtensionExtMeshFeatures* pExtension = - primitive.getExtension(); + CesiumGltf::ExtensionExtMeshFeatures* pExtension = + primitive.getExtension(); if (pExtension == nullptr) { - pExtension = &primitive.addExtension(); + pExtension = + &primitive.addExtension(); } - FeatureId& featureID = pExtension->featureIds.emplace_back(); + CesiumGltf::FeatureId& featureID = pExtension->featureIds.emplace_back(); featureID.featureCount = featureCount; featureID.attribute = setIndex; @@ -80,7 +79,7 @@ CesiumGltf::FeatureId& AddFeatureIDsAsTextureToModel( data.resize(imageWidth * imageHeight); std::memcpy(data.data(), featureIDs.data(), data.size()); - Sampler& sampler = model.samplers.emplace_back(); + CesiumGltf::Sampler& sampler = model.samplers.emplace_back(); sampler.wrapS = samplerWrapS; sampler.wrapT = samplerWrapT; @@ -97,16 +96,17 @@ CesiumGltf::FeatureId& AddFeatureIDsAsTextureToModel( CesiumGltf::AccessorSpec::ComponentType::FLOAT, std::move(values)); - ExtensionExtMeshFeatures* pExtension = - primitive.getExtension(); + CesiumGltf::ExtensionExtMeshFeatures* pExtension = + primitive.getExtension(); if (pExtension == nullptr) { - pExtension = &primitive.addExtension(); + pExtension = + &primitive.addExtension(); } - FeatureId& featureID = pExtension->featureIds.emplace_back(); + CesiumGltf::FeatureId& featureID = pExtension->featureIds.emplace_back(); featureID.featureCount = featureCount; - FeatureIdTexture featureIDTexture; + CesiumGltf::FeatureIdTexture featureIDTexture; featureIDTexture.channels = {0}; featureIDTexture.index = 0; featureIDTexture.texCoord = texcoordSetIndex; diff --git a/Source/CesiumRuntime/Private/Tests/CesiumMetadataValue.spec.cpp b/Source/CesiumRuntime/Private/Tests/CesiumMetadataValue.spec.cpp index bc3c37589..49858c73e 100644 --- a/Source/CesiumRuntime/Private/Tests/CesiumMetadataValue.spec.cpp +++ b/Source/CesiumRuntime/Private/Tests/CesiumMetadataValue.spec.cpp @@ -6,8 +6,6 @@ #include -using namespace CesiumGltf; - BEGIN_DEFINE_SPEC( FCesiumMetadataValueSpec, "Cesium.Unit.MetadataValue", @@ -90,7 +88,7 @@ void FCesiumMetadataValueSpec::Define() { }); It("constructs array value with correct type", [this]() { - PropertyArrayCopy arrayView; + CesiumGltf::PropertyArrayCopy arrayView; FCesiumMetadataValue value(arrayView); FCesiumMetadataValueType valueType = UCesiumMetadataValueBlueprintLibrary::GetValueType(value); @@ -1131,7 +1129,8 @@ void FCesiumMetadataValueSpec::Define() { It("gets array from array value", [this]() { std::vector arrayValues{1, 2}; - PropertyArrayCopy arrayView = std::vector(arrayValues); + CesiumGltf::PropertyArrayCopy arrayView = + std::vector(arrayValues); FCesiumMetadataValue value(arrayView); FCesiumPropertyArray array = @@ -1196,7 +1195,7 @@ void FCesiumMetadataValueSpec::Define() { }); It("returns false for array value", [this]() { - PropertyArrayCopy arrayView; + CesiumGltf::PropertyArrayCopy arrayView; FCesiumMetadataValue value(arrayView); TestFalse( "IsEmpty", @@ -1217,7 +1216,9 @@ void FCesiumMetadataValueSpec::Define() { values.Add({"scalar", FCesiumMetadataValue(-1)}); values.Add({"vec2", FCesiumMetadataValue(glm::u8vec2(2, 3))}); values.Add( - {"array", FCesiumMetadataValue(PropertyArrayCopy({1, 2, 3}))}); + {"array", + FCesiumMetadataValue( + CesiumGltf::PropertyArrayCopy({1, 2, 3}))}); const auto strings = UCesiumMetadataValueBlueprintLibrary::GetValuesAsStrings(values); diff --git a/Source/CesiumRuntime/Private/Tests/CesiumPrimitiveFeatures.spec.cpp b/Source/CesiumRuntime/Private/Tests/CesiumPrimitiveFeatures.spec.cpp index cf16aa069..63fac56c6 100644 --- a/Source/CesiumRuntime/Private/Tests/CesiumPrimitiveFeatures.spec.cpp +++ b/Source/CesiumRuntime/Private/Tests/CesiumPrimitiveFeatures.spec.cpp @@ -5,25 +5,24 @@ #include "CesiumGltfSpecUtility.h" #include "Misc/AutomationTest.h" -using namespace CesiumGltf; - BEGIN_DEFINE_SPEC( FCesiumPrimitiveFeaturesSpec, "Cesium.Unit.PrimitiveFeatures", EAutomationTestFlags::ApplicationContextMask | EAutomationTestFlags::ProductFilter) -Model model; -MeshPrimitive* pPrimitive; -ExtensionExtMeshFeatures* pExtension; +CesiumGltf::Model model; +CesiumGltf::MeshPrimitive* pPrimitive; +CesiumGltf::ExtensionExtMeshFeatures* pExtension; END_DEFINE_SPEC(FCesiumPrimitiveFeaturesSpec) void FCesiumPrimitiveFeaturesSpec::Define() { Describe("Constructor", [this]() { BeforeEach([this]() { - model = Model(); - Mesh& mesh = model.meshes.emplace_back(); + model = CesiumGltf::Model(); + CesiumGltf::Mesh& mesh = model.meshes.emplace_back(); pPrimitive = &mesh.primitives.emplace_back(); - pExtension = &pPrimitive->addExtension(); + pExtension = + &pPrimitive->addExtension(); }); It("constructs with no feature ID sets", [this]() { @@ -39,7 +38,7 @@ void FCesiumPrimitiveFeaturesSpec::Define() { }); It("constructs with single feature ID set", [this]() { - FeatureId& featureID = pExtension->featureIds.emplace_back(); + CesiumGltf::FeatureId& featureID = pExtension->featureIds.emplace_back(); featureID.featureCount = 10; FCesiumPrimitiveFeatures primitiveFeatures = @@ -81,7 +80,8 @@ void FCesiumPrimitiveFeaturesSpec::Define() { texCoords, 0); - FeatureId& implicitIDs = pExtension->featureIds.emplace_back(); + CesiumGltf::FeatureId& implicitIDs = + pExtension->featureIds.emplace_back(); implicitIDs.featureCount = 3; FCesiumPrimitiveFeatures primitiveFeatures = @@ -100,7 +100,7 @@ void FCesiumPrimitiveFeaturesSpec::Define() { for (size_t i = 0; i < featureIDSets.Num(); i++) { const FCesiumFeatureIdSet& featureIDSet = featureIDSets[static_cast(i)]; - const FeatureId& gltfFeatureID = pExtension->featureIds[i]; + const CesiumGltf::FeatureId& gltfFeatureID = pExtension->featureIds[i]; TestEqual( "Feature Count", UCesiumFeatureIdSetBlueprintLibrary::GetFeatureCount(featureIDSet), @@ -116,10 +116,11 @@ void FCesiumPrimitiveFeaturesSpec::Define() { Describe("GetFeatureIDSetsOfType", [this]() { BeforeEach([this]() { - model = Model(); - Mesh& mesh = model.meshes.emplace_back(); + model = CesiumGltf::Model(); + CesiumGltf::Mesh& mesh = model.meshes.emplace_back(); pPrimitive = &mesh.primitives.emplace_back(); - pExtension = &pPrimitive->addExtension(); + pExtension = + &pPrimitive->addExtension(); const std::vector attributeIDs{0, 0, 0}; AddFeatureIDsAsAttributeToModel(model, *pPrimitive, attributeIDs, 1, 0); @@ -139,7 +140,8 @@ void FCesiumPrimitiveFeaturesSpec::Define() { texCoords, 0); - FeatureId& implicitIDs = pExtension->featureIds.emplace_back(); + CesiumGltf::FeatureId& implicitIDs = + pExtension->featureIds.emplace_back(); implicitIDs.featureCount = 3; }); @@ -218,10 +220,11 @@ void FCesiumPrimitiveFeaturesSpec::Define() { Describe("GetFirstVertexFromFace", [this]() { BeforeEach([this]() { - model = Model(); - Mesh& mesh = model.meshes.emplace_back(); + model = CesiumGltf::Model(); + CesiumGltf::Mesh& mesh = model.meshes.emplace_back(); pPrimitive = &mesh.primitives.emplace_back(); - pExtension = &pPrimitive->addExtension(); + pExtension = + &pPrimitive->addExtension(); }); It("returns -1 for out-of-bounds face index", [this]() { @@ -229,7 +232,7 @@ void FCesiumPrimitiveFeaturesSpec::Define() { CreateIndicesForPrimitive( model, *pPrimitive, - AccessorSpec::ComponentType::UNSIGNED_BYTE, + CesiumGltf::AccessorSpec::ComponentType::UNSIGNED_BYTE, indices); FCesiumPrimitiveFeatures primitiveFeatures = @@ -249,7 +252,7 @@ void FCesiumPrimitiveFeaturesSpec::Define() { }); It("returns correct value for primitive without indices", [this]() { - Accessor& accessor = model.accessors.emplace_back(); + CesiumGltf::Accessor& accessor = model.accessors.emplace_back(); accessor.count = 9; const int64 numFaces = accessor.count / 3; @@ -273,10 +276,10 @@ void FCesiumPrimitiveFeaturesSpec::Define() { CreateIndicesForPrimitive( model, *pPrimitive, - AccessorSpec::ComponentType::UNSIGNED_BYTE, + CesiumGltf::AccessorSpec::ComponentType::UNSIGNED_BYTE, indices); - Accessor& accessor = model.accessors.emplace_back(); + CesiumGltf::Accessor& accessor = model.accessors.emplace_back(); accessor.count = 7; pPrimitive->attributes.insert( {"POSITION", static_cast(model.accessors.size() - 1)}); @@ -298,10 +301,11 @@ void FCesiumPrimitiveFeaturesSpec::Define() { Describe("GetFeatureIDFromFace", [this]() { BeforeEach([this]() { - model = Model(); - Mesh& mesh = model.meshes.emplace_back(); + model = CesiumGltf::Model(); + CesiumGltf::Mesh& mesh = model.meshes.emplace_back(); pPrimitive = &mesh.primitives.emplace_back(); - pExtension = &pPrimitive->addExtension(); + pExtension = + &pPrimitive->addExtension(); }); It("returns -1 for primitive with empty feature ID sets", [this]() { @@ -309,10 +313,10 @@ void FCesiumPrimitiveFeaturesSpec::Define() { CreateIndicesForPrimitive( model, *pPrimitive, - AccessorSpec::ComponentType::UNSIGNED_BYTE, + CesiumGltf::AccessorSpec::ComponentType::UNSIGNED_BYTE, indices); - Accessor& accessor = model.accessors.emplace_back(); + CesiumGltf::Accessor& accessor = model.accessors.emplace_back(); accessor.count = 6; pPrimitive->attributes.insert( {"POSITION", static_cast(model.accessors.size() - 1)}); @@ -342,10 +346,10 @@ void FCesiumPrimitiveFeaturesSpec::Define() { CreateIndicesForPrimitive( model, *pPrimitive, - AccessorSpec::ComponentType::UNSIGNED_BYTE, + CesiumGltf::AccessorSpec::ComponentType::UNSIGNED_BYTE, indices); - Accessor& accessor = model.accessors.emplace_back(); + CesiumGltf::Accessor& accessor = model.accessors.emplace_back(); accessor.count = 7; pPrimitive->attributes.insert( {"POSITION", static_cast(model.accessors.size() - 1)}); @@ -381,10 +385,10 @@ void FCesiumPrimitiveFeaturesSpec::Define() { CreateIndicesForPrimitive( model, *pPrimitive, - AccessorSpec::ComponentType::UNSIGNED_BYTE, + CesiumGltf::AccessorSpec::ComponentType::UNSIGNED_BYTE, indices); - Accessor& accessor = model.accessors.emplace_back(); + CesiumGltf::Accessor& accessor = model.accessors.emplace_back(); accessor.count = 3; pPrimitive->attributes.insert( {"POSITION", static_cast(model.accessors.size() - 1)}); @@ -410,7 +414,7 @@ void FCesiumPrimitiveFeaturesSpec::Define() { std::vector attributeIDs{1, 1, 1, 2, 2, 2, 0, 0, 0}; AddFeatureIDsAsAttributeToModel(model, *pPrimitive, attributeIDs, 3, 0); - Accessor& accessor = model.accessors.emplace_back(); + CesiumGltf::Accessor& accessor = model.accessors.emplace_back(); accessor.count = 9; pPrimitive->attributes.insert( {"POSITION", static_cast(model.accessors.size() - 1)}); @@ -437,10 +441,10 @@ void FCesiumPrimitiveFeaturesSpec::Define() { CreateIndicesForPrimitive( model, *pPrimitive, - AccessorSpec::ComponentType::UNSIGNED_BYTE, + CesiumGltf::AccessorSpec::ComponentType::UNSIGNED_BYTE, indices); - Accessor& accessor = model.accessors.emplace_back(); + CesiumGltf::Accessor& accessor = model.accessors.emplace_back(); accessor.count = 7; pPrimitive->attributes.insert( {"POSITION", static_cast(model.accessors.size() - 1)}); @@ -481,10 +485,10 @@ void FCesiumPrimitiveFeaturesSpec::Define() { CreateIndicesForPrimitive( model, *pPrimitive, - AccessorSpec::ComponentType::UNSIGNED_BYTE, + CesiumGltf::AccessorSpec::ComponentType::UNSIGNED_BYTE, indices); - Accessor& accessor = model.accessors.emplace_back(); + CesiumGltf::Accessor& accessor = model.accessors.emplace_back(); accessor.count = 3; pPrimitive->attributes.insert( {"POSITION", static_cast(model.accessors.size() - 1)}); @@ -525,7 +529,7 @@ void FCesiumPrimitiveFeaturesSpec::Define() { texCoords, 0); - Accessor& accessor = model.accessors.emplace_back(); + CesiumGltf::Accessor& accessor = model.accessors.emplace_back(); accessor.count = 6; pPrimitive->attributes.insert( {"POSITION", static_cast(model.accessors.size() - 1)}); @@ -568,10 +572,10 @@ void FCesiumPrimitiveFeaturesSpec::Define() { CreateIndicesForPrimitive( model, *pPrimitive, - AccessorSpec::ComponentType::UNSIGNED_BYTE, + CesiumGltf::AccessorSpec::ComponentType::UNSIGNED_BYTE, indices); - Accessor& accessor = model.accessors.emplace_back(); + CesiumGltf::Accessor& accessor = model.accessors.emplace_back(); accessor.count = 4; pPrimitive->attributes.insert( {"POSITION", static_cast(model.accessors.size() - 1)}); @@ -596,12 +600,13 @@ void FCesiumPrimitiveFeaturesSpec::Define() { Describe("ImplicitFeatureIDs", [this]() { BeforeEach([this]() { - FeatureId& implicitIDs = pExtension->featureIds.emplace_back(); + CesiumGltf::FeatureId& implicitIDs = + pExtension->featureIds.emplace_back(); implicitIDs.featureCount = 6; }); It("returns -1 for out-of-bounds face index", [this]() { - Accessor& accessor = model.accessors.emplace_back(); + CesiumGltf::Accessor& accessor = model.accessors.emplace_back(); accessor.count = 6; pPrimitive->attributes.insert( {"POSITION", static_cast(model.accessors.size() - 1)}); @@ -624,7 +629,7 @@ void FCesiumPrimitiveFeaturesSpec::Define() { }); It("returns correct values for primitive without indices", [this]() { - Accessor& accessor = model.accessors.emplace_back(); + CesiumGltf::Accessor& accessor = model.accessors.emplace_back(); accessor.count = 6; pPrimitive->attributes.insert( {"POSITION", static_cast(model.accessors.size() - 1)}); @@ -651,10 +656,10 @@ void FCesiumPrimitiveFeaturesSpec::Define() { CreateIndicesForPrimitive( model, *pPrimitive, - AccessorSpec::ComponentType::UNSIGNED_BYTE, + CesiumGltf::AccessorSpec::ComponentType::UNSIGNED_BYTE, indices); - Accessor& accessor = model.accessors.emplace_back(); + CesiumGltf::Accessor& accessor = model.accessors.emplace_back(); accessor.count = 4; pPrimitive->attributes.insert( {"POSITION", static_cast(model.accessors.size() - 1)}); @@ -692,16 +697,17 @@ void FCesiumPrimitiveFeaturesSpec::Define() { CreateIndicesForPrimitive( model, *pPrimitive, - AccessorSpec::ComponentType::UNSIGNED_BYTE, + CesiumGltf::AccessorSpec::ComponentType::UNSIGNED_BYTE, indices); - Accessor& accessor = model.accessors.emplace_back(); + CesiumGltf::Accessor& accessor = model.accessors.emplace_back(); accessor.count = 7; pPrimitive->attributes.insert( {"POSITION", static_cast(model.accessors.size() - 1)}); // Second feature ID set is implicit - FeatureId& implicitIDs = pExtension->featureIds.emplace_back(); + CesiumGltf::FeatureId& implicitIDs = + pExtension->featureIds.emplace_back(); implicitIDs.featureCount = 7; FCesiumPrimitiveFeatures primitiveFeatures = diff --git a/Source/CesiumRuntime/Private/Tests/CesiumPropertyArray.spec.cpp b/Source/CesiumRuntime/Private/Tests/CesiumPropertyArray.spec.cpp index c631610da..6eae0eb5d 100644 --- a/Source/CesiumRuntime/Private/Tests/CesiumPropertyArray.spec.cpp +++ b/Source/CesiumRuntime/Private/Tests/CesiumPropertyArray.spec.cpp @@ -4,8 +4,6 @@ #include "CesiumPropertyArrayBlueprintLibrary.h" #include "Misc/AutomationTest.h" -using namespace CesiumGltf; - BEGIN_DEFINE_SPEC( FCesiumPropertyArraySpec, "Cesium.Unit.PropertyArray", @@ -37,7 +35,7 @@ void FCesiumPropertyArraySpec::Define() { }); It("constructs empty array from empty view", [this]() { - PropertyArrayCopy arrayView; + CesiumGltf::PropertyArrayCopy arrayView; FCesiumPropertyArray array(arrayView); TestEqual( "size", @@ -60,7 +58,7 @@ void FCesiumPropertyArraySpec::Define() { It("constructs non-empty array", [this]() { std::vector values{1, 2, 3, 4}; - PropertyArrayCopy arrayView = std::vector(values); + CesiumGltf::PropertyArrayCopy arrayView = std::vector(values); FCesiumPropertyArray array(arrayView); TestEqual( "size", @@ -85,7 +83,7 @@ void FCesiumPropertyArraySpec::Define() { Describe("GetValue", [this]() { It("gets bogus value for out-of-bounds index", [this]() { std::vector values{1}; - PropertyArrayCopy arrayView = std::vector(values); + CesiumGltf::PropertyArrayCopy arrayView = std::vector(values); FCesiumPropertyArray array(arrayView); TestEqual( "size", @@ -114,7 +112,7 @@ void FCesiumPropertyArraySpec::Define() { It("gets value for valid index", [this]() { std::vector values{1, 2, 3, 4}; - PropertyArrayCopy arrayView = std::vector(values); + CesiumGltf::PropertyArrayCopy arrayView = std::vector(values); FCesiumPropertyArray array(arrayView); TestEqual( "size", diff --git a/Source/CesiumRuntime/Private/Tests/CesiumPropertyTable.spec.cpp b/Source/CesiumRuntime/Private/Tests/CesiumPropertyTable.spec.cpp index c2d9ded27..6f3a89394 100644 --- a/Source/CesiumRuntime/Private/Tests/CesiumPropertyTable.spec.cpp +++ b/Source/CesiumRuntime/Private/Tests/CesiumPropertyTable.spec.cpp @@ -7,23 +7,22 @@ #include "Misc/AutomationTest.h" #include -using namespace CesiumGltf; - BEGIN_DEFINE_SPEC( FCesiumPropertyTableSpec, "Cesium.Unit.PropertyTable", EAutomationTestFlags::ApplicationContextMask | EAutomationTestFlags::ProductFilter) -Model model; -ExtensionModelExtStructuralMetadata* pExtension; -PropertyTable* pPropertyTable; +CesiumGltf::Model model; +CesiumGltf::ExtensionModelExtStructuralMetadata* pExtension; +CesiumGltf::PropertyTable* pPropertyTable; END_DEFINE_SPEC(FCesiumPropertyTableSpec) void FCesiumPropertyTableSpec::Define() { BeforeEach([this]() { - model = Model(); - pExtension = &model.addExtension(); - pExtension->schema = Schema(); + model = CesiumGltf::Model(); + pExtension = + &model.addExtension(); + pExtension->schema = CesiumGltf::Schema(); pPropertyTable = &pExtension->propertyTables.emplace_back(); }); @@ -83,8 +82,8 @@ void FCesiumPropertyTableSpec::Define() { model, *pPropertyTable, propertyName, - ClassProperty::Type::SCALAR, - ClassProperty::ComponentType::INT32, + CesiumGltf::ClassProperty::Type::SCALAR, + CesiumGltf::ClassProperty::ComponentType::INT32, values); FCesiumPropertyTable propertyTable(model, *pPropertyTable); @@ -111,8 +110,9 @@ void FCesiumPropertyTableSpec::Define() { model, *pPropertyTable, propertyName, - ClassProperty::Type::SCALAR, - ClassProperty::ComponentType::INT32, // Incorrect component type + CesiumGltf::ClassProperty::Type::SCALAR, + CesiumGltf::ClassProperty::ComponentType::INT32, // Incorrect + // component type values); FCesiumPropertyTable propertyTable(model, *pPropertyTable); @@ -152,8 +152,8 @@ void FCesiumPropertyTableSpec::Define() { model, *pPropertyTable, scalarPropertyName, - ClassProperty::Type::SCALAR, - ClassProperty::ComponentType::INT32, + CesiumGltf::ClassProperty::Type::SCALAR, + CesiumGltf::ClassProperty::ComponentType::INT32, scalarValues); std::string vec2PropertyName("vec2Property"); @@ -167,8 +167,8 @@ void FCesiumPropertyTableSpec::Define() { model, *pPropertyTable, vec2PropertyName, - ClassProperty::Type::VEC2, - ClassProperty::ComponentType::FLOAT32, + CesiumGltf::ClassProperty::Type::VEC2, + CesiumGltf::ClassProperty::ComponentType::FLOAT32, vec2Values); FCesiumPropertyTable propertyTable(model, *pPropertyTable); @@ -251,8 +251,8 @@ void FCesiumPropertyTableSpec::Define() { model, *pPropertyTable, propertyName, - ClassProperty::Type::SCALAR, - ClassProperty::ComponentType::INT32, + CesiumGltf::ClassProperty::Type::SCALAR, + CesiumGltf::ClassProperty::ComponentType::INT32, values); FCesiumPropertyTable propertyTable(model, *pPropertyTable); @@ -311,8 +311,8 @@ void FCesiumPropertyTableSpec::Define() { model, *pPropertyTable, scalarPropertyName, - ClassProperty::Type::SCALAR, - ClassProperty::ComponentType::INT32, + CesiumGltf::ClassProperty::Type::SCALAR, + CesiumGltf::ClassProperty::ComponentType::INT32, scalarValues); std::string vec2PropertyName("vec2Property"); @@ -326,8 +326,8 @@ void FCesiumPropertyTableSpec::Define() { model, *pPropertyTable, vec2PropertyName, - ClassProperty::Type::VEC2, - ClassProperty::ComponentType::FLOAT32, + CesiumGltf::ClassProperty::Type::VEC2, + CesiumGltf::ClassProperty::ComponentType::FLOAT32, vec2Values); std::string invalidPropertyName("badProperty"); @@ -336,8 +336,9 @@ void FCesiumPropertyTableSpec::Define() { model, *pPropertyTable, invalidPropertyName, - ClassProperty::Type::SCALAR, - ClassProperty::ComponentType::INT32, // Incorrect component type + CesiumGltf::ClassProperty::Type::SCALAR, + CesiumGltf::ClassProperty::ComponentType::INT32, // Incorrect + // component type invalidPropertyValues); FCesiumPropertyTable propertyTable(model, *pPropertyTable); @@ -378,8 +379,8 @@ void FCesiumPropertyTableSpec::Define() { model, *pPropertyTable, propertyName, - ClassProperty::Type::SCALAR, - ClassProperty::ComponentType::INT32, + CesiumGltf::ClassProperty::Type::SCALAR, + CesiumGltf::ClassProperty::ComponentType::INT32, values); FCesiumPropertyTable propertyTable(model, *pPropertyTable); @@ -418,8 +419,8 @@ void FCesiumPropertyTableSpec::Define() { model, *pPropertyTable, scalarPropertyName, - ClassProperty::Type::SCALAR, - ClassProperty::ComponentType::INT32, + CesiumGltf::ClassProperty::Type::SCALAR, + CesiumGltf::ClassProperty::ComponentType::INT32, scalarValues); std::string vec2PropertyName("vec2Property"); @@ -433,8 +434,8 @@ void FCesiumPropertyTableSpec::Define() { model, *pPropertyTable, vec2PropertyName, - ClassProperty::Type::VEC2, - ClassProperty::ComponentType::FLOAT32, + CesiumGltf::ClassProperty::Type::VEC2, + CesiumGltf::ClassProperty::ComponentType::FLOAT32, vec2Values); FCesiumPropertyTable propertyTable(model, *pPropertyTable); @@ -513,8 +514,8 @@ void FCesiumPropertyTableSpec::Define() { model, *pPropertyTable, scalarPropertyName, - ClassProperty::Type::SCALAR, - ClassProperty::ComponentType::INT32, + CesiumGltf::ClassProperty::Type::SCALAR, + CesiumGltf::ClassProperty::ComponentType::INT32, scalarValues); std::string vec2PropertyName("vec2Property"); @@ -528,8 +529,8 @@ void FCesiumPropertyTableSpec::Define() { model, *pPropertyTable, vec2PropertyName, - ClassProperty::Type::VEC2, - ClassProperty::ComponentType::FLOAT32, + CesiumGltf::ClassProperty::Type::VEC2, + CesiumGltf::ClassProperty::ComponentType::FLOAT32, vec2Values); FCesiumPropertyTable propertyTable(model, *pPropertyTable); @@ -568,8 +569,8 @@ void FCesiumPropertyTableSpec::Define() { model, *pPropertyTable, scalarPropertyName, - ClassProperty::Type::SCALAR, - ClassProperty::ComponentType::INT32, + CesiumGltf::ClassProperty::Type::SCALAR, + CesiumGltf::ClassProperty::ComponentType::INT32, scalarValues); std::string vec2PropertyName("vec2Property"); @@ -583,8 +584,8 @@ void FCesiumPropertyTableSpec::Define() { model, *pPropertyTable, vec2PropertyName, - ClassProperty::Type::VEC2, - ClassProperty::ComponentType::FLOAT32, + CesiumGltf::ClassProperty::Type::VEC2, + CesiumGltf::ClassProperty::ComponentType::FLOAT32, vec2Values); FCesiumPropertyTable propertyTable(model, *pPropertyTable); @@ -642,8 +643,8 @@ void FCesiumPropertyTableSpec::Define() { model, *pPropertyTable, propertyName, - ClassProperty::Type::SCALAR, - ClassProperty::ComponentType::INT32, + CesiumGltf::ClassProperty::Type::SCALAR, + CesiumGltf::ClassProperty::ComponentType::INT32, propertyValues); FCesiumPropertyTable propertyTable(model, *pPropertyTable); @@ -696,8 +697,8 @@ void FCesiumPropertyTableSpec::Define() { model, *pPropertyTable, scalarPropertyName, - ClassProperty::Type::SCALAR, - ClassProperty::ComponentType::INT32, + CesiumGltf::ClassProperty::Type::SCALAR, + CesiumGltf::ClassProperty::ComponentType::INT32, scalarValues); std::string vec2PropertyName("vec2Property"); @@ -711,8 +712,8 @@ void FCesiumPropertyTableSpec::Define() { model, *pPropertyTable, vec2PropertyName, - ClassProperty::Type::VEC2, - ClassProperty::ComponentType::FLOAT32, + CesiumGltf::ClassProperty::Type::VEC2, + CesiumGltf::ClassProperty::ComponentType::FLOAT32, vec2Values); FCesiumPropertyTable propertyTable(model, *pPropertyTable); @@ -747,8 +748,8 @@ void FCesiumPropertyTableSpec::Define() { model, *pPropertyTable, scalarPropertyName, - ClassProperty::Type::SCALAR, - ClassProperty::ComponentType::INT32, + CesiumGltf::ClassProperty::Type::SCALAR, + CesiumGltf::ClassProperty::ComponentType::INT32, scalarValues); std::string vec2PropertyName("vec2Property"); @@ -762,8 +763,8 @@ void FCesiumPropertyTableSpec::Define() { model, *pPropertyTable, vec2PropertyName, - ClassProperty::Type::VEC2, - ClassProperty::ComponentType::FLOAT32, + CesiumGltf::ClassProperty::Type::VEC2, + CesiumGltf::ClassProperty::ComponentType::FLOAT32, vec2Values); FCesiumPropertyTable propertyTable(model, *pPropertyTable); @@ -817,8 +818,8 @@ void FCesiumPropertyTableSpec::Define() { model, *pPropertyTable, propertyName, - ClassProperty::Type::SCALAR, - ClassProperty::ComponentType::INT32, + CesiumGltf::ClassProperty::Type::SCALAR, + CesiumGltf::ClassProperty::ComponentType::INT32, propertyValues); FCesiumPropertyTable propertyTable(model, *pPropertyTable); diff --git a/Source/CesiumRuntime/Private/Tests/CesiumPropertyTableProperty.spec.cpp b/Source/CesiumRuntime/Private/Tests/CesiumPropertyTableProperty.spec.cpp index 43b246f30..1ed3f52b4 100644 --- a/Source/CesiumRuntime/Private/Tests/CesiumPropertyTableProperty.spec.cpp +++ b/Source/CesiumRuntime/Private/Tests/CesiumPropertyTableProperty.spec.cpp @@ -39,8 +39,9 @@ void FCesiumPropertyTablePropertySpec::Define() { It("constructs invalid instance from view with invalid definition", [this]() { - PropertyTablePropertyView propertyView( - PropertyTablePropertyViewStatus::ErrorArrayTypeMismatch); + CesiumGltf::PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyViewStatus:: + ErrorArrayTypeMismatch); FCesiumPropertyTableProperty property(propertyView); TestEqual( "PropertyTablePropertyStatus", @@ -61,8 +62,9 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("constructs invalid instance from view with invalid data", [this]() { - PropertyTablePropertyView propertyView( - PropertyTablePropertyViewStatus::ErrorBufferViewOutOfBounds); + CesiumGltf::PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyViewStatus:: + ErrorBufferViewOutOfBounds); FCesiumPropertyTableProperty property(propertyView); TestEqual( "PropertyTablePropertyStatus", @@ -83,14 +85,14 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("constructs valid instance", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::INT32; std::vector values{1, 2, 3, 4}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -163,15 +165,15 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("constructs valid normalized instance", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::UINT8; classProperty.normalized = true; std::vector values{0, 1, 255, 128}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -220,8 +222,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("constructs instance for fixed-length array property", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::INT32; classProperty.array = true; @@ -232,15 +234,16 @@ void FCesiumPropertyTablePropertySpec::Define() { static_cast(values.size()) / *classProperty.count; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView> propertyView( - propertyTableProperty, - classProperty, - size, - gsl::span(data.data(), data.size()), - gsl::span(), - gsl::span(), - PropertyComponentType::None, - PropertyComponentType::None); + CesiumGltf::PropertyTablePropertyView> + propertyView( + propertyTableProperty, + classProperty, + size, + gsl::span(data.data(), data.size()), + gsl::span(), + gsl::span(), + PropertyComponentType::None, + PropertyComponentType::None); FCesiumPropertyTableProperty property(propertyView); TestEqual( @@ -284,8 +287,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("constructs instance for variable-length array property", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::INT32; classProperty.array = true; @@ -297,15 +300,18 @@ void FCesiumPropertyTablePropertySpec::Define() { std::vector offsetsData = GetValuesAsBytes(offsets); int64_t size = static_cast(offsets.size()) - 1; - PropertyTablePropertyView> propertyView( - propertyTableProperty, - classProperty, - size, - gsl::span(data.data(), data.size()), - gsl::span(offsetsData.data(), offsetsData.size()), - gsl::span(), - PropertyComponentType::Uint16, - PropertyComponentType::None); + CesiumGltf::PropertyTablePropertyView> + propertyView( + propertyTableProperty, + classProperty, + size, + gsl::span(data.data(), data.size()), + gsl::span( + offsetsData.data(), + offsetsData.size()), + gsl::span(), + PropertyComponentType::Uint16, + PropertyComponentType::None); FCesiumPropertyTableProperty property(propertyView); TestEqual( @@ -350,8 +356,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("constructs valid instance with additional properties", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::INT32; classProperty.normalized = true; @@ -372,7 +378,7 @@ void FCesiumPropertyTablePropertySpec::Define() { std::vector values{1, 2, 3, 4}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -462,8 +468,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("constructs valid array instance with additional properties", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::INT32; classProperty.normalized = true; @@ -486,11 +492,12 @@ void FCesiumPropertyTablePropertySpec::Define() { std::vector values{1, 2, 3, 4, 5, 6, -1, -1}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView, true> propertyView( - propertyTableProperty, - classProperty, - static_cast(values.size()), - gsl::span(data.data(), data.size())); + CesiumGltf::PropertyTablePropertyView, true> + propertyView( + propertyTableProperty, + classProperty, + static_cast(values.size()), + gsl::span(data.data(), data.size())); FCesiumPropertyTableProperty property(propertyView); TestEqual( @@ -676,13 +683,13 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("returns default value for invalid feature ID", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::BOOLEAN; std::vector data{static_cast(0b10110001)}; - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(8), @@ -712,13 +719,13 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets from boolean property", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::BOOLEAN; std::vector data{static_cast(0b10110001)}; - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(8), @@ -771,11 +778,11 @@ void FCesiumPropertyTablePropertySpec::Define() { offsets[offsets.size() - 1] = currentOffset; std::vector offsetsData = GetValuesAsBytes(offsets); - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::STRING; - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -825,15 +832,15 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("returns default value for invalid feature ID", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::UINT8; std::vector values{1, 2, 3, 4}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -861,15 +868,15 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets from uint8 property", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::UINT8; std::vector values{1, 2, 3, 4}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -898,15 +905,15 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("converts compatible values", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::INT32; std::vector values{1, 24, 255, 256, -1, 28}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -936,8 +943,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets with noData / default value", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::UINT8; @@ -950,7 +957,7 @@ void FCesiumPropertyTablePropertySpec::Define() { std::vector values{1, 2, 3, 0, 4}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -1004,15 +1011,15 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("returns default value for invalid feature ID", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::INT32; std::vector values{-1, 2, -3, 4}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -1044,15 +1051,15 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets from int32 property", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::INT32; std::vector values{-1, 2, -3, 4}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -1081,8 +1088,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("converts compatible values", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::FLOAT32; @@ -1095,7 +1102,7 @@ void FCesiumPropertyTablePropertySpec::Define() { }; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -1125,8 +1132,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets with noData / default value", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::INT32; @@ -1139,7 +1146,7 @@ void FCesiumPropertyTablePropertySpec::Define() { std::vector values{-1, 2, -3, 0, 4}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -1197,15 +1204,15 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("returns default value for invalid feature ID", [this, defaultInt64]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::INT64; std::vector values{-1, 2, -3, 4}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -1237,15 +1244,15 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets from int64 property", [this, defaultInt64]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::INT64; std::vector values{-1, 2, -3, 4}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -1274,8 +1281,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("converts compatible values", [this, defaultInt64]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::UINT64; @@ -1286,7 +1293,7 @@ void FCesiumPropertyTablePropertySpec::Define() { static_cast(std::numeric_limits::max()) + 100}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -1316,8 +1323,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets with noData / default value", [this, defaultInt64]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::INT64; @@ -1330,7 +1337,7 @@ void FCesiumPropertyTablePropertySpec::Define() { std::vector values{-1, 2, 0, -3, 4}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -1386,15 +1393,15 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("returns default value for invalid feature ID", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::FLOAT32; std::vector values{-1.1f, 2.2f, -3.3f, 4.0f}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -1422,15 +1429,15 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets from float property", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::FLOAT32; std::vector values{-1.1f, 2.2f, -3.3f, 4.0f}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -1466,12 +1473,12 @@ void FCesiumPropertyTablePropertySpec::Define() { std::numeric_limits::max()}; std::vector data = GetValuesAsBytes(values); - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::FLOAT64; - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -1506,8 +1513,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets with offset / scale", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::FLOAT32; @@ -1520,7 +1527,7 @@ void FCesiumPropertyTablePropertySpec::Define() { std::vector values{-1.1f, 2.2f, -3.3f, 4.0f}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -1566,15 +1573,15 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("returns default value for invalid feature ID", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::FLOAT64; std::vector values{-1.1, 2.2, -3.3, 4.0}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -1606,15 +1613,15 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets from double property", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::FLOAT64; std::vector values{-1.1, 2.2, -3.3, 4.0}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -1643,8 +1650,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets from normalized uint8 property", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::UINT8; classProperty.normalized = true; @@ -1652,7 +1659,7 @@ void FCesiumPropertyTablePropertySpec::Define() { std::vector values{0, 128, 255, 0}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -1685,8 +1692,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("converts compatible values", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::STRING; std::vector values{"not a number", "10", "-2"}; @@ -1709,7 +1716,7 @@ void FCesiumPropertyTablePropertySpec::Define() { offsets[offsets.size() - 1] = currentOffset; std::vector offsetsData = GetValuesAsBytes(offsets); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -1746,8 +1753,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets with offset / scale", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::FLOAT64; @@ -1760,7 +1767,7 @@ void FCesiumPropertyTablePropertySpec::Define() { std::vector values{-1.1, 2.2, -3.3, 4.0}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -1807,8 +1814,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("returns default value for invalid feature ID", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::VEC2; classProperty.componentType = ClassProperty::ComponentType::INT32; @@ -1818,7 +1825,7 @@ void FCesiumPropertyTablePropertySpec::Define() { glm::ivec2(10, 4)}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -1852,8 +1859,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets from glm::ivec2 property", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::VEC2; classProperty.componentType = ClassProperty::ComponentType::INT32; @@ -1863,7 +1870,7 @@ void FCesiumPropertyTablePropertySpec::Define() { glm::ivec2(10, 4)}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -1893,8 +1900,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("converts compatible values", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::VEC3; classProperty.componentType = ClassProperty::ComponentType::FLOAT32; @@ -1904,7 +1911,7 @@ void FCesiumPropertyTablePropertySpec::Define() { glm::vec3(std::numeric_limits::max(), -1.0f, 2.0f)}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -1937,8 +1944,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets with noData / default value", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::VEC2; classProperty.componentType = ClassProperty::ComponentType::INT32; @@ -1954,7 +1961,7 @@ void FCesiumPropertyTablePropertySpec::Define() { glm::ivec2(10, 4)}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -2008,8 +2015,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("returns default value for invalid feature ID", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::VEC2; classProperty.componentType = ClassProperty::ComponentType::FLOAT64; @@ -2019,7 +2026,7 @@ void FCesiumPropertyTablePropertySpec::Define() { glm::dvec2(1.5, -1.5)}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -2053,8 +2060,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets from glm::dvec2 property", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::VEC2; classProperty.componentType = ClassProperty::ComponentType::FLOAT64; @@ -2064,7 +2071,7 @@ void FCesiumPropertyTablePropertySpec::Define() { glm::dvec2(1.5, -1.5)}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -2094,8 +2101,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets from normalized glm::u8vec2 property", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::VEC2; classProperty.componentType = ClassProperty::ComponentType::UINT8; classProperty.normalized = true; @@ -2106,7 +2113,7 @@ void FCesiumPropertyTablePropertySpec::Define() { glm::u8vec2(10, 4)}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -2140,8 +2147,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("converts compatible values", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::STRING; std::vector values{"X=10 Y=3", "not a vector", "X=-2 Y=4"}; @@ -2164,7 +2171,7 @@ void FCesiumPropertyTablePropertySpec::Define() { offsets[offsets.size() - 1] = currentOffset; std::vector offsetsData = GetValuesAsBytes(offsets); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -2201,8 +2208,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets with offset / scale", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::VEC2; classProperty.componentType = ClassProperty::ComponentType::FLOAT64; @@ -2218,7 +2225,7 @@ void FCesiumPropertyTablePropertySpec::Define() { glm::dvec2(1.5, -1.5)}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -2269,8 +2276,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("returns default value for invalid feature ID", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::VEC3; classProperty.componentType = ClassProperty::ComponentType::INT32; @@ -2280,7 +2287,7 @@ void FCesiumPropertyTablePropertySpec::Define() { glm::ivec3(10, 4, 5)}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -2314,8 +2321,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets from glm::ivec3 property", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::VEC3; classProperty.componentType = ClassProperty::ComponentType::INT32; @@ -2325,7 +2332,7 @@ void FCesiumPropertyTablePropertySpec::Define() { glm::ivec3(10, 4, 5)}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -2355,8 +2362,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("converts compatible values", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::VEC3; classProperty.componentType = ClassProperty::ComponentType::FLOAT32; @@ -2367,7 +2374,7 @@ void FCesiumPropertyTablePropertySpec::Define() { glm::vec3(std::numeric_limits::max(), -1.0f, 2.0f)}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -2401,8 +2408,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets with noData / default value", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::VEC3; classProperty.componentType = ClassProperty::ComponentType::INT32; @@ -2422,7 +2429,7 @@ void FCesiumPropertyTablePropertySpec::Define() { glm::ivec3(10, 4, 5)}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -2476,8 +2483,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("returns default value for invalid feature ID", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::VEC3; classProperty.componentType = ClassProperty::ComponentType::FLOAT32; @@ -2487,7 +2494,7 @@ void FCesiumPropertyTablePropertySpec::Define() { glm::vec3(10.0f, 4.4f, 5.4f)}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -2521,8 +2528,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets from glm::vec3 property", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::VEC3; classProperty.componentType = ClassProperty::ComponentType::FLOAT32; @@ -2532,7 +2539,7 @@ void FCesiumPropertyTablePropertySpec::Define() { glm::vec3(10.0f, 4.4f, 5.4f)}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -2562,8 +2569,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("converts compatible values", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::VEC2; classProperty.componentType = ClassProperty::ComponentType::FLOAT64; @@ -2574,7 +2581,7 @@ void FCesiumPropertyTablePropertySpec::Define() { glm::dvec2(std::numeric_limits::max(), -1.0)}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -2612,8 +2619,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets with offset / scale", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::VEC3; classProperty.componentType = ClassProperty::ComponentType::FLOAT32; @@ -2629,7 +2636,7 @@ void FCesiumPropertyTablePropertySpec::Define() { glm::vec3(10.0f, 4.4f, 5.4f)}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -2680,8 +2687,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("returns default value for invalid feature ID", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::VEC3; classProperty.componentType = ClassProperty::ComponentType::FLOAT64; @@ -2691,7 +2698,7 @@ void FCesiumPropertyTablePropertySpec::Define() { glm::dvec3(1.5, -1.5, -2.01)}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -2725,8 +2732,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets from glm::dvec3 property", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::VEC3; classProperty.componentType = ClassProperty::ComponentType::FLOAT64; @@ -2736,7 +2743,7 @@ void FCesiumPropertyTablePropertySpec::Define() { glm::dvec3(1.5, -1.5, -2.01)}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -2766,8 +2773,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets from normalized glm::i8vec3 property", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::VEC3; classProperty.componentType = ClassProperty::ComponentType::INT8; classProperty.normalized = true; @@ -2778,7 +2785,7 @@ void FCesiumPropertyTablePropertySpec::Define() { glm::i8vec3(1, -1, -2)}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -2813,8 +2820,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("converts compatible values", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::STRING; std::vector values{ @@ -2840,7 +2847,7 @@ void FCesiumPropertyTablePropertySpec::Define() { offsets[offsets.size() - 1] = currentOffset; std::vector offsetsData = GetValuesAsBytes(offsets); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -2877,8 +2884,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets with offset / scale", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::VEC3; classProperty.componentType = ClassProperty::ComponentType::FLOAT64; @@ -2894,7 +2901,7 @@ void FCesiumPropertyTablePropertySpec::Define() { glm::dvec3(1.5, -1.5, -2.01)}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -2945,8 +2952,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("returns default value for invalid feature ID", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::VEC4; classProperty.componentType = ClassProperty::ComponentType::FLOAT64; @@ -2956,7 +2963,7 @@ void FCesiumPropertyTablePropertySpec::Define() { glm::dvec4(1.5, -1.5, -2.01, 5.5)}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -2990,8 +2997,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets from glm::dvec4 property", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::VEC4; classProperty.componentType = ClassProperty::ComponentType::FLOAT64; @@ -3001,7 +3008,7 @@ void FCesiumPropertyTablePropertySpec::Define() { glm::dvec4(1.5, -1.5, -2.01, 5.5)}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -3035,8 +3042,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets from glm::i8vec4 property", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::VEC4; classProperty.componentType = ClassProperty::ComponentType::INT8; classProperty.normalized = true; @@ -3047,7 +3054,7 @@ void FCesiumPropertyTablePropertySpec::Define() { glm::i8vec4(1, -1, -2, 5)}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -3087,8 +3094,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("converts compatible values", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::STRING; std::vector values{ @@ -3114,7 +3121,7 @@ void FCesiumPropertyTablePropertySpec::Define() { offsets[offsets.size() - 1] = currentOffset; std::vector offsetsData = GetValuesAsBytes(offsets); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -3151,8 +3158,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets with offset / scale", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::VEC4; classProperty.componentType = ClassProperty::ComponentType::FLOAT64; @@ -3168,7 +3175,7 @@ void FCesiumPropertyTablePropertySpec::Define() { glm::dvec4(1.5, -1.5, -2.01, 5.5)}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -3220,8 +3227,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("returns default value for invalid feature ID", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::MAT4; classProperty.componentType = ClassProperty::ComponentType::FLOAT64; @@ -3241,7 +3248,7 @@ void FCesiumPropertyTablePropertySpec::Define() { // clang-format on std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -3276,8 +3283,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets from glm::dmat4 property", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::MAT4; classProperty.componentType = ClassProperty::ComponentType::FLOAT64; @@ -3297,7 +3304,7 @@ void FCesiumPropertyTablePropertySpec::Define() { // clang-format on std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -3338,8 +3345,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets from glm::u8mat4x4 property", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::MAT4; classProperty.componentType = ClassProperty::ComponentType::INT8; classProperty.normalized = true; @@ -3360,7 +3367,7 @@ void FCesiumPropertyTablePropertySpec::Define() { // clang-format on std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -3405,15 +3412,15 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("converts compatible values", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::FLOAT64; std::vector values{-2.0, 10.5}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -3453,8 +3460,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("returns default values for incompatible type", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::VEC2; classProperty.componentType = ClassProperty::ComponentType::FLOAT32; @@ -3463,7 +3470,7 @@ void FCesiumPropertyTablePropertySpec::Define() { glm::vec2(1.5f, 0.1f)}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -3492,8 +3499,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets with offset / scale", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::MAT4; classProperty.componentType = ClassProperty::ComponentType::FLOAT64; @@ -3526,7 +3533,7 @@ void FCesiumPropertyTablePropertySpec::Define() { // clang-format on std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -3569,15 +3576,15 @@ void FCesiumPropertyTablePropertySpec::Define() { Describe("GetArray", [this]() { It("returns empty array for non-array property", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::INT32; std::vector values{1, 2, 3, 4, 5, 6}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -3629,8 +3636,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("returns empty array for invalid feature ID", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::INT32; classProperty.array = true; @@ -3640,15 +3647,16 @@ void FCesiumPropertyTablePropertySpec::Define() { std::vector data = GetValuesAsBytes(values); int64 size = static_cast(values.size()) / *classProperty.count; - PropertyTablePropertyView> propertyView( - propertyTableProperty, - classProperty, - size, - gsl::span(data.data(), data.size()), - gsl::span(), - gsl::span(), - PropertyComponentType::None, - PropertyComponentType::None); + CesiumGltf::PropertyTablePropertyView> + propertyView( + propertyTableProperty, + classProperty, + size, + gsl::span(data.data(), data.size()), + gsl::span(), + gsl::span(), + PropertyComponentType::None, + PropertyComponentType::None); FCesiumPropertyTableProperty property(propertyView); TestEqual( "PropertyTablePropertyStatus", @@ -3686,8 +3694,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("returns array for fixed-length array property", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::INT32; classProperty.array = true; @@ -3697,15 +3705,16 @@ void FCesiumPropertyTablePropertySpec::Define() { std::vector data = GetValuesAsBytes(values); int64 size = static_cast(values.size()) / *classProperty.count; - PropertyTablePropertyView> propertyView( - propertyTableProperty, - classProperty, - size, - gsl::span(data.data(), data.size()), - gsl::span(), - gsl::span(), - PropertyComponentType::None, - PropertyComponentType::None); + CesiumGltf::PropertyTablePropertyView> + propertyView( + propertyTableProperty, + classProperty, + size, + gsl::span(data.data(), data.size()), + gsl::span(), + gsl::span(), + PropertyComponentType::None, + PropertyComponentType::None); FCesiumPropertyTableProperty property(propertyView); TestEqual( "PropertyTablePropertyStatus", @@ -3751,8 +3760,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("returns array for variable-length array property", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::INT32; classProperty.array = true; @@ -3764,15 +3773,18 @@ void FCesiumPropertyTablePropertySpec::Define() { std::vector offsetsData = GetValuesAsBytes(offsets); int64 size = static_cast(offsets.size() - 1); - PropertyTablePropertyView> propertyView( - propertyTableProperty, - classProperty, - size, - gsl::span(data.data(), data.size()), - gsl::span(offsetsData.data(), offsetsData.size()), - gsl::span(), - PropertyComponentType::Uint16, - PropertyComponentType::None); + CesiumGltf::PropertyTablePropertyView> + propertyView( + propertyTableProperty, + classProperty, + size, + gsl::span(data.data(), data.size()), + gsl::span( + offsetsData.data(), + offsetsData.size()), + gsl::span(), + PropertyComponentType::Uint16, + PropertyComponentType::None); FCesiumPropertyTableProperty property(propertyView); TestEqual( "PropertyTablePropertyStatus", @@ -3824,8 +3836,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets with noData value", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::INT32; classProperty.array = true; @@ -3837,15 +3849,16 @@ void FCesiumPropertyTablePropertySpec::Define() { std::vector data = GetValuesAsBytes(values); int64 size = static_cast(values.size()) / *classProperty.count; - PropertyTablePropertyView> propertyView( - propertyTableProperty, - classProperty, - size, - gsl::span(data.data(), data.size()), - gsl::span(), - gsl::span(), - PropertyComponentType::None, - PropertyComponentType::None); + CesiumGltf::PropertyTablePropertyView> + propertyView( + propertyTableProperty, + classProperty, + size, + gsl::span(data.data(), data.size()), + gsl::span(), + gsl::span(), + PropertyComponentType::None, + PropertyComponentType::None); FCesiumPropertyTableProperty property(propertyView); TestEqual( "PropertyTablePropertyStatus", @@ -3910,8 +3923,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets with noData / default value", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::INT32; classProperty.array = true; @@ -3924,15 +3937,16 @@ void FCesiumPropertyTablePropertySpec::Define() { std::vector data = GetValuesAsBytes(values); int64 size = static_cast(values.size()) / *classProperty.count; - PropertyTablePropertyView> propertyView( - propertyTableProperty, - classProperty, - size, - gsl::span(data.data(), data.size()), - gsl::span(), - gsl::span(), - PropertyComponentType::None, - PropertyComponentType::None); + CesiumGltf::PropertyTablePropertyView> + propertyView( + propertyTableProperty, + classProperty, + size, + gsl::span(data.data(), data.size()), + gsl::span(), + gsl::span(), + PropertyComponentType::None, + PropertyComponentType::None); FCesiumPropertyTableProperty property(propertyView); TestEqual( "PropertyTablePropertyStatus", @@ -4019,15 +4033,15 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("returns empty value for invalid feature ID", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::INT32; std::vector values{-1, 2, -3, 4}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -4061,15 +4075,15 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets value for valid feature IDs", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::INT32; std::vector values{-1, 2, -3, 4}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -4105,8 +4119,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets with offset / scale", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::FLOAT32; @@ -4119,7 +4133,7 @@ void FCesiumPropertyTablePropertySpec::Define() { classProperty.offset = offset; classProperty.scale = scale; - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -4155,8 +4169,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets with noData", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::INT32; @@ -4166,7 +4180,7 @@ void FCesiumPropertyTablePropertySpec::Define() { std::vector values{-1, 2, -3, 4}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), @@ -4210,8 +4224,8 @@ void FCesiumPropertyTablePropertySpec::Define() { }); It("gets with noData / default value", [this]() { - PropertyTableProperty propertyTableProperty; - ClassProperty classProperty; + CesiumGltf::PropertyTableProperty propertyTableProperty; + CesiumGltf::ClassProperty classProperty; classProperty.type = ClassProperty::Type::SCALAR; classProperty.componentType = ClassProperty::ComponentType::INT32; @@ -4224,7 +4238,7 @@ void FCesiumPropertyTablePropertySpec::Define() { std::vector values{-1, 2, -3, 4}; std::vector data = GetValuesAsBytes(values); - PropertyTablePropertyView propertyView( + CesiumGltf::PropertyTablePropertyView propertyView( propertyTableProperty, classProperty, static_cast(values.size()), diff --git a/Source/CesiumRuntime/Private/Tests/CesiumPropertyTexture.spec.cpp b/Source/CesiumRuntime/Private/Tests/CesiumPropertyTexture.spec.cpp index 7b329481c..512597a5a 100644 --- a/Source/CesiumRuntime/Private/Tests/CesiumPropertyTexture.spec.cpp +++ b/Source/CesiumRuntime/Private/Tests/CesiumPropertyTexture.spec.cpp @@ -9,8 +9,6 @@ #include "Misc/AutomationTest.h" #include -using namespace CesiumGltf; - BEGIN_DEFINE_SPEC( FCesiumPropertyTextureSpec, "Cesium.Unit.PropertyTexture", diff --git a/Source/CesiumRuntime/Private/Tests/CesiumPropertyTextureProperty.spec.cpp b/Source/CesiumRuntime/Private/Tests/CesiumPropertyTextureProperty.spec.cpp index d20bc855c..8229b5ef8 100644 --- a/Source/CesiumRuntime/Private/Tests/CesiumPropertyTextureProperty.spec.cpp +++ b/Source/CesiumRuntime/Private/Tests/CesiumPropertyTextureProperty.spec.cpp @@ -6,8 +6,6 @@ #include "Misc/AutomationTest.h" #include -using namespace CesiumGltf; - BEGIN_DEFINE_SPEC( FCesiumPropertyTexturePropertySpec, "Cesium.Unit.PropertyTextureProperty", diff --git a/Source/CesiumRuntime/Private/Tests/CesiumTextureUtility.spec.cpp b/Source/CesiumRuntime/Private/Tests/CesiumTextureUtility.spec.cpp index 9a16b5af3..764efa69d 100644 --- a/Source/CesiumRuntime/Private/Tests/CesiumTextureUtility.spec.cpp +++ b/Source/CesiumRuntime/Private/Tests/CesiumTextureUtility.spec.cpp @@ -9,7 +9,6 @@ #include #include -using namespace CesiumGltf; using namespace CesiumTextureUtility; using namespace CesiumUtility; @@ -21,7 +20,7 @@ BEGIN_DEFINE_SPEC( std::vector originalPixels; std::vector originalMipPixels; std::vector expectedMipPixelsIfGenerated; -CesiumUtility::IntrusivePointer pImageAsset; +CesiumUtility::IntrusivePointer pImageAsset; void RunTests(); @@ -66,8 +65,8 @@ void CesiumTextureUtilitySpec::Define() { originalPixels.data(), originalPixels.size()); - CesiumUtility::IntrusivePointer pCopy = - new ImageAsset(*pImageAsset); + CesiumUtility::IntrusivePointer pCopy = + new CesiumGltf::ImageAsset(*pImageAsset); CesiumGltfReader::ImageDecoder::generateMipMaps(*pCopy); expectedMipPixelsIfGenerated.clear(); @@ -96,11 +95,11 @@ void CesiumTextureUtilitySpec::Define() { 0x22, 0x42, 0x82, 0xF2, 0x23, 0x43, 0x83, 0xF3, 0x24, 0x44, 0x84, 0xF4, 0x25, 0x45, 0x85, 0xF5}; pImageAsset->mipPositions.emplace_back( - ImageAssetMipPosition{0, originalPixels.size()}); + CesiumGltf::ImageAssetMipPosition{0, originalPixels.size()}); // Mip 1 (1x1) originalMipPixels = {0x26, 0x46, 0x86, 0xF6}; - pImageAsset->mipPositions.emplace_back(ImageAssetMipPosition{ + pImageAsset->mipPositions.emplace_back(CesiumGltf::ImageAssetMipPosition{ pImageAsset->mipPositions[0].byteSize, originalMipPixels.size()}); @@ -170,11 +169,11 @@ void CesiumTextureUtilitySpec::RunTests() { }); It("Image and Sampler", [this]() { - Sampler sampler; - sampler.minFilter = Sampler::MinFilter::NEAREST; - sampler.magFilter = Sampler::MagFilter::NEAREST; - sampler.wrapS = Sampler::WrapS::MIRRORED_REPEAT; - sampler.wrapT = Sampler::WrapT::CLAMP_TO_EDGE; + CesiumGltf::Sampler sampler; + sampler.minFilter = CesiumGltf::Sampler::MinFilter::NEAREST; + sampler.magFilter = CesiumGltf::Sampler::MagFilter::NEAREST; + sampler.wrapS = CesiumGltf::Sampler::WrapS::MIRRORED_REPEAT; + sampler.wrapT = CesiumGltf::Sampler::WrapT::CLAMP_TO_EDGE; TUniquePtr pHalfLoaded = loadTextureFromImageAndSamplerAnyThreadPart( @@ -196,18 +195,18 @@ void CesiumTextureUtilitySpec::RunTests() { }); It("Model", [this]() { - Model model; + CesiumGltf::Model model; - Image& image = model.images.emplace_back(); + CesiumGltf::Image& image = model.images.emplace_back(); image.pAsset = pImageAsset; - Sampler& sampler = model.samplers.emplace_back(); - sampler.minFilter = Sampler::MinFilter::LINEAR_MIPMAP_LINEAR; - sampler.magFilter = Sampler::MagFilter::LINEAR; - sampler.wrapS = Sampler::WrapS::REPEAT; - sampler.wrapT = Sampler::WrapT::MIRRORED_REPEAT; + CesiumGltf::Sampler& sampler = model.samplers.emplace_back(); + sampler.minFilter = CesiumGltf::Sampler::MinFilter::LINEAR_MIPMAP_LINEAR; + sampler.magFilter = CesiumGltf::Sampler::MagFilter::LINEAR; + sampler.wrapS = CesiumGltf::Sampler::WrapS::REPEAT; + sampler.wrapT = CesiumGltf::Sampler::WrapT::MIRRORED_REPEAT; - Texture& texture = model.textures.emplace_back(); + CesiumGltf::Texture& texture = model.textures.emplace_back(); texture.source = 0; texture.sampler = 0; @@ -229,28 +228,28 @@ void CesiumTextureUtilitySpec::RunTests() { }); It("Two textures referencing one image", [this]() { - Model model; + CesiumGltf::Model model; - Image& image = model.images.emplace_back(); + CesiumGltf::Image& image = model.images.emplace_back(); image.pAsset = pImageAsset; - Sampler& sampler1 = model.samplers.emplace_back(); - sampler1.minFilter = Sampler::MinFilter::LINEAR_MIPMAP_LINEAR; - sampler1.magFilter = Sampler::MagFilter::LINEAR; - sampler1.wrapS = Sampler::WrapS::REPEAT; - sampler1.wrapT = Sampler::WrapT::MIRRORED_REPEAT; + CesiumGltf::Sampler& sampler1 = model.samplers.emplace_back(); + sampler1.minFilter = CesiumGltf::Sampler::MinFilter::LINEAR_MIPMAP_LINEAR; + sampler1.magFilter = CesiumGltf::Sampler::MagFilter::LINEAR; + sampler1.wrapS = CesiumGltf::Sampler::WrapS::REPEAT; + sampler1.wrapT = CesiumGltf::Sampler::WrapT::MIRRORED_REPEAT; - Texture& texture1 = model.textures.emplace_back(); + CesiumGltf::Texture& texture1 = model.textures.emplace_back(); texture1.source = 0; texture1.sampler = 0; - Sampler& sampler2 = model.samplers.emplace_back(); - sampler2.minFilter = Sampler::MinFilter::NEAREST; - sampler2.magFilter = Sampler::MagFilter::NEAREST; - sampler2.wrapS = Sampler::WrapS::MIRRORED_REPEAT; - sampler2.wrapT = Sampler::WrapT::REPEAT; + CesiumGltf::Sampler& sampler2 = model.samplers.emplace_back(); + sampler2.minFilter = CesiumGltf::Sampler::MinFilter::NEAREST; + sampler2.magFilter = CesiumGltf::Sampler::MagFilter::NEAREST; + sampler2.wrapS = CesiumGltf::Sampler::WrapS::MIRRORED_REPEAT; + sampler2.wrapT = CesiumGltf::Sampler::WrapT::REPEAT; - Texture& texture2 = model.textures.emplace_back(); + CesiumGltf::Texture& texture2 = model.textures.emplace_back(); texture2.source = 0; texture2.sampler = 1; @@ -296,18 +295,18 @@ void CesiumTextureUtilitySpec::RunTests() { }); It("Loading the same texture twice", [this]() { - Model model; + CesiumGltf::Model model; - Image& image = model.images.emplace_back(); + CesiumGltf::Image& image = model.images.emplace_back(); image.pAsset = pImageAsset; - Sampler& sampler = model.samplers.emplace_back(); - sampler.minFilter = Sampler::MinFilter::LINEAR_MIPMAP_LINEAR; - sampler.magFilter = Sampler::MagFilter::LINEAR; - sampler.wrapS = Sampler::WrapS::REPEAT; - sampler.wrapT = Sampler::WrapT::MIRRORED_REPEAT; + CesiumGltf::Sampler& sampler = model.samplers.emplace_back(); + sampler.minFilter = CesiumGltf::Sampler::MinFilter::LINEAR_MIPMAP_LINEAR; + sampler.magFilter = CesiumGltf::Sampler::MagFilter::LINEAR; + sampler.wrapS = CesiumGltf::Sampler::WrapS::REPEAT; + sampler.wrapT = CesiumGltf::Sampler::WrapT::MIRRORED_REPEAT; - Texture& texture = model.textures.emplace_back(); + CesiumGltf::Texture& texture = model.textures.emplace_back(); texture.source = 0; texture.sampler = 0; @@ -330,7 +329,7 @@ void CesiumTextureUtilitySpec::RunTests() { // Copy the model and load the same texture again. // This time there's no more pixel data, so it's necessary to use the // previously-created texture. - Model model2 = model; + CesiumGltf::Model model2 = model; TUniquePtr pHalfLoaded2 = loadTextureFromModelAnyThreadPart(model2, model.textures[0], true); TestNotNull("pHalfLoaded2", pHalfLoaded2.Get()); @@ -345,18 +344,18 @@ void CesiumTextureUtilitySpec::RunTests() { }); It("Loading the same texture twice from one model", [this]() { - Model model; + CesiumGltf::Model model; - Image& image = model.images.emplace_back(); + CesiumGltf::Image& image = model.images.emplace_back(); image.pAsset = pImageAsset; - Sampler& sampler = model.samplers.emplace_back(); - sampler.minFilter = Sampler::MinFilter::LINEAR_MIPMAP_LINEAR; - sampler.magFilter = Sampler::MagFilter::LINEAR; - sampler.wrapS = Sampler::WrapS::REPEAT; - sampler.wrapT = Sampler::WrapT::MIRRORED_REPEAT; + CesiumGltf::Sampler& sampler = model.samplers.emplace_back(); + sampler.minFilter = CesiumGltf::Sampler::MinFilter::LINEAR_MIPMAP_LINEAR; + sampler.magFilter = CesiumGltf::Sampler::MagFilter::LINEAR; + sampler.wrapS = CesiumGltf::Sampler::WrapS::REPEAT; + sampler.wrapT = CesiumGltf::Sampler::WrapT::MIRRORED_REPEAT; - Texture& texture = model.textures.emplace_back(); + CesiumGltf::Texture& texture = model.textures.emplace_back(); texture.source = 0; texture.sampler = 0; diff --git a/Source/CesiumRuntime/Private/Tests/UnrealMetadataConversions.spec.cpp b/Source/CesiumRuntime/Private/Tests/UnrealMetadataConversions.spec.cpp index a21798d28..f4c9e9af0 100644 --- a/Source/CesiumRuntime/Private/Tests/UnrealMetadataConversions.spec.cpp +++ b/Source/CesiumRuntime/Private/Tests/UnrealMetadataConversions.spec.cpp @@ -6,8 +6,6 @@ #include -using namespace CesiumGltf; - BEGIN_DEFINE_SPEC( FUnrealMetadataConversionsSpec, "Cesium.Unit.MetadataConversions",