Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Mours <pmours@nvidia.com>2022-03-23 18:07:43 +0300
committerPatrick Mours <pmours@nvidia.com>2022-03-23 18:39:05 +0300
commitd350976ba06d4ef93aa53fc4cd9da57be46ae924 (patch)
tree808f38e6b0c663c7a50f1d98619c96ca0bd82018 /intern/cycles/hydra/camera.h
parent827e9ccb29dd50d155972444d608c35cf4698d6a (diff)
Cycles: Add Hydra render delegate
This patch adds a Hydra render delegate to Cycles, allowing Cycles to be used for rendering in applications that provide a Hydra viewport. The implementation was written from scratch against Cycles X, for integration into the Blender repository to make it possible to continue developing it in step with the rest of Cycles. For this purpose it follows the style of the rest of the Cycles code and can be built with a CMake option (`WITH_CYCLES_HYDRA_RENDER_DELEGATE=1`) similar to the existing standalone version of Cycles. Since Hydra render delegates need to be built against the exact USD version and other dependencies as the target application is using, this is intended to be built separate from Blender (`WITH_BLENDER=0` CMake option) and with support for library versions different from what Blender is using. As such the CMake build scripts for Windows had to be modified slightly, so that the Cycles Hydra render delegate can e.g. be built with MSVC 2017 again even though Blender requires MSVC 2019 now, and it's possible to specify custom paths to the USD SDK etc. The codebase supports building against the latest USD release 22.03 and all the way back to USD 20.08 (with some limitations). Reviewed By: brecht, LazyDodo Differential Revision: https://developer.blender.org/D14398
Diffstat (limited to 'intern/cycles/hydra/camera.h')
-rw-r--r--intern/cycles/hydra/camera.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/intern/cycles/hydra/camera.h b/intern/cycles/hydra/camera.h
new file mode 100644
index 00000000000..8b7fed5a6bb
--- /dev/null
+++ b/intern/cycles/hydra/camera.h
@@ -0,0 +1,43 @@
+/* SPDX-License-Identifier: Apache-2.0
+ * Copyright 2022 NVIDIA Corporation
+ * Copyright 2022 Blender Foundation */
+
+#pragma once
+
+#include "hydra/config.h"
+
+#include <pxr/base/gf/camera.h>
+#include <pxr/imaging/hd/camera.h>
+#include <pxr/imaging/hd/timeSampleArray.h>
+
+HDCYCLES_NAMESPACE_OPEN_SCOPE
+
+class HdCyclesCamera final : public PXR_NS::HdCamera {
+ public:
+ HdCyclesCamera(const PXR_NS::SdfPath &sprimId);
+ ~HdCyclesCamera() override;
+
+ void ApplyCameraSettings(CCL_NS::Camera *targetCamera) const;
+
+ static void ApplyCameraSettings(const PXR_NS::GfCamera &cameraData,
+ PXR_NS::CameraUtilConformWindowPolicy windowPolicy,
+ CCL_NS::Camera *targetCamera);
+ static void ApplyCameraSettings(const PXR_NS::GfMatrix4d &worldToViewMatrix,
+ const PXR_NS::GfMatrix4d &projectionMatrix,
+ const std::vector<PXR_NS::GfVec4d> &clipPlanes,
+ CCL_NS::Camera *targetCamera);
+
+ PXR_NS::HdDirtyBits GetInitialDirtyBitsMask() const override;
+
+ void Sync(PXR_NS::HdSceneDelegate *sceneDelegate,
+ PXR_NS::HdRenderParam *renderParam,
+ PXR_NS::HdDirtyBits *dirtyBits) override;
+
+ void Finalize(PXR_NS::HdRenderParam *renderParam) override;
+
+ private:
+ PXR_NS::GfCamera _data;
+ PXR_NS::HdTimeSampleArray<PXR_NS::GfMatrix4d, 2> _transformSamples;
+};
+
+HDCYCLES_NAMESPACE_CLOSE_SCOPE