diff --git a/README.md b/README.md index 9bfd1de..a10d765 100644 --- a/README.md +++ b/README.md @@ -28,8 +28,22 @@ Huge thanks to Pixar's USD team for providing a highly extensible platform! - [hdTri](./src/hdTri): A hydra renderer plugin which images a triangle (in the most direct sense). - [usdviewTri](./src/usdviewTri): An usdview plugin providing a menu command to define child Triangle prim(s) under selected paths. + [*] We deliberatly split the Hydra 1 & 2 Triangle Prim Adapters into two plugins/sources to outline the differences + +### USD In Production Examples + +The example code presented as part of the USD in Production talk at [SIGGRAPH 2024](https://s2024.conference-program.org/presentation/?id=gensub_436&sess=sess163). These examples use Hydra 2 exclusively. +Disable these examples using `-DBUILD_SIGG2024=off` + +- [usdEpiphyte](./src/usdEpiphyte): a API Schema adapter to describe a relationship between a child primitive and its parent-primitive and the location (pointId) on it +- [usdEpiphyteImaging](./src/usdEpiphyteImaging): a API Schema adapter for the API Schema +- [hdEpiphyte](./src/hdEpiphyte): a Hydra Schema & Scene Index Filter + + + + There are many other USD plugins available online - check out [USD Working Group: Projects & Resources](https://wiki.aswf.io/display/WGUSD/USD+Projects+and+Resources) for more! ## Dependencies @@ -79,6 +93,7 @@ CMake options for configuring this project: | `ENABLE_PYTHON_SUPPORT` | Enable python support. Must match python support of USD installation. | `ON` | | `BUILD_TESTING` | Enable automated testing. | `ON` | | `BUILD_HYDRA2` | Enable building Hydra2 plugins, will disable Hydra1 plugin building. | `OFF` | +| `BUILD_SIGG2024` | Enable building SIGGRAPH 2024 USD In Production Course Examples. | `ON` | ## Running diff --git a/cmake/Options.cmake b/cmake/Options.cmake index 6743fb6..428d002 100644 --- a/cmake/Options.cmake +++ b/cmake/Options.cmake @@ -3,3 +3,4 @@ option(ENABLE_PYTHON_SUPPORT "Enable support for python." ON) option(BUILD_TESTING "Build & execute tests as part of build" ON) option(BUILD_HYDRA2 "Build Hydra2 Plugins, disables Hydra1 plugins" OFF) +option(BUILD_SIGG2024 "Build Siggraph 2024 USD in Production Example Code" ON) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 42f1746..d1ce4e7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,18 +5,23 @@ set(ORGANIZATION "usdpluginexamples") # Build & install libraries. add_subdirectory(usdTri) +add_subdirectory(usdEpiphyte) add_subdirectory(usdviewTri) # Build & install plugins. if (BUILD_HYDRA2) add_subdirectory(usdTriImagingHd2) -else() + add_subdirectory(usdEpiphyteImaging) + add_subdirectory(hdEpiphyte) + else() add_subdirectory(usdTriImaging) endif() +add_subdirectory(usdTriImaging) add_subdirectory(usdTriFileFormat) add_subdirectory(hdTri) + # Install top-level plugInfo for including per-library plugInfo(s). install( FILES plugInfo.json diff --git a/src/hdEpiphyte/CMakeLists.txt b/src/hdEpiphyte/CMakeLists.txt new file mode 100644 index 0000000..a3f5054 --- /dev/null +++ b/src/hdEpiphyte/CMakeLists.txt @@ -0,0 +1,29 @@ +usd_library(hdEpiphyte + + PUBLIC_HEADERS_INSTALL_PREFIX + ${ORGANIZATION} + + PYTHON_INSTALL_PREFIX + ${ORGANIZATION} + + LIBRARIES + js + plug + tf + sdf + vt + gf + usdImaging + hd + + PUBLIC_CLASSES + hdEpiphyteSchema + + + CPPFILES + sceneIndexPlugin.cpp + epiphyteSceneIndex.cpp + + RESOURCE_FILES + plugInfo.json +) \ No newline at end of file diff --git a/src/hdEpiphyte/epiphyteSceneIndex.cpp b/src/hdEpiphyte/epiphyteSceneIndex.cpp new file mode 100644 index 0000000..750e484 --- /dev/null +++ b/src/hdEpiphyte/epiphyteSceneIndex.cpp @@ -0,0 +1,351 @@ +// +// Copyright © 2024 Weta FX Limited +// +// SPDX-License-Identifier: Apache-2.0 +// +#include "epiphyteSceneIndex.h" +#include "hdEpiphyteSchema.h" + +#include "pxr/imaging/hd/coordSysSchema.h" +#include "pxr/imaging/hd/coordSysBindingSchema.h" +#include "pxr/imaging/hd/dependenciesSchema.h" +#include "pxr/imaging/hd/xformSchema.h" +#include "pxr/imaging/hd/primvarsSchema.h" +#include "pxr/imaging/hd/meshSchema.h" + +#include "pxr/imaging/hd/mapContainerDataSource.h" +#include "pxr/imaging/hd/retainedDataSource.h" +#include "pxr/imaging/hd/sceneIndexPrimView.h" +#include "pxr/imaging/hd/tokens.h" + +#include "pxr/base/trace/trace.h" + +PXR_NAMESPACE_OPEN_SCOPE + +namespace { + +class _XformFromMeshPointDataSource : public HdMatrixDataSource +{ +public: + HD_DECLARE_DATASOURCE(_XformFromMeshPointDataSource); + + bool GetContributingSampleTimesForInterval( + Time startTime, + Time endTime, + std::vector