diff --git a/render_delegate/basis_curves.cpp b/render_delegate/basis_curves.cpp index ed22be2735..f7158eef1c 100644 --- a/render_delegate/basis_curves.cpp +++ b/render_delegate/basis_curves.cpp @@ -141,11 +141,18 @@ inline bool _RemapVertexPrimvar( } // namespace +#if PXR_VERSION >= 2102 +HdArnoldBasisCurves::HdArnoldBasisCurves(HdArnoldRenderDelegate* delegate, const SdfPath& id) + : HdArnoldRprim(str::curves, delegate, id), _interpolation(HdTokens->linear) +{ +} +#else HdArnoldBasisCurves::HdArnoldBasisCurves( HdArnoldRenderDelegate* delegate, const SdfPath& id, const SdfPath& instancerId) : HdArnoldRprim(str::curves, delegate, id, instancerId), _interpolation(HdTokens->linear) { } +#endif void HdArnoldBasisCurves::Sync( HdSceneDelegate* sceneDelegate, HdRenderParam* renderParam, HdDirtyBits* dirtyBits, const TfToken& reprToken) diff --git a/render_delegate/basis_curves.h b/render_delegate/basis_curves.h index 1a56772567..af862ffd28 100644 --- a/render_delegate/basis_curves.h +++ b/render_delegate/basis_curves.h @@ -31,8 +31,22 @@ PXR_NAMESPACE_OPEN_SCOPE class HdArnoldBasisCurves : public HdArnoldRprim { public: +#if PXR_VERSION >= 2102 + /// Constructor for HdArnoldBasisCurves. + /// + /// @param renderDelegate Pointer to the Render Delegate. + /// @param id Path to the basis curves. + HDARNOLD_API + HdArnoldBasisCurves(HdArnoldRenderDelegate* delegate, const SdfPath& id); +#else + /// Constructor for HdArnoldBasisCurves. + /// + /// @param renderDelegate Pointer to the Render Delegate. + /// @param id Path to the basis curves. + /// @param instancerId Path to the Point Instancer for this basis curves. HDARNOLD_API HdArnoldBasisCurves(HdArnoldRenderDelegate* delegate, const SdfPath& id, const SdfPath& instancerId = SdfPath()); +#endif /// Destructor for HdArnoldBasisCurves. /// diff --git a/render_delegate/hdarnold.h b/render_delegate/hdarnold.h index 458ec0ae54..82d4a39a52 100755 --- a/render_delegate/hdarnold.h +++ b/render_delegate/hdarnold.h @@ -28,19 +28,20 @@ #define USD_HAS_NEW_RENDERER_PLUGIN #endif -#if USED_USD_VERSION_GREATER_EQ(19, 11) +// Integer comparable version exists since 1911. +#if PXR_VERSION >= 1911 /// Hydra has the new renderer plugin base class #define USD_HAS_UPDATED_TIME_SAMPLE_ARRAY /// Hydra has the updated render buffer class. #define USD_HAS_UPDATED_RENDER_BUFFER #endif -#if USED_USD_VERSION_GREATER_EQ(20, 2) +#if PXR_VERSION >= 2002 /// Depth range in Hydra was changed from -1 .. 1 to 0 .. 1. #define USD_HAS_ZERO_TO_ONE_DEPTH #endif -#if USED_USD_VERSION_GREATER_EQ(20, 5) +#if PXR_VERSION >= 2005 /// Not blitting to a hardware buffer anymore, following the example of HdEmbree. #define USD_DO_NOT_BLIT #endif diff --git a/render_delegate/instancer.cpp b/render_delegate/instancer.cpp index c6f47c3e10..39c33ad70c 100644 --- a/render_delegate/instancer.cpp +++ b/render_delegate/instancer.cpp @@ -47,12 +47,20 @@ inline const VtArray& _LookupInstancePrimvar(const HdArnoldPrimvarMap& primva } // namespace +#if PXR_VERSION >= 2102 +HdArnoldInstancer::HdArnoldInstancer( + HdArnoldRenderDelegate* renderDelegate, HdSceneDelegate* sceneDelegate, const SdfPath& id) + : HdInstancer(sceneDelegate, id) +{ +} +#else HdArnoldInstancer::HdArnoldInstancer( HdArnoldRenderDelegate* renderDelegate, HdSceneDelegate* sceneDelegate, const SdfPath& id, const SdfPath& parentInstancerId) : HdInstancer(sceneDelegate, id, parentInstancerId) { } +#endif void HdArnoldInstancer::_SyncPrimvars() { diff --git a/render_delegate/instancer.h b/render_delegate/instancer.h index b8252ad46c..bf5540228f 100755 --- a/render_delegate/instancer.h +++ b/render_delegate/instancer.h @@ -38,14 +38,28 @@ PXR_NAMESPACE_OPEN_SCOPE /// Utility class for the point instancer. class HdArnoldInstancer : public HdInstancer { public: +#if PXR_VERSION >= 2102 /// Creates an instance of HdArnoldInstancer. /// /// @param renderDelegate Pointer to the render delegate creating the /// instancer. + /// @param sceneDelegate Pointer to Hydra Scene Delegate. + /// @param id Path to the instancer. + HDARNOLD_API + HdArnoldInstancer(HdArnoldRenderDelegate* renderDelegate, HdSceneDelegate* sceneDelegate, const SdfPath& id); +#else + /// Creates an instance of HdArnoldInstancer. + /// + /// @param renderDelegate Pointer to the render delegate creating the + /// instancer. + /// @param sceneDelegate Pointer to Hydra Scene Delegate. + /// @param id Path to the instancer. + /// @param parentInstanceId Path to the parent Instancer. HDARNOLD_API HdArnoldInstancer( HdArnoldRenderDelegate* renderDelegate, HdSceneDelegate* sceneDelegate, const SdfPath& id, const SdfPath& parentInstancerId = SdfPath()); +#endif /// Destructor for HdArnoldInstancer. ~HdArnoldInstancer() override = default; diff --git a/render_delegate/light.cpp b/render_delegate/light.cpp index d9a9ea7e01..4b1b5b55e1 100644 --- a/render_delegate/light.cpp +++ b/render_delegate/light.cpp @@ -45,6 +45,7 @@ namespace { // clang-format off TF_DEFINE_PRIVATE_TOKENS( _tokens, +#if PXR_VERSION < 2102 // Shaping parameters are not part of HdTokens in older USD versions ((shapingFocus, "shaping:focus")) ((shapingFocusTint, "shaping:focusTint")) @@ -53,6 +54,8 @@ TF_DEFINE_PRIVATE_TOKENS( ((shapingIesFile, "shaping:ies:file")) ((shapingIesAngleScale, "shaping:ies:angleScale")) ((shapingIesNormalize, "shaping:ies:normalize")) + (treatAsPoint) +#endif // Barndoor parameters for Houdini (barndoorbottom) (barndoorbottomedge) @@ -63,7 +66,6 @@ TF_DEFINE_PRIVATE_TOKENS( (barndoortop) (barndoortopedge) (filters) - (treatAsPoint) ((emptyLink, "__arnold_empty_link__")) ); // clang-format on @@ -74,6 +76,28 @@ struct ParamDesc { TfToken hdName; }; +#if PXR_VERSION >= 2102 +std::vector genericParams = { + {"intensity", UsdLuxTokens->inputsIntensity}, {"exposure", UsdLuxTokens->inputsExposure}, + {"color", UsdLuxTokens->inputsColor}, {"diffuse", UsdLuxTokens->inputsDiffuse}, + {"specular", UsdLuxTokens->inputsSpecular}, {"normalize", UsdLuxTokens->inputsNormalize}, + {"cast_shadows", UsdLuxTokens->shadowEnable}, {"shadow_color", UsdLuxTokens->shadowColor}, +}; + +std::vector pointParams = {{"radius", UsdLuxTokens->inputsRadius}}; + +std::vector spotParams = { + {"radius", UsdLuxTokens->inputsRadius}, {"cosine_power", UsdLuxTokens->shapingFocus}}; + +std::vector photometricParams = { + {"filename", UsdLuxTokens->shapingIesFile}, {"radius", UsdLuxTokens->inputsRadius}}; + +std::vector distantParams = {{"angle", UsdLuxTokens->inputsAngle}}; + +std::vector diskParams = {{"radius", UsdLuxTokens->inputsRadius}}; + +std::vector cylinderParams = {{"radius", UsdLuxTokens->inputsRadius}}; +#else std::vector genericParams = { {"intensity", HdLightTokens->intensity}, {"exposure", HdLightTokens->exposure}, @@ -96,6 +120,7 @@ std::vector distantParams = {{"angle", HdLightTokens->angle}}; std::vector diskParams = {{"radius", HdLightTokens->radius}}; std::vector cylinderParams = {{"radius", HdLightTokens->radius}}; +#endif void iterateParams( AtNode* light, const AtNodeEntry* nentry, const SdfPath& id, HdSceneDelegate* delegate, @@ -130,7 +155,11 @@ AtString getLightType(HdSceneDelegate* delegate, const SdfPath& id) return true; }; auto hasIesFile = [&]() -> bool { +#if PXR_VERSION >= 2102 + auto val = delegate->GetLightParamValue(id, UsdLuxTokens->shapingIesFile); +#else auto val = delegate->GetLightParamValue(id, _tokens->shapingIesFile); +#endif if (val.IsEmpty()) { return false; } @@ -144,8 +173,13 @@ AtString getLightType(HdSceneDelegate* delegate, const SdfPath& id) return false; }; // If any of the shaping params exists or non-default we have a spot light. +#if PXR_VERSION >= 2102 + if (!isDefault(UsdLuxTokens->shapingFocus, 0.0f) || !isDefault(UsdLuxTokens->shapingConeAngle, 180.0f) || + !isDefault(UsdLuxTokens->shapingConeSoftness, 0.0f)) { +#else if (!isDefault(_tokens->shapingFocus, 0.0f) || !isDefault(_tokens->shapingConeAngle, 180.0f) || !isDefault(_tokens->shapingConeSoftness, 0.0f)) { +#endif return str::spot_light; } return hasIesFile() ? str::photometric_light : str::point_light; @@ -154,9 +188,13 @@ AtString getLightType(HdSceneDelegate* delegate, const SdfPath& id) auto spotLightSync = [](AtNode* light, AtNode** filter, const AtNodeEntry* nentry, const SdfPath& id, HdSceneDelegate* delegate) { iterateParams(light, nentry, id, delegate, spotParams); - +#if PXR_VERSION >= 2102 + const auto hdAngle = delegate->GetLightParamValue(id, UsdLuxTokens->shapingConeAngle).GetWithDefault(180.0f); + const auto softness = delegate->GetLightParamValue(id, UsdLuxTokens->shapingConeSoftness).GetWithDefault(0.0f); +#else const auto hdAngle = delegate->GetLightParamValue(id, _tokens->shapingConeAngle).GetWithDefault(180.0f); const auto softness = delegate->GetLightParamValue(id, _tokens->shapingConeSoftness).GetWithDefault(0.0f); +#endif const auto arnoldAngle = hdAngle * 2.0f; const auto penumbra = arnoldAngle * softness; AiNodeSetFlt(light, str::cone_angle, arnoldAngle); @@ -211,7 +249,11 @@ auto spotLightSync = [](AtNode* light, AtNode** filter, const AtNodeEntry* nentr auto pointLightSync = [](AtNode* light, AtNode** filter, const AtNodeEntry* nentry, const SdfPath& id, HdSceneDelegate* delegate) { TF_UNUSED(filter); +#if PXR_VERSION >= 2102 + const auto treatAsPointValue = delegate->GetLightParamValue(id, UsdLuxTokens->treatAsPoint); +#else const auto treatAsPointValue = delegate->GetLightParamValue(id, _tokens->treatAsPoint); +#endif if (treatAsPointValue.IsHolding() && treatAsPointValue.UncheckedGet()) { AiNodeSetFlt(light, str::radius, 0.0f); AiNodeSetBool(light, str::normalize, true); @@ -245,11 +287,19 @@ auto rectLightSync = [](AtNode* light, AtNode** filter, const AtNodeEntry* nentr TF_UNUSED(filter); float width = 1.0f; float height = 1.0f; +#if PXR_VERSION >= 2102 + const auto& widthValue = delegate->GetLightParamValue(id, UsdLuxTokens->inputsWidth); +#else const auto& widthValue = delegate->GetLightParamValue(id, HdLightTokens->width); +#endif if (widthValue.IsHolding()) { width = widthValue.UncheckedGet(); } +#if PXR_VERSION >= 2102 + const auto& heightValue = delegate->GetLightParamValue(id, UsdLuxTokens->inputsHeight); +#else const auto& heightValue = delegate->GetLightParamValue(id, HdLightTokens->height); +#endif if (heightValue.IsHolding()) { height = heightValue.UncheckedGet(); } @@ -269,7 +319,11 @@ auto cylinderLightSync = [](AtNode* light, AtNode** filter, const AtNodeEntry* n TF_UNUSED(filter); iterateParams(light, nentry, id, delegate, cylinderParams); float length = 1.0f; +#if PXR_VERSION >= 2102 + const auto& lengthValue = delegate->GetLightParamValue(id, UsdLuxTokens->inputsLength); +#else const auto& lengthValue = delegate->GetLightParamValue(id, UsdLuxTokens->length); +#endif if (lengthValue.IsHolding()) { length = lengthValue.UncheckedGet(); } @@ -281,7 +335,11 @@ auto cylinderLightSync = [](AtNode* light, AtNode** filter, const AtNodeEntry* n auto domeLightSync = [](AtNode* light, AtNode** filter, const AtNodeEntry* nentry, const SdfPath& id, HdSceneDelegate* delegate) { TF_UNUSED(filter); +#if PXR_VERSION >= 2102 + const auto& formatValue = delegate->GetLightParamValue(id, UsdLuxTokens->inputsTextureFormat); +#else const auto& formatValue = delegate->GetLightParamValue(id, UsdLuxTokens->textureFormat); +#endif if (formatValue.IsHolding()) { const auto& textureFormat = formatValue.UncheckedGet(); if (textureFormat == UsdLuxTokens->latlong) { @@ -433,7 +491,11 @@ void HdArnoldGenericLight::Sync(HdSceneDelegate* sceneDelegate, HdRenderParam* r iterateParams(_light, nentry, id, sceneDelegate, genericParams); _syncParams(_light, &_filter, nentry, id, sceneDelegate); if (_supportsTexture) { +#if PXR_VERSION >= 2102 + SetupTexture(sceneDelegate->GetLightParamValue(id, UsdLuxTokens->inputsTextureFile)); +#else SetupTexture(sceneDelegate->GetLightParamValue(id, HdLightTokens->textureFile)); +#endif } for (const auto& primvar : sceneDelegate->GetPrimvarDescriptors(id, HdInterpolation::HdInterpolationConstant)) { ConvertPrimvarToBuiltinParameter(_light, primvar.name, sceneDelegate->Get(id, primvar.name)); @@ -488,8 +550,13 @@ void HdArnoldGenericLight::Sync(HdSceneDelegate* sceneDelegate, HdRenderParam* r } } }; +#if PXR_VERSION >= 2102 + updateLightLinking(_lightLink, UsdLuxTokens->lightLink, false); + updateLightLinking(_shadowLink, UsdLuxTokens->shadowLink, true); +#else updateLightLinking(_lightLink, HdTokens->lightLink, false); updateLightLinking(_shadowLink, HdTokens->shadowLink, true); +#endif *dirtyBits = HdLight::Clean; } diff --git a/render_delegate/mesh.cpp b/render_delegate/mesh.cpp index 7f592558fe..28c4057726 100644 --- a/render_delegate/mesh.cpp +++ b/render_delegate/mesh.cpp @@ -143,12 +143,21 @@ inline void _ConvertFaceVaryingPrimvarToBuiltin( } // namespace +#if PXR_VERSION >= 2102 +HdArnoldMesh::HdArnoldMesh(HdArnoldRenderDelegate* renderDelegate, const SdfPath& id) + : HdArnoldRprim(str::polymesh, renderDelegate, id) +{ + // The default value is 1, which won't work well in a Hydra context. + AiNodeSetByte(GetArnoldNode(), str::subdiv_iterations, 0); +} +#else HdArnoldMesh::HdArnoldMesh(HdArnoldRenderDelegate* renderDelegate, const SdfPath& id, const SdfPath& instancerId) : HdArnoldRprim(str::polymesh, renderDelegate, id, instancerId) { // The default value is 1, which won't work well in a Hydra context. AiNodeSetByte(GetArnoldNode(), str::subdiv_iterations, 0); } +#endif void HdArnoldMesh::Sync( HdSceneDelegate* sceneDelegate, HdRenderParam* renderParam, HdDirtyBits* dirtyBits, const TfToken& reprToken) diff --git a/render_delegate/mesh.h b/render_delegate/mesh.h index 3defc4ac51..37e369b205 100755 --- a/render_delegate/mesh.h +++ b/render_delegate/mesh.h @@ -48,6 +48,14 @@ PXR_NAMESPACE_OPEN_SCOPE /// Utility class for translating Hydra Mesh to Arnold Polymesh. class HdArnoldMesh : public HdArnoldRprim { public: +#if PXR_VERSION >= 2102 + /// Constructor for HdArnoldMesh. + /// + /// @param renderDelegate Pointer to the Render Delegate. + /// @param id Path to the mesh. + HDARNOLD_API + HdArnoldMesh(HdArnoldRenderDelegate* renderDelegate, const SdfPath& id); +#else /// Constructor for HdArnoldMesh. /// /// @param renderDelegate Pointer to the Render Delegate. @@ -55,6 +63,7 @@ class HdArnoldMesh : public HdArnoldRprim { /// @param instancerId Path to the Point Instancer for this mesh. HDARNOLD_API HdArnoldMesh(HdArnoldRenderDelegate* renderDelegate, const SdfPath& id, const SdfPath& instancerId = SdfPath()); +#endif /// Destructor for HdArnoldMesh. /// diff --git a/render_delegate/points.cpp b/render_delegate/points.cpp index 95825690b4..d03a194d2d 100644 --- a/render_delegate/points.cpp +++ b/render_delegate/points.cpp @@ -19,10 +19,17 @@ PXR_NAMESPACE_OPEN_SCOPE +#if PXR_VERSION >= 2102 +HdArnoldPoints::HdArnoldPoints(HdArnoldRenderDelegate* renderDelegate, const SdfPath& id) + : HdArnoldRprim(str::points, renderDelegate, id) +{ +} +#else HdArnoldPoints::HdArnoldPoints(HdArnoldRenderDelegate* renderDelegate, const SdfPath& id, const SdfPath& instancerId) : HdArnoldRprim(str::points, renderDelegate, id, instancerId) { } +#endif HdDirtyBits HdArnoldPoints::GetInitialDirtyBitsMask() const { diff --git a/render_delegate/points.h b/render_delegate/points.h index 2c4cad6eb2..00348d905e 100755 --- a/render_delegate/points.h +++ b/render_delegate/points.h @@ -32,6 +32,14 @@ PXR_NAMESPACE_OPEN_SCOPE /// Utility class to handle point primitives. class HdArnoldPoints : public HdArnoldRprim { public: +#if PXR_VERSION >= 2102 + /// Constructor for HdArnoldPoints. + /// + /// @param renderDelegate Pointer to the Render Delegate. + /// @param id Path to the points. + HDARNOLD_API + HdArnoldPoints(HdArnoldRenderDelegate* renderDelegate, const SdfPath& id); +#else /// Constructor for HdArnoldPoints. /// /// @param renderDelegate Pointer to the Render Delegate. @@ -39,6 +47,7 @@ class HdArnoldPoints : public HdArnoldRprim { /// @param instancerId Path to the Point Instancer for this points. HDARNOLD_API HdArnoldPoints(HdArnoldRenderDelegate* renderDelegate, const SdfPath& id, const SdfPath& instancerId = SdfPath()); +#endif /// Destructor for HdArnoldPoints. /// diff --git a/render_delegate/render_delegate.cpp b/render_delegate/render_delegate.cpp index d8ba694511..e35690eaf2 100644 --- a/render_delegate/render_delegate.cpp +++ b/render_delegate/render_delegate.cpp @@ -541,14 +541,42 @@ HdRenderPassSharedPtr HdArnoldRenderDelegate::CreateRenderPass( return HdRenderPassSharedPtr(new HdArnoldRenderPass(this, index, collection)); } +#if PXR_VERSION >= 2102 +HdInstancer* HdArnoldRenderDelegate::CreateInstancer( + HdSceneDelegate* delegate, const SdfPath& id) +{ + return new HdArnoldInstancer(this, delegate, id); +} +#else HdInstancer* HdArnoldRenderDelegate::CreateInstancer( HdSceneDelegate* delegate, const SdfPath& id, const SdfPath& instancerId) { return new HdArnoldInstancer(this, delegate, id, instancerId); } +#endif void HdArnoldRenderDelegate::DestroyInstancer(HdInstancer* instancer) { delete instancer; } +#if PXR_VERSION >= 2102 +HdRprim* HdArnoldRenderDelegate::CreateRprim(const TfToken& typeId, const SdfPath& rprimId) +{ + _renderParam->Interrupt(); + if (typeId == HdPrimTypeTokens->mesh) { + return new HdArnoldMesh(this, rprimId); + } + if (typeId == HdPrimTypeTokens->volume) { + return new HdArnoldVolume(this, rprimId); + } + if (typeId == HdPrimTypeTokens->points) { + return new HdArnoldPoints(this, rprimId); + } + if (typeId == HdPrimTypeTokens->basisCurves) { + return new HdArnoldBasisCurves(this, rprimId); + } + TF_CODING_ERROR("Unknown Rprim Type %s", typeId.GetText()); + return nullptr; +} +#else HdRprim* HdArnoldRenderDelegate::CreateRprim(const TfToken& typeId, const SdfPath& rprimId, const SdfPath& instancerId) { _renderParam->Interrupt(); @@ -567,6 +595,7 @@ HdRprim* HdArnoldRenderDelegate::CreateRprim(const TfToken& typeId, const SdfPat TF_CODING_ERROR("Unknown Rprim Type %s", typeId.GetText()); return nullptr; } +#endif void HdArnoldRenderDelegate::DestroyRprim(HdRprim* rPrim) { diff --git a/render_delegate/render_delegate.h b/render_delegate/render_delegate.h index a56345f809..44b777b746 100755 --- a/render_delegate/render_delegate.h +++ b/render_delegate/render_delegate.h @@ -117,6 +117,13 @@ class HdArnoldRenderDelegate final : public HdRenderDelegate { /// @return A shared pointer to the new Render Pass or nullptr on error. HDARNOLD_API HdRenderPassSharedPtr CreateRenderPass(HdRenderIndex* index, HdRprimCollection const& collection) override; +#if PXR_VERSION >= 2102 + /// Request to create a new instancer. + /// + /// @param id The unique identifier of this instancer. + /// @return A pointer to the new instancer or nullptr on error. + HdInstancer* CreateInstancer(HdSceneDelegate* delegate, SdfPath const& id) override; +#else /// Creates a new Point Instancer. /// /// @param delegate Pointer to the Scene Delegate. @@ -125,11 +132,21 @@ class HdArnoldRenderDelegate final : public HdRenderDelegate { /// @return Pointer to a new Point Instancer or nullptr on error. HDARNOLD_API HdInstancer* CreateInstancer(HdSceneDelegate* delegate, SdfPath const& id, SdfPath const& instancerId) override; +#endif /// Destroys a Point Instancer. /// /// @param instancer Pointer to an instance of HdInstancer. HDARNOLD_API void DestroyInstancer(HdInstancer* instancer) override; +#if PXR_VERSION >= 2102 + /// Creates a new RPrim. + /// + /// @param typeId Type name of the primitive. + /// @param rprimId Path to the primitive. + /// @return Pointer to the newly created RPrim or nullptr on error. + HDARNOLD_API + HdRprim* CreateRprim(TfToken const& typeId, SdfPath const& rprimId) override; +#else /// Creates a new RPrim. /// /// @param typeId Type name of the primitive. @@ -138,6 +155,7 @@ class HdArnoldRenderDelegate final : public HdRenderDelegate { /// @return Pointer to the newly created RPrim or nullptr on error. HDARNOLD_API HdRprim* CreateRprim(TfToken const& typeId, SdfPath const& rprimId, SdfPath const& instancerId) override; +#endif /// Destroys an RPrim. /// /// @param rPrim Pointer to an RPrim. diff --git a/render_delegate/rprim.h b/render_delegate/rprim.h index b02d685d64..dbf4617d47 100644 --- a/render_delegate/rprim.h +++ b/render_delegate/rprim.h @@ -32,6 +32,21 @@ PXR_NAMESPACE_OPEN_SCOPE template class HdArnoldRprim : public HydraType { public: +#if PXR_VERSION >= 2102 + /// Constructor for HdArnoldRprim. + /// + /// @param shapeType AtString storing the type of the Arnold Shape node. + /// @param renderDelegate Pointer to the Render Delegate. + /// @param id Path to the primitive. + HDARNOLD_API + HdArnoldRprim( + const AtString& shapeType, HdArnoldRenderDelegate* renderDelegate, const SdfPath& id) + : HydraType(id), + _renderDelegate(renderDelegate), + _shape(shapeType, renderDelegate, id, HydraType::GetPrimId()) + { + } +#else /// Constructor for HdArnoldRprim. /// /// @param shapeType AtString storing the type of the Arnold Shape node. @@ -47,6 +62,7 @@ class HdArnoldRprim : public HydraType { _shape(shapeType, renderDelegate, id, HydraType::GetPrimId()) { } +#endif /// Destructor for HdArnoldRprim. /// diff --git a/render_delegate/volume.cpp b/render_delegate/volume.cpp index e8fd90d874..7189f62c7e 100644 --- a/render_delegate/volume.cpp +++ b/render_delegate/volume.cpp @@ -172,10 +172,17 @@ TF_DEFINE_PRIVATE_TOKENS(_tokens, ); // clang-format on +#if PXR_VERSION >= 2102 +HdArnoldVolume::HdArnoldVolume(HdArnoldRenderDelegate* renderDelegate, const SdfPath& id) + : HdVolume(id), _renderDelegate(renderDelegate) +{ +} +#else HdArnoldVolume::HdArnoldVolume(HdArnoldRenderDelegate* renderDelegate, const SdfPath& id, const SdfPath& instancerId) : HdVolume(id, instancerId), _renderDelegate(renderDelegate) { } +#endif HdArnoldVolume::~HdArnoldVolume() { diff --git a/render_delegate/volume.h b/render_delegate/volume.h index 0100b51c27..76dc4af2d2 100644 --- a/render_delegate/volume.h +++ b/render_delegate/volume.h @@ -48,6 +48,14 @@ PXR_NAMESPACE_OPEN_SCOPE /// Utility class for Hydra Volumes. class HdArnoldVolume : public HdVolume { public: +#if PXR_VERSION >= 2102 + /// Constructor for HdArnoldVolume. + /// + /// @param renderDelegate Pointer to the Render Delegate. + /// @param id Path to the Primitive. + HDARNOLD_API + HdArnoldVolume(HdArnoldRenderDelegate* renderDelegate, const SdfPath& id); +#else /// Constructor for HdArnoldVolume. /// /// @param renderDelegate Pointer to the Render Delegate. @@ -55,6 +63,7 @@ class HdArnoldVolume : public HdVolume { /// @param instancerId Path to the Point Instancer. HDARNOLD_API HdArnoldVolume(HdArnoldRenderDelegate* renderDelegate, const SdfPath& id, const SdfPath& instancerId = SdfPath()); +#endif /// Destructor for HdArnoldVolume. ///