diff --git a/README.md b/README.md index c60eeb36..12233edb 100644 --- a/README.md +++ b/README.md @@ -73,8 +73,8 @@ Please note that the individual example READMEs may include further requirements ### All Platforms -* To load custom encoders built with the latest SDK, CityEngine 2022.1 is required. For older versions of CityEngine an older version of the SDK might have to be used, see [Release History](#release-history-and-changelog). Some SDK versions don't have a matching CityEngine. -* A license for the corresponding CityEngine version. For example, a license for CityEngine 2022.1 to author Rule Packages for the current SDK release. +* To load custom encoders built with the latest SDK, CityEngine 2023.0 is required. For older versions of CityEngine an older version of the SDK might have to be used, see [Release History](#release-history-and-changelog). Some SDK versions don't have a matching CityEngine. +* A license for the corresponding CityEngine version. For example, a license for CityEngine 2023.0 to author Rule Packages for the current SDK release. * CMake 3.3 or later () ### Windows @@ -85,7 +85,7 @@ Please note that the individual example READMEs may include further requirements ### Linux -* RedHat Enterprise Linux 7.x, 8.x or compatible +* RedHat Enterprise Linux 8.x or 9.x and compatible (e.g. Alma Linux or Rocky Linux) * Required C++ compiler: GCC 9.3 or later (RedHat Enterprise Linux DevToolSet 9) * Required flags for extension libraries: `-std=c++17 -D_GLIBCXX_USE_CXX11_ABI=0 -march=nocona -fvisibility=hidden -fvisibility-inlines-hidden -Wl,--exclude-libs,ALL` @@ -93,6 +93,7 @@ Please note that the individual example READMEs may include further requirements A detailed list of changes to the API, CGA language and built-in codecs can be found in the [Changelog](changelog.md). +* [v3.0.8905 (2023-06-10, CityEngine 2023.0)](https://github.com/Esri/cityengine-sdk/releases/tag/3.0.8905) * [v2.7.8603 (2023-02-22, no matching CityEngine version)](https://github.com/Esri/cityengine-sdk/releases/tag/2.7.8603) * [v2.7.8538 (2022-10-24, CityEngine 2022.1)](https://github.com/Esri/cityengine-sdk/releases/tag/2.7.8538) * [v2.6.8300 (2022-06-16, CityEngine 2022.0)](https://github.com/Esri/cityengine-sdk/releases/tag/2.6.8300) diff --git a/changelog.md b/changelog.md index dd5b9b17..0c7aae1e 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,65 @@ +# CITYENGINE SDK 3.0.8905 CHANGELOG + +This section lists changes compared to CityEngine SDK 2.7.8603. + +## General Info +* CityEngine SDK 3.0.8905 is used in CityEngine 2023.0.8905. +* **Client applications must update their code** to find the cgb in a rule package, see details below. It is easy though! +* The CGA Compiler was upgraded to a new major version 2.0. This leads to significant changes: + * New rpks might contain more than one cgb file. Only one of them can be used, and a new function has been introduced to find this main cgb. See `prt::ResolveMap:findCGBKey()` below. The old way of iterating over all keys to find the first cgb does not work anymore since there can now be inner cgbs which must not be used. This is a breaking change - you must adapt your client code! And it is actually much more convenient to use this function, so the change is trivial. + * Rule packages (rpks) created with CityEngine 2023.0 are not compatible with older versions of the CityEngine SDK. For minor version updates of the compiler, forward compatibility (i.e. old PRT, new rpk) is done in a best-effort manner (means: the rpk will work if no new feature of CGA is used). For major version updates this is not the case, an old PRT will refuse to use newer rpks. + +## PRT API +* New function `prt::ResolveMap:findCGBKey()`: This function **must** be used now to find the main cgb file key in the `ResolveMap` from an rpk. +* New function `prt::ResolveMap:findCGBKeys()`: This function is designed for advanced use cases where the `ResolveMap` is manged by the client application and can contain more than one main cgb. +* `prt::createRuleFileInfo()`: the error handling of faulty cgb files got improved. It returns a `RuleFileInfo` also for cgb files with unexpected errors. Before, a nullptr was returned in some cases. Note that `prt::generate()` will still fail on buggy cgb files. + +## PRTX API +* `prtx::GeometryBuilder::GeometryBuilder(const prtx::Geometry& geometry)`: improved robustness (does not crash anymore on geometries created with `prtx::DebugUtils::toGeometry()`) +* Windows: `prtx::FileSystemAdaptor::createStream()`: support for paths with length >= 260 characters. +* Fixed a bug in `prtx::EncodePreparator` where collecting CGA reports led to a cycle, resulting in consumption of all memory. + +## CGA +* New features: + * The new dynamic import feature allows to import and initialize a ruleset at the time of rule invocation. Overrides can be configured with at-runtime evaluated values. +* New Annotations: + * @DisplayName annotation. +* Changes to existing features: + * offset operation: Changed the topology of the resulting offset geometry for each face: At the boundary of border faces no duplicate vertices are created anymore. +* Bugfixes: + * setback, setbackPerEdge, setbackToArea operations: + * Fixed wrong modulo wrapping of large negative index selectors. + * Selectors bottom, top, object.bottom, object.top, world.down, world.up and world.side now work as expected. + * Added support for reading assets and textures that are located at long (>= 260 chars) absolute paths in the filesystem (Windows only). + +## Built-In Codecs +* Unreal Encoder: + * Updated to Datasmith 5.1.0 library. Note that Datasmith 5.X files can not be read in Datasmith 4.X based applications. Use Unreal 5.0+ or Twinmotion 2023.1+. +* USD Encoder: + * Added support for all uv sets and texture layers specified in UsdPreviewSurface (before, only uvs 0 and the colormap were exported) + * Added fallback to dirtmap if there is no colormap. + * Fixed a crash in reports collection (see the fix in `prtx::EncodePreparator` above). + * Windows: Fixed crash if a too long filename was used. + * Fixed a bug where single-channel grey8 textures were not applied in materials. +* USD Decoder: + * Added support for string-valued UsdPrimvarReader varnames (fixes Apple's USDZ sample assets where uvs / textures were missing). + * Added support for 'varying' uv interpolation scheme. + * Now reads uvs also if no texture is set. + * Improved performance for reading from non-file URIs. + * Improved robustness when reading invalid USD files (e.g. fixed a crash if invalid face indices were encountered in the USD file.) +* VOB Encoder: + * Fixed a bug which could lead to a crash on exit. +* OBJ Encoder: + * Fixed a bug which could lead to a crash on exit. +* Collada Encoder: + * Fixed a bug which could lead to a crash on exit. +* CityEngine 3WS WebScene Encoder: + * This encoder got removed. The CityEngine Web Viewer is not available anymore, it is succeeded by the [ArcGIS Scene Viewer](https://www.arcgis.com/home/webscene/viewer.html). Use the SLPK encoder to export and publish your models for ArcGIS Scene Viewer. + +## Misc Changes and Fixes +* Windows: 3rd party symbols are now hidden in com.esri.prt.codecs.dll. +* `prtx::ExtensionManger`: Clarified log messages if loading an extension fails. The warning message saying that the extension could not be loaded was dominated by underlying details which were logged as errors. These details are now logged on debug level. + # CITYENGINE SDK 2.7.8603 CHANGELOG This section lists changes compared to CityEngine SDK 2.7.8538. diff --git a/examples/prt4cmd/README_linux.md b/examples/prt4cmd/README_linux.md index bc30fbe9..bc11e839 100644 --- a/examples/prt4cmd/README_linux.md +++ b/examples/prt4cmd/README_linux.md @@ -28,7 +28,7 @@ Before you start working with this example, please make sure you follow the main 1. Type the following to generate the "candler" building model in the wavefront obj format: ```text - bin/prt4cmd -l 3 -g ../../../data/candler_footprint.obj -p ../../../data/candler.rpk -a ruleFile:string=bin/candler.cgb -a startRule:string=Default\$Footprint -e com.esri.prt.codecs.OBJEncoder -z baseName:string=theCandler + bin/prt4cmd -l 3 -g ../../../data/candler_footprint.obj -p ../../../data/candler.rpk -e com.esri.prt.codecs.OBJEncoder -z baseName:string=theCandler ``` 1. The result is placed in a new `output` directory inside the `install` directory: @@ -38,7 +38,7 @@ Before you start working with this example, please make sure you follow the main 1. To regenerate the same model with a different height, use the following command (note the additional `-a BuildingHeight...` statement): ```text - bin/prt4cmd -l 3 -g ../../../data/candler_footprint.obj -p ../../../data/candler.rpk -a ruleFile:string=bin/candler.cgb -a startRule:string=Default\$Footprint -a BuildingHeight:float=30 -e com.esri.prt.codecs.OBJEncoder -z baseName:string=theCandler + bin/prt4cmd -l 3 -g ../../../data/candler_footprint.obj -p ../../../data/candler.rpk -a BuildingHeight:float=30 -e com.esri.prt.codecs.OBJEncoder -z baseName:string=theCandler ``` 1. The obj file will now contain a model which is 30m high instead of the default 62m. diff --git a/examples/prt4cmd/README_windows.md b/examples/prt4cmd/README_windows.md index 5ad88f5a..6df9e22a 100644 --- a/examples/prt4cmd/README_windows.md +++ b/examples/prt4cmd/README_windows.md @@ -29,7 +29,7 @@ Before you start working with this example, please make sure you follow the main 1. Type the following to generate the "candler" building model in the wavefront obj format: ```text - bin\prt4cmd.exe -l 3 -g ..\..\..\data\candler_footprint.obj -p ..\..\..\data\candler.rpk -a ruleFile:string=bin/candler.cgb -a startRule:string=Default$Footprint -e com.esri.prt.codecs.OBJEncoder -z baseName:string=theCandler + bin\prt4cmd.exe -l 3 -g ..\..\..\data\candler_footprint.obj -p ..\..\..\data\candler.rpk -e com.esri.prt.codecs.OBJEncoder -z baseName:string=theCandler ``` 1. The result is placed in a new `output` directory inside the `install` directory: @@ -39,7 +39,7 @@ Before you start working with this example, please make sure you follow the main 1. To regenerate the same model with a different height, use the following command (note the additional `-a BuildingHeight...` statement): ```text - bin\prt4cmd.exe -l 3 -g ..\..\..\data\candler_footprint.obj -p ..\..\..\data\candler.rpk -a ruleFile:string=bin/candler.cgb -a startRule:string=Default$Footprint -a BuildingHeight:float=30 -e com.esri.prt.codecs.OBJEncoder -z baseName:string=theCandler + bin\prt4cmd.exe -l 3 -g ..\..\..\data\candler_footprint.obj -p ..\..\..\data\candler.rpk -a BuildingHeight:float=30 -e com.esri.prt.codecs.OBJEncoder -z baseName:string=theCandler ``` 1. The obj file will now contain a model which is 30m high instead of the default 62m. diff --git a/examples/prt4cmd/src/CMakeLists.txt b/examples/prt4cmd/src/CMakeLists.txt index 7641318f..639eac14 100644 --- a/examples/prt4cmd/src/CMakeLists.txt +++ b/examples/prt4cmd/src/CMakeLists.txt @@ -34,7 +34,7 @@ if(NOT prt_DIR) set(PRT_TC "gcc93") endif() - set(PRT_VERSION "2.7.8603") + set(PRT_VERSION "3.0.8905") set(PRT_CLS "${PRT_OS}-${PRT_TC}-x86_64-rel-opt") set(PRT_URL "https://github.com/esri/cityengine-sdk/releases/download/${PRT_VERSION}/esri_ce_sdk-${PRT_VERSION}-${PRT_CLS}.zip") diff --git a/examples/prt4cmd/src/logging.h b/examples/prt4cmd/src/logging.h index ab8ab27b..ca874066 100644 --- a/examples/prt4cmd/src/logging.h +++ b/examples/prt4cmd/src/logging.h @@ -5,7 +5,7 @@ * * See README.md in https://github.com/Esri/cityengine-sdk for build instructions. * - * Copyright (c) 2012-2022 Esri R&D Center Zurich + * Copyright (c) 2012-2023 Esri R&D Center Zurich * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/examples/prt4cmd/src/prt4cmd.cpp b/examples/prt4cmd/src/prt4cmd.cpp index bbcdde9a..a75cb36b 100755 --- a/examples/prt4cmd/src/prt4cmd.cpp +++ b/examples/prt4cmd/src/prt4cmd.cpp @@ -5,7 +5,7 @@ * * See README.md in https://github.com/Esri/cityengine-sdk for build instructions. * - * Copyright (c) 2012-2022 Esri R&D Center Zurich + * Copyright (c) 2012-2023 Esri R&D Center Zurich * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -147,24 +147,60 @@ int main(int argc, char* argv[]) { } // -- setup initial shape attributes - std::wstring ruleFile = L"bin/rule.cgb"; - std::wstring startRule = L"default$init"; int32_t seed = 666; const std::wstring shapeName = L"TheInitialShape"; + // ---- seed if (inputArgs.mInitialShapeAttrs) { - if (inputArgs.mInitialShapeAttrs->hasKey(L"ruleFile") && - inputArgs.mInitialShapeAttrs->getType(L"ruleFile") == prt::AttributeMap::PT_STRING) - ruleFile = inputArgs.mInitialShapeAttrs->getString(L"ruleFile"); - if (inputArgs.mInitialShapeAttrs->hasKey(L"startRule") && - inputArgs.mInitialShapeAttrs->getType(L"startRule") == prt::AttributeMap::PT_STRING) - startRule = inputArgs.mInitialShapeAttrs->getString(L"startRule"); if (inputArgs.mInitialShapeAttrs->hasKey(L"seed") && inputArgs.mInitialShapeAttrs->getType(L"seed") == prt::AttributeMap::PT_INT) seed = inputArgs.mInitialShapeAttrs->getInt(L"seed"); } - isb->setAttributes(ruleFile.c_str(), startRule.c_str(), seed, shapeName.c_str(), + // ---- cgb + prt::Status status = prt::STATUS_UNSPECIFIED_ERROR; + const wchar_t* const cgbKey = resolveMap->findCGBKey(&status); + if (cgbKey == nullptr || status != prt::STATUS_OK) { + LOG_ERR << "getting CGB Key from '" << inputArgs.mRulePackageURI << "' failed, aborting."; + return EXIT_FAILURE; + } + + LOG_INF << "Using rule file " << cgbKey; + + // ---- start rule + const wchar_t* const cgbURI = resolveMap->getString(cgbKey, &status); + if(cgbURI == nullptr || status != prt::STATUS_OK) { + LOG_ERR << "getting CGB URI from '" << inputArgs.mRulePackageURI << "' failed, aborting."; + return EXIT_FAILURE; + } + + pcu::RuleFileInfoPtr info{prt::createRuleFileInfo(cgbURI, cache.get(), &status)}; + if(!info || status != prt::STATUS_OK) { + LOG_ERR << "getting rule file info from '" << inputArgs.mRulePackageURI << "' failed, aborting."; + return EXIT_FAILURE; + } + + const prt::RuleFileInfo::Entry* startRule = nullptr; + for (size_t ri = 0; ri < info->getNumRules(); ri++) { + const prt::RuleFileInfo::Entry* const ruleEntry = info->getRule(ri); + if(ruleEntry->getNumParameters() > 0) continue; + for (size_t ai = 0; ai < ruleEntry->getNumAnnotations(); ai++) { + if (wcscmp(ruleEntry->getAnnotation(ai)->getName(), L"@StartRule") == 0) { + startRule = ruleEntry; + break; + } + } + if (startRule != nullptr) break; + } + + if (startRule == nullptr) { + LOG_ERR << "getting start rule from '" << inputArgs.mRulePackageURI << "' failed, aborting."; + return EXIT_FAILURE; + } + + LOG_INF << "Using start rule " << startRule->getName(); + + isb->setAttributes(cgbKey, startRule->getName(), seed, shapeName.c_str(), inputArgs.mInitialShapeAttrs.get(), resolveMap.get()); // -- create initial shape diff --git a/examples/prt4cmd/src/utils.cpp b/examples/prt4cmd/src/utils.cpp index 3c677fde..a1b7e2aa 100644 --- a/examples/prt4cmd/src/utils.cpp +++ b/examples/prt4cmd/src/utils.cpp @@ -5,7 +5,7 @@ * * See README.md in https://github.com/Esri/cityengine-sdk for build instructions. * - * Copyright (c) 2012-2022 Esri R&D Center Zurich + * Copyright (c) 2012-2023 Esri R&D Center Zurich * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/examples/prt4cmd/src/utils.h b/examples/prt4cmd/src/utils.h index ac58745b..f31a55d8 100644 --- a/examples/prt4cmd/src/utils.h +++ b/examples/prt4cmd/src/utils.h @@ -5,7 +5,7 @@ * * See README.md in https://github.com/Esri/cityengine-sdk for build instructions. * - * Copyright (c) 2012-2022 Esri R&D Center Zurich + * Copyright (c) 2012-2023 Esri R&D Center Zurich * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,6 +56,7 @@ using ConsoleLogHandlerPtr = std::unique_ptr; using EncoderInfoPtr = std::unique_ptr; using DecoderInfoPtr = std::unique_ptr; +using RuleFileInfoPtr = std::unique_ptr; /** * prt encoder options helpers diff --git a/examples/prt4cmd/test/test_candler.sh b/examples/prt4cmd/test/test_candler.sh index 04bdd47f..e956afb7 100755 --- a/examples/prt4cmd/test/test_candler.sh +++ b/examples/prt4cmd/test/test_candler.sh @@ -2,7 +2,7 @@ T="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" R="$(dirname "${T}")" -U="https://github.com/Esri/cityengine-sdk/releases/download/2.7.8603/esri_ce_sdk-example_data-v2.zip" +U="https://github.com/Esri/cityengine-sdk/releases/download/3.0.8905/esri_ce_sdk-example_data-v2.zip" D="${R}/data" O="${R}/output" diff --git a/examples/stldec/src/CMakeLists.txt b/examples/stldec/src/CMakeLists.txt index 1968ab79..dbda4fc3 100644 --- a/examples/stldec/src/CMakeLists.txt +++ b/examples/stldec/src/CMakeLists.txt @@ -43,7 +43,7 @@ if(NOT prt_DIR) set(PRT_TC "gcc93") endif() - set(PRT_VERSION "2.7.8603") + set(PRT_VERSION "3.0.8905") set(PRT_CLS "${PRT_OS}-${PRT_TC}-x86_64-rel-opt") set(PRT_URL "https://github.com/esri/cityengine-sdk/releases/download/${PRT_VERSION}/esri_ce_sdk-${PRT_VERSION}-${PRT_CLS}.zip") diff --git a/examples/stldec/src/STLDecoder.cpp b/examples/stldec/src/STLDecoder.cpp index 6dff98dc..2fefb73c 100644 --- a/examples/stldec/src/STLDecoder.cpp +++ b/examples/stldec/src/STLDecoder.cpp @@ -9,7 +9,7 @@ * Written by Simon Haegler * Esri R&D Center Zurich, Switzerland * - * Copyright 2012-2022 (c) Esri R&D Center Zurich + * Copyright 2012-2023 (c) Esri R&D Center Zurich * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/examples/stldec/src/STLDecoder.h b/examples/stldec/src/STLDecoder.h index b28f65cb..71f274b0 100644 --- a/examples/stldec/src/STLDecoder.h +++ b/examples/stldec/src/STLDecoder.h @@ -9,7 +9,7 @@ * Written by Simon Haegler * Esri R&D Center Zurich, Switzerland * - * Copyright 2012-2022 (c) Esri R&D Center Zurich + * Copyright 2012-2023 (c) Esri R&D Center Zurich * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/examples/stldec/src/main.cpp b/examples/stldec/src/main.cpp index 2bb2ffe6..2ddbff88 100644 --- a/examples/stldec/src/main.cpp +++ b/examples/stldec/src/main.cpp @@ -9,7 +9,7 @@ * Written by Simon Haegler * Esri R&D Center Zurich, Switzerland * - * Copyright 2012-2022 (c) Esri R&D Center Zurich + * Copyright 2012-2023 (c) Esri R&D Center Zurich * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/examples/stlenc/src/CMakeLists.txt b/examples/stlenc/src/CMakeLists.txt index 381d8e3b..4e0d8898 100644 --- a/examples/stlenc/src/CMakeLists.txt +++ b/examples/stlenc/src/CMakeLists.txt @@ -31,7 +31,7 @@ if(NOT prt_DIR) set(PRT_TC "gcc93") endif() - set(PRT_VERSION "2.7.8603") + set(PRT_VERSION "3.0.8905") set(PRT_CLS "${PRT_OS}-${PRT_TC}-x86_64-rel-opt") set(PRT_URL "https://github.com/esri/cityengine-sdk/releases/download/${PRT_VERSION}/esri_ce_sdk-${PRT_VERSION}-${PRT_CLS}.zip") diff --git a/examples/stlenc/src/STLEncoder.cpp b/examples/stlenc/src/STLEncoder.cpp index 982a48d4..2aa5229a 100644 --- a/examples/stlenc/src/STLEncoder.cpp +++ b/examples/stlenc/src/STLEncoder.cpp @@ -9,7 +9,7 @@ * Written by Simon Haegler * Esri R&D Center Zurich, Switzerland * - * Copyright 2012-2022 (c) Esri R&D Center Zurich + * Copyright 2012-2023 (c) Esri R&D Center Zurich * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,7 +46,7 @@ const wchar_t* WNL = L"\n"; const prtx::EncodePreparator::PreparationFlags ENC_PREP_FLAGS = prtx::EncodePreparator::PreparationFlags() .instancing(false) - .mergeByMaterial(true) + .meshMerging(prtx::MeshMerging::ALL_OF_SAME_MATERIAL_AND_TYPE) .triangulate(true) .mergeVertices(true) .cleanupVertexNormals(true) diff --git a/examples/stlenc/src/STLEncoder.h b/examples/stlenc/src/STLEncoder.h index 6fb0103d..4d7d974a 100644 --- a/examples/stlenc/src/STLEncoder.h +++ b/examples/stlenc/src/STLEncoder.h @@ -9,7 +9,7 @@ * Written by Simon Haegler * Esri R&D Center Zurich, Switzerland * - * Copyright 2012-2022 (c) Esri R&D Center Zurich + * Copyright 2012-2023 (c) Esri R&D Center Zurich * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/examples/stlenc/src/main.cpp b/examples/stlenc/src/main.cpp index 1caf0a27..02915e7a 100644 --- a/examples/stlenc/src/main.cpp +++ b/examples/stlenc/src/main.cpp @@ -9,7 +9,7 @@ * Written by Simon Haegler * Esri R&D Center Zurich, Switzerland * - * Copyright 2012-2022 (c) Esri R&D Center Zurich + * Copyright 2012-2023 (c) Esri R&D Center Zurich * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.