From fbdaf3f780d17fa05754a45986e1b6c09916399c Mon Sep 17 00:00:00 2001 From: Ashley Rogers Date: Mon, 9 Dec 2024 15:52:05 -0500 Subject: [PATCH 1/6] Improve Unity Doxygen --- .gitmodules | 3 ++ Documentation/.gitignore | 1 + {Documentation~ => Documentation}/Doxyfile | 33 ++++++++++-------- .../creating-monobehaviours.md | 12 ++++--- Documentation/developer-resources.md | 6 ++++ .../developer-setup.md | 7 ++-- Documentation/doxygen-awesome-css | 1 + .../images/CameraSettings.png | Bin .../images/Cesium-128x128.png | Bin .../images/Cesium_for_Unity-Logo-WhiteBGH.jpg | Bin .../images/cesium-for-unity-screenshot.jpg | Bin .../images/integration-workflow_Unity.png | Bin .../release-guide.md | 3 +- README.md | 22 ++++++------ Reinterop~/README.md | 3 +- Runtime/CesiumPropertyTable.cs | 2 +- Runtime/CesiumSimplePlanarEllipsoidCurve.cs | 2 ++ package.json | 2 +- 18 files changed, 59 insertions(+), 38 deletions(-) create mode 100644 Documentation/.gitignore rename {Documentation~ => Documentation}/Doxyfile (99%) rename {Documentation~ => Documentation}/creating-monobehaviours.md (94%) create mode 100644 Documentation/developer-resources.md rename {Documentation~ => Documentation}/developer-setup.md (98%) create mode 160000 Documentation/doxygen-awesome-css rename {Documentation~ => Documentation}/images/CameraSettings.png (100%) rename {Documentation~ => Documentation}/images/Cesium-128x128.png (100%) rename {Documentation~ => Documentation}/images/Cesium_for_Unity-Logo-WhiteBGH.jpg (100%) rename {Documentation~ => Documentation}/images/cesium-for-unity-screenshot.jpg (100%) rename {Documentation~ => Documentation}/images/integration-workflow_Unity.png (100%) rename {Documentation~ => Documentation}/release-guide.md (98%) diff --git a/.gitmodules b/.gitmodules index 0a9976d6..9be55411 100644 --- a/.gitmodules +++ b/.gitmodules @@ -11,3 +11,6 @@ path = native~/extern/swl-variant url = https://github.com/kring/swl-variant.git branch = exception-public-inheritance +[submodule "Documentation/doxygen-awesome-css"] + path = Documentation/doxygen-awesome-css + url = https://github.com/jothepro/doxygen-awesome-css.git diff --git a/Documentation/.gitignore b/Documentation/.gitignore new file mode 100644 index 00000000..7fe5ea7c --- /dev/null +++ b/Documentation/.gitignore @@ -0,0 +1 @@ +Reference/ \ No newline at end of file diff --git a/Documentation~/Doxyfile b/Documentation/Doxyfile similarity index 99% rename from Documentation~/Doxyfile rename to Documentation/Doxyfile index b752fae8..ddbf92cf 100644 --- a/Documentation~/Doxyfile +++ b/Documentation/Doxyfile @@ -48,27 +48,27 @@ PROJECT_NAME = "Cesium for Unity" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = +PROJECT_NUMBER = $(npm_package_version) # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a # quick idea about the purpose of the project. Keep the description short. -PROJECT_BRIEF = "Unlock the 3D geospatial ecosystem in Unity with real-world 3D content and a high accuracy full-scale WGS84 globe." +PROJECT_BRIEF = # With the PROJECT_LOGO tag one can specify a logo or an icon that is included # in the documentation. The maximum height of the logo should not exceed 55 # pixels and the maximum width should not exceed 200 pixels. Doxygen will copy # the logo to the output directory. -PROJECT_LOGO = ./Documentation~/images/Cesium-128x128.png +PROJECT_LOGO = ./Documentation/images/Cesium-128x128.png # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path # into which the generated documentation will be written. If a relative path is # entered, it will be relative to the location where doxygen was started. If # left blank the current directory will be used. -OUTPUT_DIRECTORY = ./Documentation~/Reference +OUTPUT_DIRECTORY = ./Documentation/Reference # If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096 # sub-directories (in 2 levels) under the output directory of each output format @@ -372,7 +372,7 @@ TOC_INCLUDE_HEADINGS = 5 # The default value is: DOXYGEN. # This tag requires that the tag MARKDOWN_SUPPORT is set to YES. -MARKDOWN_ID_STYLE = DOXYGEN +MARKDOWN_ID_STYLE = GITHUB # When enabled doxygen tries to link words that correspond to documented # classes, or namespaces to their corresponding documentation. Such a link can @@ -390,7 +390,7 @@ AUTOLINK_SUPPORT = YES # diagrams that involve STL classes more complete and accurate. # The default value is: NO. -BUILTIN_STL_SUPPORT = NO +BUILTIN_STL_SUPPORT = YES # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. @@ -943,7 +943,10 @@ WARN_LOGFILE = # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = ./Runtime +INPUT = ./Runtime \ + ./Documentation/ \ + ./README.md \ + ./Reinterop~/README.md # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses @@ -1093,7 +1096,7 @@ EXAMPLE_RECURSIVE = NO # that contain images that are to be included in the documentation (see the # \image command). -IMAGE_PATH = +IMAGE_PATH = ./Documentation/images # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program @@ -1154,7 +1157,7 @@ FILTER_SOURCE_PATTERNS = # (index.html). This can be useful if you have a project on for instance GitHub # and want to reuse the introduction page also for the doxygen output. -USE_MDFILE_AS_MAINPAGE = +USE_MDFILE_AS_MAINPAGE = ./README.md # The Fortran standard specifies that for fixed formatted Fortran code all # characters from position 72 are to be considered as comment. A common @@ -1176,7 +1179,7 @@ FORTRAN_COMMENT_AFTER = 72 # also VERBATIM_HEADERS is set to NO. # The default value is: NO. -SOURCE_BROWSER = NO +SOURCE_BROWSER = YES # Setting the INLINE_SOURCES tag to YES will include the body of functions, # classes and enums directly into the documentation. @@ -1393,7 +1396,7 @@ HTML_STYLESHEET = # documentation. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_EXTRA_STYLESHEET = +HTML_EXTRA_STYLESHEET = ./Documentation/doxygen-awesome-css/doxygen-awesome.css # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note @@ -1416,7 +1419,7 @@ HTML_EXTRA_FILES = # The default value is: AUTO_LIGHT. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_COLORSTYLE = AUTO_LIGHT +HTML_COLORSTYLE = LIGHT # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # will adjust the colors in the style sheet and background images according to @@ -1717,7 +1720,7 @@ DISABLE_INDEX = NO # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. -GENERATE_TREEVIEW = NO +GENERATE_TREEVIEW = YES # When both GENERATE_TREEVIEW and DISABLE_INDEX are set to YES, then the # FULL_SIDEBAR option determines if the side bar is limited to only the treeview @@ -2455,14 +2458,14 @@ ALLEXTERNALS = NO # listed. # The default value is: YES. -EXTERNAL_GROUPS = YES +EXTERNAL_GROUPS = NO # If the EXTERNAL_PAGES tag is set to YES, all external pages will be listed in # the related pages index. If set to NO, only the current project's pages will # be listed. # The default value is: YES. -EXTERNAL_PAGES = YES +EXTERNAL_PAGES = NO #--------------------------------------------------------------------------- # Configuration options related to diagram generator tools diff --git a/Documentation~/creating-monobehaviours.md b/Documentation/creating-monobehaviours.md similarity index 94% rename from Documentation~/creating-monobehaviours.md rename to Documentation/creating-monobehaviours.md index e57becb3..41f8571f 100644 --- a/Documentation~/creating-monobehaviours.md +++ b/Documentation/creating-monobehaviours.md @@ -1,3 +1,5 @@ +# Creating MonoBehaviours {#creating-monobehaviours} + Guidelines and tips for creating MonoBehaviours in Cesium for Unity. ## Avoid implementing non-static methods in C++ @@ -25,11 +27,11 @@ If you don't need C++-specific state, static methods are _much_ more efficient. Carefully consider every field that you add to the class. In general, only the essential fields necessary to reconstruct the state of the object should by marked `[SerializeField]`. Cached and derived fields should instead be marked `[NonSerialized]`. Fields without any attribute should be extremely rare. -| *Characteristic* | *`[SerializeField]`* | *No attribute* | *`[NonSerialized]`* | -|-------------------------------|----------------------|--------------|-------------------| -| Saved / Loaded with the Scene | ✅ | ❌ | ❌ | -| Preserved on script change / AppDomain reload | ✅ | ✅ | ❌ | -| Transfers from Edit mode to Play mode | ✅ | ❌ | ❌ | +| *Characteristic* | *`[SerializeField]`* | *No attribute* | *`[NonSerialized]`* | +| --------------------------------------------- | -------------------- | -------------- | ------------------- | +| Saved / Loaded with the Scene | ✅ | ❌ | ❌ | +| Preserved on script change / AppDomain reload | ✅ | ✅ | ❌ | +| Transfers from Edit mode to Play mode | ✅ | ❌ | ❌ | ## Backward compatibility diff --git a/Documentation/developer-resources.md b/Documentation/developer-resources.md new file mode 100644 index 00000000..5744cd79 --- /dev/null +++ b/Documentation/developer-resources.md @@ -0,0 +1,6 @@ +# Developer Resources {#developer-resources} + +- \subpage developer-setup +- \subpage reinterop +- \subpage creating-monobehaviours +- \subpage release-guide \ No newline at end of file diff --git a/Documentation~/developer-setup.md b/Documentation/developer-setup.md similarity index 98% rename from Documentation~/developer-setup.md rename to Documentation/developer-setup.md index b4e121cb..fa12261d 100644 --- a/Documentation~/developer-setup.md +++ b/Documentation/developer-setup.md @@ -1,8 +1,9 @@ -# Overview +# Developer Setup {#developer-setup} This is a summary of the setup and workflows for developers who want to modify the Cesium for Unity plugin. If you just want to use Cesium for Unity in your own applications, see the main [README](../README.md). + -## :computer: Building Cesium for Unity +## 🖥️ Building Cesium for Unity ### Prerequisites @@ -38,7 +39,7 @@ git clone --recurse-submodules git@github.com:CesiumGS/cesium-unity.git com.cesi Be sure to also clone the submodules. If you forgot the `--recurse-submodules` option when you cloned, run `git submodule update --init --recursive` inside the `com.cesium.unity` folder. -## Reinterop +## Reinterop {#reinterop-guide} Reinterop is a Roslyn (C# compiler) source generator that is automatically invoked by Unity while compiling the Cesium for Unity C# code, and generates C# <-> C++ interop layer. diff --git a/Documentation/doxygen-awesome-css b/Documentation/doxygen-awesome-css new file mode 160000 index 00000000..af1d9030 --- /dev/null +++ b/Documentation/doxygen-awesome-css @@ -0,0 +1 @@ +Subproject commit af1d9030b3ffa7b483fa9997a7272fb12af6af4c diff --git a/Documentation~/images/CameraSettings.png b/Documentation/images/CameraSettings.png similarity index 100% rename from Documentation~/images/CameraSettings.png rename to Documentation/images/CameraSettings.png diff --git a/Documentation~/images/Cesium-128x128.png b/Documentation/images/Cesium-128x128.png similarity index 100% rename from Documentation~/images/Cesium-128x128.png rename to Documentation/images/Cesium-128x128.png diff --git a/Documentation~/images/Cesium_for_Unity-Logo-WhiteBGH.jpg b/Documentation/images/Cesium_for_Unity-Logo-WhiteBGH.jpg similarity index 100% rename from Documentation~/images/Cesium_for_Unity-Logo-WhiteBGH.jpg rename to Documentation/images/Cesium_for_Unity-Logo-WhiteBGH.jpg diff --git a/Documentation~/images/cesium-for-unity-screenshot.jpg b/Documentation/images/cesium-for-unity-screenshot.jpg similarity index 100% rename from Documentation~/images/cesium-for-unity-screenshot.jpg rename to Documentation/images/cesium-for-unity-screenshot.jpg diff --git a/Documentation~/images/integration-workflow_Unity.png b/Documentation/images/integration-workflow_Unity.png similarity index 100% rename from Documentation~/images/integration-workflow_Unity.png rename to Documentation/images/integration-workflow_Unity.png diff --git a/Documentation~/release-guide.md b/Documentation/release-guide.md similarity index 98% rename from Documentation~/release-guide.md rename to Documentation/release-guide.md index e8c39d02..a9d236e9 100644 --- a/Documentation~/release-guide.md +++ b/Documentation/release-guide.md @@ -1,6 +1,7 @@ -# Releasing a new version of Cesium for Unity +# Releasing a new version of Cesium for Unity {#release-guide} This is the process we follow when releasing a new version of Cesium for Unity on GitHub. + ## Test the release candidate diff --git a/README.md b/README.md index 50467cfd..06cb2e82 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -[![Cesium for Unity Logo](Documentation~/images/Cesium_for_Unity-Logo-WhiteBGH.jpg)](https://cesium.com/) +[![Cesium for Unity Logo](Documentation/images/Cesium_for_Unity-Logo-WhiteBGH.jpg)](https://cesium.com/) Cesium for Unity enables building 3D geospatial applications and experiences with 3D Tiles and open standards using Unity 3D. By combining a high-accuracy full-scale WGS84 globe, open APIs and open standards for spatial indexing such as 3D Tiles, and cloud-based real-world content from [Cesium ion](https://cesium.com/cesium-ion) with Unity, this plugin enables rich 3D geospatial workflows and applications in Unity. [Cesium for Unity Homepage](https://cesium.com/platform/cesium-for-unity?utm_source=github&utm_medium=github&utm_campaign=unity) -### :rocket: Get Started +### 🚀 Get Started **[Download Cesium for Unity Samples](https://github.com/CesiumGS/cesium-unity-samples/releases/latest)** @@ -12,28 +12,28 @@ Cesium for Unity enables building 3D geospatial applications and experiences wit Have questions? Ask them on the [community forum](https://community.cesium.com/c/cesium-for-unity). -### :clap: Featured Demos +### 👏 Featured Demos - +[![](Documentation/images/cesium-for-unity-screenshot.jpg)](https://github.com/CesiumGS/cesium-unity-samples) -### :house_with_garden: Cesium for Unity and the 3D Geospatial Ecosystem +### 🏡 Cesium for Unity and the 3D Geospatial Ecosystem Cesium for Unity streams real-world 3D content such as high-resolution photogrammetry, terrain, imagery, and 3D buildings from [Cesium ion](https://cesium.com/cesium-ion) and other sources, available as optional commercial subscriptions. The plugin includes Cesium ion integration for instant access to global high-resolution 3D content ready for runtime streaming. Cesium ion users can also leverage cloud-based 3D tiling pipelines to create end-to-end workflows to transform massive heterogenous content into semantically-rich 3D Tiles, ready for streaming to Unity. Cesium for Unity supports cloud and private network content and services based on open standards and APIs. You are free to use any combination of supported content sources, standards, APIs with Cesium for Unity. -![Cesium for Unity Architecture](./Documentation~/images/integration-workflow_Unity.png) +![Cesium for Unity Architecture](Documentation/images/integration-workflow_Unity.png) -Using Cesium ion helps support Cesium for Unity development. :heart: +Using Cesium ion helps support Cesium for Unity development. ❤️ -### :chains: Unity Integration +### ⛓️ Unity Integration Cesium for Unity is tightly integrated with Unity making it possible to visualize and interact with real-world content in editor and at runtime. The plugin also has support for Unity game objects, physics, collisions, and character interaction. Leverage decades worth of cutting-edge advancements in Unity and geospatial to create cohesive, interactive, and realistic simulations and applications with Cesium for Unity. -### :green_book: License +### 📗 License [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.html). Cesium for Unity is free for both commercial and non-commercial use. -### :computer: Developing Cesium for Unity +### 🖥️ Developing Cesium for Unity -See the [Developer Setup Guide](Documentation~/developer-setup.md) to learn how to set up a development environment for Cesium for Unity, allowing you to compile it, customize it, and contribute to its development. +See the [Developer Setup Guide](Documentation/developer-setup.md) to learn how to set up a development environment for Cesium for Unity, allowing you to compile it, customize it, and contribute to its development. diff --git a/Reinterop~/README.md b/Reinterop~/README.md index 2665c013..c94a0ca3 100644 --- a/Reinterop~/README.md +++ b/Reinterop~/README.md @@ -1,6 +1,7 @@ -# Reinterop +# Reinterop {#reinterop} Reinterop generates C# and C++ code to allow a .NET library to be seamlessly used from C++ code. + **Note: Reinterop currently requires the latest preview version of Visual Studio 2022, because it uses C# 11 / .NET 7. However, the generated code can be used almost anywhere, including in Unity's version of Mono.** diff --git a/Runtime/CesiumPropertyTable.cs b/Runtime/CesiumPropertyTable.cs index e87a8a00..eaad4522 100644 --- a/Runtime/CesiumPropertyTable.cs +++ b/Runtime/CesiumPropertyTable.cs @@ -103,8 +103,8 @@ public Dictionary GetMetadataValuesForFeature(Int64 /// If the feature ID is out-of-bounds, the returned dictionary will be empty. /// /// + /// The dictionary of values that will be cleared and filled by this method. /// The ID of the feature. - /// A dictionary of the property values mapped by property name. public void GetMetadataValuesForFeature(Dictionary values, Int64 featureId) { values.Clear(); diff --git a/Runtime/CesiumSimplePlanarEllipsoidCurve.cs b/Runtime/CesiumSimplePlanarEllipsoidCurve.cs index 22830bfa..d4060d04 100644 --- a/Runtime/CesiumSimplePlanarEllipsoidCurve.cs +++ b/Runtime/CesiumSimplePlanarEllipsoidCurve.cs @@ -25,6 +25,7 @@ public static CesiumSimplePlanarEllipsoidCurve FromEarthCenteredEarthFixedCoordi /// Creates a new object from a pair of /// Ellipsoid-Centered, Ellipsoid-Fixed coordinates describing the beginning and end points of the curve. /// + /// The ellipsoid to use for this curve. /// The start point of the curve. /// The end point of the curve. /// @@ -46,6 +47,7 @@ public static CesiumSimplePlanarEllipsoidCurve FromCenteredFixedCoordinates(Cesi /// Creates a new object from a pair of cartographic /// coordinates (Longitude, Latitude, and Height) describing the beginning and end points of the curve. /// + /// The ellipsoid to use for this curve. /// The start point of the curve. /// The end point of the curve. /// diff --git a/package.json b/package.json index 08fbb97e..bf5d638a 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "url": "https://cesium.com" }, "scripts": { - "doxygen": "doxygen ./Documentation~/Doxyfile" + "doxygen": "doxygen ./Documentation/Doxyfile" }, "changelogUrl": "https://github.com/CesiumGS/cesium-unity/blob/main/CHANGES.md", "documentationUrl": "https://cesium.com/learn/unity/", From 93d23e8cade1f2b3ae98cf65e80f15f20dc6d5d6 Mon Sep 17 00:00:00 2001 From: Ashley Rogers Date: Mon, 9 Dec 2024 15:55:24 -0500 Subject: [PATCH 2/6] Use latest Doxygen on CI --- .github/workflows/build.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8bdd82a7..5ed2e445 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,12 @@ jobs: steps: - name: Install Doxygen run: | - sudo apt install -y doxygen + cd ~ + wget https://github.com/doxygen/doxygen/releases/download/Release_1_12_0/doxygen-1.12.0.linux.bin.tar.gz + tar xzf doxygen-1.12.0.linux.bin.tar.gz + export PATH=$PWD/doxygen-1.12.0/bin:$PATH + echo "PATH=$PATH" >> "$GITHUB_ENV" + doxygen --version - name: Check out repository code uses: actions/checkout@v4 with: From 2e1070efee218b1b11cc6048df70c761f6678ed0 Mon Sep 17 00:00:00 2001 From: Ashley Rogers Date: Mon, 9 Dec 2024 15:56:59 -0500 Subject: [PATCH 3/6] Remove remaining references to Documentation~ --- .github/workflows/build.yml | 4 ++-- .gitignore | 2 +- Build~/Package.cs | 2 +- Documentation/.gitignore | 1 - 4 files changed, 4 insertions(+), 5 deletions(-) delete mode 100644 Documentation/.gitignore diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5ed2e445..27307baf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,13 +27,13 @@ jobs: submodules: recursive - name: Generate Documentation run: | - doxygen ./Documentation~/Doxyfile + doxygen ./Documentation/Doxyfile - name: Publish Documentation Artifact if: ${{ success() }} uses: actions/upload-artifact@v4 with: name: ReferenceDocumentation - path: Documentation~/Reference + path: Documentation/Reference Windows: needs: [QuickChecks] runs-on: windows-latest diff --git a/.gitignore b/.gitignore index ca161803..d1e0f910 100644 --- a/.gitignore +++ b/.gitignore @@ -22,4 +22,4 @@ libCesiumForUnityNative-*.so libCesiumForUnityNative-*.so.meta libCesiumForUnityNative-*.dylib libCesiumForUnityNative-*.dylib.meta -Documentation~/Reference/ \ No newline at end of file +Documentation/Reference/ \ No newline at end of file diff --git a/Build~/Package.cs b/Build~/Package.cs index 2225001b..52f13562 100644 --- a/Build~/Package.cs +++ b/Build~/Package.cs @@ -401,7 +401,7 @@ private static void CopyPackageContents(string sourcePath, string targetPath) "Editor", "Runtime", "Tests", - "Documentation~", + "Documentation", "Plugins" }; diff --git a/Documentation/.gitignore b/Documentation/.gitignore deleted file mode 100644 index 7fe5ea7c..00000000 --- a/Documentation/.gitignore +++ /dev/null @@ -1 +0,0 @@ -Reference/ \ No newline at end of file From cd7c1470219fdd9b59688de2749699b9bd6487c2 Mon Sep 17 00:00:00 2001 From: Kevin Ring Date: Mon, 16 Dec 2024 20:17:56 +1100 Subject: [PATCH 4/6] Fix shared image crash. --- CHANGES.md | 6 ++++++ native~/Runtime/src/UnityPrepareRendererResources.cpp | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 69046a2c..51d33e96 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,11 @@ # Change Log +## ? - ? + +##### Fixes :wrench: + +- Fixed a bug that could cause a crash or incorrect textures when multiple `Cesium3DTileset` tiles referenced the same image by URL. + ## v1.14.0 - 2024-12-02 ##### Additions :tada: diff --git a/native~/Runtime/src/UnityPrepareRendererResources.cpp b/native~/Runtime/src/UnityPrepareRendererResources.cpp index d56d0903..f2c5c57a 100644 --- a/native~/Runtime/src/UnityPrepareRendererResources.cpp +++ b/native~/Runtime/src/UnityPrepareRendererResources.cpp @@ -268,6 +268,15 @@ void generateMipMaps( const Sampler* pSampler = Model::getSafe(&pModel->samplers, pTexture->sampler); if (pImage && pSampler) { + // We currently do not support shared resources, so if this image is + // associated with a depot, unshare it. This is necessary to avoid a + // race condition where multiple threads attempt to generate mipmaps for + // the same shared image simultaneously. + if (pImage->pAsset && pImage->pAsset->getDepot() != nullptr) { + // Copy the asset. + pImage->pAsset.emplace(*pImage->pAsset); + } + switch (pSampler->minFilter.value_or( CesiumGltf::Sampler::MinFilter::LINEAR_MIPMAP_LINEAR)) { case CesiumGltf::Sampler::MinFilter::LINEAR_MIPMAP_LINEAR: From 40592520f5d5a20974f9aa90dd2a9f5d9960e0a2 Mon Sep 17 00:00:00 2001 From: Ashley Rogers Date: Mon, 16 Dec 2024 16:45:48 -0500 Subject: [PATCH 5/6] Copy images to work around Doxygen issue --- .github/workflows/build.yml | 4 ++-- .gitignore | 2 +- .gitmodules | 4 ++-- Build~/Package.cs | 2 +- {Documentation => Documentation~}/Doxyfile | 10 +++++----- Documentation~/copy-images.js | 18 ++++++++++++++++++ .../creating-monobehaviours.md | 0 .../developer-resources.md | 0 .../developer-setup.md | 0 .../doxygen-awesome-css | 0 .../images/CameraSettings.png | Bin .../images/Cesium-128x128.png | Bin .../images/Cesium_for_Unity-Logo-WhiteBGH.jpg | Bin .../images/cesium-for-unity-screenshot.jpg | Bin .../images/integration-workflow_Unity.png | Bin .../release-guide.md | 0 README.md | 8 ++++---- package.json | 2 +- 18 files changed, 34 insertions(+), 16 deletions(-) rename {Documentation => Documentation~}/Doxyfile (99%) create mode 100644 Documentation~/copy-images.js rename {Documentation => Documentation~}/creating-monobehaviours.md (100%) rename {Documentation => Documentation~}/developer-resources.md (100%) rename {Documentation => Documentation~}/developer-setup.md (100%) rename {Documentation => Documentation~}/doxygen-awesome-css (100%) rename {Documentation => Documentation~}/images/CameraSettings.png (100%) rename {Documentation => Documentation~}/images/Cesium-128x128.png (100%) rename {Documentation => Documentation~}/images/Cesium_for_Unity-Logo-WhiteBGH.jpg (100%) rename {Documentation => Documentation~}/images/cesium-for-unity-screenshot.jpg (100%) rename {Documentation => Documentation~}/images/integration-workflow_Unity.png (100%) rename {Documentation => Documentation~}/release-guide.md (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 27307baf..e7234e81 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,13 +27,13 @@ jobs: submodules: recursive - name: Generate Documentation run: | - doxygen ./Documentation/Doxyfile + npm run doxygen - name: Publish Documentation Artifact if: ${{ success() }} uses: actions/upload-artifact@v4 with: name: ReferenceDocumentation - path: Documentation/Reference + path: Documentation~/Reference Windows: needs: [QuickChecks] runs-on: windows-latest diff --git a/.gitignore b/.gitignore index d1e0f910..ca161803 100644 --- a/.gitignore +++ b/.gitignore @@ -22,4 +22,4 @@ libCesiumForUnityNative-*.so libCesiumForUnityNative-*.so.meta libCesiumForUnityNative-*.dylib libCesiumForUnityNative-*.dylib.meta -Documentation/Reference/ \ No newline at end of file +Documentation~/Reference/ \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index 9be55411..03b27fbd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -11,6 +11,6 @@ path = native~/extern/swl-variant url = https://github.com/kring/swl-variant.git branch = exception-public-inheritance -[submodule "Documentation/doxygen-awesome-css"] - path = Documentation/doxygen-awesome-css +[submodule "Documentation~/doxygen-awesome-css"] + path = Documentation~/doxygen-awesome-css url = https://github.com/jothepro/doxygen-awesome-css.git diff --git a/Build~/Package.cs b/Build~/Package.cs index 52f13562..2225001b 100644 --- a/Build~/Package.cs +++ b/Build~/Package.cs @@ -401,7 +401,7 @@ private static void CopyPackageContents(string sourcePath, string targetPath) "Editor", "Runtime", "Tests", - "Documentation", + "Documentation~", "Plugins" }; diff --git a/Documentation/Doxyfile b/Documentation~/Doxyfile similarity index 99% rename from Documentation/Doxyfile rename to Documentation~/Doxyfile index ddbf92cf..00dd714e 100644 --- a/Documentation/Doxyfile +++ b/Documentation~/Doxyfile @@ -61,14 +61,14 @@ PROJECT_BRIEF = # pixels and the maximum width should not exceed 200 pixels. Doxygen will copy # the logo to the output directory. -PROJECT_LOGO = ./Documentation/images/Cesium-128x128.png +PROJECT_LOGO = ./Documentation~/images/Cesium-128x128.png # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path # into which the generated documentation will be written. If a relative path is # entered, it will be relative to the location where doxygen was started. If # left blank the current directory will be used. -OUTPUT_DIRECTORY = ./Documentation/Reference +OUTPUT_DIRECTORY = ./Documentation~/Reference # If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096 # sub-directories (in 2 levels) under the output directory of each output format @@ -944,7 +944,7 @@ WARN_LOGFILE = # Note: If this tag is empty the current directory is searched. INPUT = ./Runtime \ - ./Documentation/ \ + ./Documentation~/ \ ./README.md \ ./Reinterop~/README.md @@ -1096,7 +1096,7 @@ EXAMPLE_RECURSIVE = NO # that contain images that are to be included in the documentation (see the # \image command). -IMAGE_PATH = ./Documentation/images +IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program @@ -1396,7 +1396,7 @@ HTML_STYLESHEET = # documentation. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_EXTRA_STYLESHEET = ./Documentation/doxygen-awesome-css/doxygen-awesome.css +HTML_EXTRA_STYLESHEET = ./Documentation~/doxygen-awesome-css/doxygen-awesome.css # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note diff --git a/Documentation~/copy-images.js b/Documentation~/copy-images.js new file mode 100644 index 00000000..f22a36dc --- /dev/null +++ b/Documentation~/copy-images.js @@ -0,0 +1,18 @@ +/** + * Documentation for Cesium for Unity needs to exist under the Documentation~ folder, + * as folders ending in ~ are ignored by Unity. However, this causes an issue with + * Doxygen, as described here: https://github.com/doxygen/doxygen/issues/11273 + * + * The solution to this is to avoid putting the images in Doxygen's `IMAGE_PATH`, + * which triggers the issue, instead copying them to the same relative directory as + * the original image path in the Markdown files. The problem is that doing this from + * the package.json script will cause issues with the difference between `cp` on Linux + * and `copy` on Windows. Instead, we use this script to perform the copy operation + * in a cross-platform way. + */ +const fs = require("fs"); + +fs.mkdirSync("./Reference/html/Documentation~/images", { recursive: true }); +const images = fs.readdirSync("./images"); +images.forEach(img => fs.copyFileSync("./images/" + img, "./Reference/html/Documentation~/images/" + img)); +console.log(`copied ${images.length} images to Documentation~/Reference/html`); \ No newline at end of file diff --git a/Documentation/creating-monobehaviours.md b/Documentation~/creating-monobehaviours.md similarity index 100% rename from Documentation/creating-monobehaviours.md rename to Documentation~/creating-monobehaviours.md diff --git a/Documentation/developer-resources.md b/Documentation~/developer-resources.md similarity index 100% rename from Documentation/developer-resources.md rename to Documentation~/developer-resources.md diff --git a/Documentation/developer-setup.md b/Documentation~/developer-setup.md similarity index 100% rename from Documentation/developer-setup.md rename to Documentation~/developer-setup.md diff --git a/Documentation/doxygen-awesome-css b/Documentation~/doxygen-awesome-css similarity index 100% rename from Documentation/doxygen-awesome-css rename to Documentation~/doxygen-awesome-css diff --git a/Documentation/images/CameraSettings.png b/Documentation~/images/CameraSettings.png similarity index 100% rename from Documentation/images/CameraSettings.png rename to Documentation~/images/CameraSettings.png diff --git a/Documentation/images/Cesium-128x128.png b/Documentation~/images/Cesium-128x128.png similarity index 100% rename from Documentation/images/Cesium-128x128.png rename to Documentation~/images/Cesium-128x128.png diff --git a/Documentation/images/Cesium_for_Unity-Logo-WhiteBGH.jpg b/Documentation~/images/Cesium_for_Unity-Logo-WhiteBGH.jpg similarity index 100% rename from Documentation/images/Cesium_for_Unity-Logo-WhiteBGH.jpg rename to Documentation~/images/Cesium_for_Unity-Logo-WhiteBGH.jpg diff --git a/Documentation/images/cesium-for-unity-screenshot.jpg b/Documentation~/images/cesium-for-unity-screenshot.jpg similarity index 100% rename from Documentation/images/cesium-for-unity-screenshot.jpg rename to Documentation~/images/cesium-for-unity-screenshot.jpg diff --git a/Documentation/images/integration-workflow_Unity.png b/Documentation~/images/integration-workflow_Unity.png similarity index 100% rename from Documentation/images/integration-workflow_Unity.png rename to Documentation~/images/integration-workflow_Unity.png diff --git a/Documentation/release-guide.md b/Documentation~/release-guide.md similarity index 100% rename from Documentation/release-guide.md rename to Documentation~/release-guide.md diff --git a/README.md b/README.md index 06cb2e82..4106f547 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Cesium for Unity Logo](Documentation/images/Cesium_for_Unity-Logo-WhiteBGH.jpg)](https://cesium.com/) +[![Cesium for Unity Logo](Documentation~/images/Cesium_for_Unity-Logo-WhiteBGH.jpg)](https://cesium.com/) Cesium for Unity enables building 3D geospatial applications and experiences with 3D Tiles and open standards using Unity 3D. By combining a high-accuracy full-scale WGS84 globe, open APIs and open standards for spatial indexing such as 3D Tiles, and cloud-based real-world content from [Cesium ion](https://cesium.com/cesium-ion) with Unity, this plugin enables rich 3D geospatial workflows and applications in Unity. @@ -14,7 +14,7 @@ Have questions? Ask them on the [community forum](https://community.cesium.com/c ### 👏 Featured Demos -[![](Documentation/images/cesium-for-unity-screenshot.jpg)](https://github.com/CesiumGS/cesium-unity-samples) +[![](Documentation~/images/cesium-for-unity-screenshot.jpg)](https://github.com/CesiumGS/cesium-unity-samples) ### 🏡 Cesium for Unity and the 3D Geospatial Ecosystem @@ -22,7 +22,7 @@ Cesium for Unity streams real-world 3D content such as high-resolution photogram Cesium for Unity supports cloud and private network content and services based on open standards and APIs. You are free to use any combination of supported content sources, standards, APIs with Cesium for Unity. -![Cesium for Unity Architecture](Documentation/images/integration-workflow_Unity.png) +![Cesium for Unity Architecture](Documentation~/images/integration-workflow_Unity.png) Using Cesium ion helps support Cesium for Unity development. ❤️ @@ -36,4 +36,4 @@ Cesium for Unity is tightly integrated with Unity making it possible to visualiz ### 🖥️ Developing Cesium for Unity -See the [Developer Setup Guide](Documentation/developer-setup.md) to learn how to set up a development environment for Cesium for Unity, allowing you to compile it, customize it, and contribute to its development. +See the [Developer Setup Guide](Documentation~/developer-setup.md) to learn how to set up a development environment for Cesium for Unity, allowing you to compile it, customize it, and contribute to its development. diff --git a/package.json b/package.json index bf5d638a..589dfd82 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "url": "https://cesium.com" }, "scripts": { - "doxygen": "doxygen ./Documentation/Doxyfile" + "doxygen": "doxygen ./Documentation~/Doxyfile && cd Documentation~ && node copy-images.js && cd .." }, "changelogUrl": "https://github.com/CesiumGS/cesium-unity/blob/main/CHANGES.md", "documentationUrl": "https://cesium.com/learn/unity/", From 4281d8e5d2483a11dbae4eba86c158e64602c164 Mon Sep 17 00:00:00 2001 From: Kevin Ring Date: Fri, 20 Dec 2024 23:05:19 +1100 Subject: [PATCH 6/6] Remove unnecessary explicit comparison to nullptr --- native~/Runtime/src/UnityPrepareRendererResources.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/native~/Runtime/src/UnityPrepareRendererResources.cpp b/native~/Runtime/src/UnityPrepareRendererResources.cpp index f2c5c57a..28645189 100644 --- a/native~/Runtime/src/UnityPrepareRendererResources.cpp +++ b/native~/Runtime/src/UnityPrepareRendererResources.cpp @@ -272,7 +272,7 @@ void generateMipMaps( // associated with a depot, unshare it. This is necessary to avoid a // race condition where multiple threads attempt to generate mipmaps for // the same shared image simultaneously. - if (pImage->pAsset && pImage->pAsset->getDepot() != nullptr) { + if (pImage->pAsset && pImage->pAsset->getDepot()) { // Copy the asset. pImage->pAsset.emplace(*pImage->pAsset); }