Skip to content

Commit

Permalink
Merge pull request #57 from Esri/develop
Browse files Browse the repository at this point in the history
Release 3.0.8905
  • Loading branch information
SGoetschi authored Jun 1, 2023
2 parents 5e7de7e + ea0bedc commit 627323b
Show file tree
Hide file tree
Showing 18 changed files with 131 additions and 31 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 (<https://www.cmake.org>)

### Windows
Expand All @@ -85,14 +85,15 @@ 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`

## Release History and Changelog

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)
Expand Down
62 changes: 62 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
4 changes: 2 additions & 2 deletions examples/prt4cmd/README_linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions examples/prt4cmd/README_windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion examples/prt4cmd/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion examples/prt4cmd/src/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
56 changes: 46 additions & 10 deletions examples/prt4cmd/src/prt4cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/prt4cmd/src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion examples/prt4cmd/src/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -56,6 +56,7 @@ using ConsoleLogHandlerPtr = std::unique_ptr<prt::ConsoleLogHandler, PRTDestroye
using FileLogHandlerPtr = std::unique_ptr<prt::FileLogHandler, PRTDestroyer>;
using EncoderInfoPtr = std::unique_ptr<const prt::EncoderInfo, PRTDestroyer>;
using DecoderInfoPtr = std::unique_ptr<const prt::DecoderInfo, PRTDestroyer>;
using RuleFileInfoPtr = std::unique_ptr<const prt::RuleFileInfo, PRTDestroyer>;

/**
* prt encoder options helpers
Expand Down
2 changes: 1 addition & 1 deletion examples/prt4cmd/test/test_candler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion examples/stldec/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion examples/stldec/src/STLDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion examples/stldec/src/STLDecoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion examples/stldec/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion examples/stlenc/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
4 changes: 2 additions & 2 deletions examples/stlenc/src/STLEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion examples/stlenc/src/STLEncoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion examples/stlenc/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 627323b

Please sign in to comment.