Skip to content

Commit a3b4079

Browse files
tgvarikpixar-oss
authored andcommitted
[hdPrman] Make public some classes/namespaces in hdPrman that were previously private
(Internal change: 2374915)
1 parent 2ee9c3b commit a3b4079

File tree

8 files changed

+231
-73
lines changed

8 files changed

+231
-73
lines changed

third_party/renderman-26/plugin/hdPrman/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ pxr_plugin(${PXR_PACKAGE}
165165
renderSettingsFilteringSceneIndexPlugin
166166
renderViewContext
167167
resourceRegistry
168-
retesselationSceneIndexPlugin
169168
rileyCameraPrim
170169
rileyCoordinateSystemPrim
171170
rileyClippingPlanePrim

third_party/renderman-26/plugin/hdPrman/cameraContext.h

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,31 +31,39 @@ class HdPrmanCamera;
3131
class HdPrman_CameraContext final
3232
{
3333
public:
34+
HDPRMAN_API
3435
HdPrman_CameraContext();
3536

3637
/// Call when hydra changed the transform or parameters of a camera.
38+
HDPRMAN_API
3739
void MarkCameraInvalid(const SdfPath &path);
3840

3941
/// Set the active camera. If camera is the same as it used to be,
4042
/// context is not marked invalid.
43+
HDPRMAN_API
4144
void SetCameraPath(const SdfPath &path);
4245

4346
/// Set the camera framing. Context is only marked invalid if framing
4447
/// is different from what it used to be.
48+
HDPRMAN_API
4549
void SetFraming(const CameraUtilFraming &framing);
46-
50+
4751
/// Set window policy. Same comments as for SetFraming apply.
52+
HDPRMAN_API
4853
void SetWindowPolicy(CameraUtilConformWindowPolicy policy);
4954

5055
/// If true, some aspect of the camera or related state has changed
5156
/// and the riley camera or options need to be updated.
57+
HDPRMAN_API
5258
bool IsInvalid() const;
5359

5460
/// Create riley camera (with default settings).
61+
HDPRMAN_API
5562
void CreateRileyCamera(
5663
riley::Riley * riley,
5764
const RtUString &cameraName);
5865

66+
HDPRMAN_API
5967
void DeleteRileyCameraAndClipPlanes(riley::Riley * riley);
6068

6169
/// Get id of riley camera - valid only after Begin.
@@ -65,46 +73,55 @@ class HdPrman_CameraContext final
6573
/// to an image file.
6674
///
6775
/// Sets the crop window, format resolution and pixel aspect ratio.
76+
HDPRMAN_API
6877
void SetRileyOptions(
6978
RtParamList * options) const;
7079

7180
/// Update the given riley options for rendering to AOVs backed by
7281
/// render buffers of the given size.
7382
///
7483
/// Sets the crop window and pixel aspect ratio.
84+
HDPRMAN_API
7585
void SetRileyOptionsInteractive(
7686
RtParamList * options,
7787
const GfVec2i &renderBufferSize) const;
7888

7989
/// Update riley camera and clipping planes for offline rendering
8090
/// to an image file.
91+
HDPRMAN_API
8192
void UpdateRileyCameraAndClipPlanes(
8293
riley::Riley * riley,
8394
const HdRenderIndex * renderIndex);
8495

8596
/// Update riley camera and clipping planes for rendering to AOVs
8697
/// baked by render buffers of the given size.
98+
HDPRMAN_API
8799
void UpdateRileyCameraAndClipPlanesInteractive(
88100
riley::Riley * riley,
89101
const HdRenderIndex * renderIndex,
90102
const GfVec2i &renderBufferSize);
91103

92104
// A projection that will override the value from the camera setting if
93105
// it is different from the default perspective.
106+
HDPRMAN_API
94107
void SetProjectionOverride(const RtUString& projection,
95108
const RtParamList& projectionParams);
96-
109+
97110
/// Mark that riley camera and options are up to date.
111+
HDPRMAN_API
98112
void MarkValid();
99113

100114
/// Get resolution from the display window.
115+
HDPRMAN_API
101116
GfVec2i GetResolutionFromDisplayWindow() const;
102117

103118
// Get resolution from the data window
104119
// This can be removed once XPU handles under/overscan correctly.
120+
HDPRMAN_API
105121
GfVec2i GetResolutionFromDataWindow() const;
106122

107123
/// When depth of field is disabled the fstop is set to infinity.
124+
HDPRMAN_API
108125
void SetDisableDepthOfField(bool disableDepthOfField);
109126

110127
/// Path of current camera in render index.
@@ -114,11 +131,14 @@ class HdPrman_CameraContext final
114131
const RtUString& GetCameraName() const { return _cameraName; }
115132

116133
/// For convenience, get camera at camera path from render index.
134+
HDPRMAN_API
117135
const HdPrmanCamera * GetCamera(const HdRenderIndex *renderIndex) const;
118136

119137
/// Get the camera framing.
138+
HDPRMAN_API
120139
const CameraUtilFraming &GetFraming() const;
121140

141+
HDPRMAN_API
122142
static RtUString GetDefaultReferenceCameraName();
123143

124144
private:
@@ -148,15 +168,15 @@ class HdPrman_CameraContext final
148168
CameraUtilFraming _framing;
149169
CameraUtilConformWindowPolicy _policy;
150170
bool _disableDepthOfField;
151-
171+
152172
// Save ids of riley clip planes so that we can delete them before
153173
// re-creating them to update the clip planes.
154174
std::vector<riley::ClippingPlaneId> _clipPlaneIds;
155175
riley::CameraId _cameraId;
156176
// Riley camera name provided as an argument to CreateRileyCamera.
157177
// This needs to be unique across all cameras.
158178
RtUString _cameraName;
159-
179+
160180
RtUString _projectionNameOverride;
161181
RtParamList _projectionParamsOverride;
162182

third_party/renderman-26/plugin/hdPrman/plugInfo.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,24 @@
146146
"loadWithRenderer": ["RenderMan RIS", "RenderMan XPU", "RenderMan XPU - CPU", "RenderMan XPU - GPU"],
147147
"priority": 0,
148148
"displayName": "Scene index that adds primvars needed for UsdPreviewSurface"
149+
},
150+
"HdPrman_MeshLightResolvingSceneIndexPlugin" : {
151+
"bases": ["HdSceneIndexPlugin"],
152+
"loadWithRenderer": ["RenderMan RIS", "RenderMan XPU", "RenderMan XPU - CPU", "RenderMan XPU - GPU"],
153+
"priority": 0,
154+
"displayName": "Prman Resolve Mesh Lights Scene Index"
155+
},
156+
"HdPrman_PortalLightResolvingSceneIndexPlugin" : {
157+
"bases": ["HdSceneIndexPlugin"],
158+
"loadWithRenderer": ["RenderMan RIS", "RenderMan XPU", "RenderMan XPU - CPU", "RenderMan XPU - GPU"],
159+
"priority": 0,
160+
"displayName": "Prman Resolve Portal Lights Scene Index"
161+
},
162+
"HdPrman_NodeIdentifierResolvingSceneIndexPlugin" : {
163+
"bases": ["HdSceneIndexPlugin"],
164+
"loadWithRenderer": ["RenderMan RIS", "RenderMan XPU", "RenderMan XPU - CPU", "RenderMan XPU - GPU"],
165+
"priority": 0,
166+
"displayName": "Resolves Node Identifiers for shader nodes with OSL:sourceAsset"
149167
}
150168
}
151169
},

third_party/renderman-26/plugin/hdPrman/renderDelegate.cpp

Lines changed: 67 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,57 +5,80 @@
55
// https://openusd.org/license.
66
//
77
#include "hdPrman/renderDelegate.h"
8+
89
#include "hdPrman/basisCurves.h"
910
#include "hdPrman/camera.h"
10-
#if PXR_VERSION >= 2208
11-
#include "hdPrman/cone.h"
12-
#include "hdPrman/cylinder.h"
13-
#include "hdPrman/sphere.h"
14-
#endif
15-
#include "hdPrman/renderParam.h"
16-
#include "hdPrman/renderBuffer.h"
17-
#if PXR_VERSION >= 2308
18-
#include "hdPrman/renderSettings.h"
19-
#include "hdPrman/integrator.h"
20-
#include "hdPrman/sampleFilter.h"
21-
#include "hdPrman/displayFilter.h"
22-
#endif
2311
#include "hdPrman/coordSys.h"
2412
#include "hdPrman/instancer.h"
25-
#include "hdPrman/renderParam.h"
26-
#include "hdPrman/renderPass.h"
2713
#include "hdPrman/light.h"
2814
#include "hdPrman/lightFilter.h"
2915
#include "hdPrman/material.h"
3016
#include "hdPrman/mesh.h"
3117
#include "hdPrman/points.h"
18+
#include "hdPrman/renderBuffer.h"
19+
#include "hdPrman/renderParam.h"
20+
#include "hdPrman/renderPass.h"
3221
#include "hdPrman/resourceRegistry.h"
22+
#include "hdPrman/sceneIndexObserverApi.h"
3323
#include "hdPrman/tokens.h"
3424
#include "hdPrman/volume.h"
35-
#include "hdPrman/sceneIndexObserverApi.h"
36-
37-
#ifdef HDPRMAN_USE_SCENE_INDEX_OBSERVER
38-
#include "hdPrman/rileyPrimFactory.h"
39-
#include "pxr/imaging/hdsi/primManagingSceneIndexObserver.h"
40-
#include "pxr/imaging/hdsi/primTypeNoticeBatchingSceneIndex.h"
41-
#endif
4225

26+
#include "pxr/imaging/hd/aov.h"
4327
#include "pxr/imaging/hd/bprim.h"
44-
#include "pxr/imaging/hd/camera.h"
28+
#include "pxr/imaging/hd/dataSource.h"
4529
#include "pxr/imaging/hd/extComputation.h"
30+
#include "pxr/imaging/hd/instancer.h"
31+
#include "pxr/imaging/hd/renderDelegate.h"
4632
#include "pxr/imaging/hd/rprim.h"
47-
#include "pxr/imaging/hd/sceneIndex.h"
33+
#include "pxr/imaging/hd/rprimCollection.h"
4834
#include "pxr/imaging/hd/sprim.h"
4935
#include "pxr/imaging/hd/tokens.h"
36+
#include "pxr/imaging/hd/types.h"
5037
#include "pxr/imaging/hd/version.h"
5138

39+
#include "pxr/usd/sdf/path.h"
40+
41+
#include "pxr/base/gf/vec3f.h"
42+
#include "pxr/base/gf/vec4f.h"
43+
#include "pxr/base/tf/diagnostic.h"
44+
#include "pxr/base/tf/envSetting.h"
45+
#include "pxr/base/tf/getenv.h"
46+
#include "pxr/base/tf/staticData.h"
47+
#include "pxr/base/tf/staticTokens.h"
48+
#include "pxr/base/tf/stringUtils.h"
49+
#include "pxr/base/tf/token.h"
50+
#include "pxr/base/vt/array.h"
51+
#include "pxr/base/vt/dictionary.h"
52+
#include "pxr/base/vt/value.h"
53+
54+
#include "pxr/pxr.h"
55+
56+
#include <memory>
57+
#include <prmanapi.h>
58+
#include <string>
59+
#include <vector>
60+
61+
#ifdef HDPRMAN_USE_SCENE_INDEX_OBSERVER
62+
#include "hdPrman/rileyPrimFactory.h"
63+
64+
#include "pxr/imaging/hdsi/primManagingSceneIndexObserver.h"
65+
#include "pxr/imaging/hdsi/primTypeNoticeBatchingSceneIndex.h"
66+
#endif
5267
#if HD_API_VERSION >= 60
5368
#include "pxr/imaging/hd/renderCapabilitiesSchema.h"
5469
#include "pxr/imaging/hd/retainedDataSource.h"
5570
#endif
56-
57-
#include "pxr/base/tf/envSetting.h"
58-
#include "pxr/base/tf/getenv.h"
71+
#if PXR_VERSION >= 2208
72+
#include "hdPrman/cone.h"
73+
#include "hdPrman/cylinder.h"
74+
#include "hdPrman/sphere.h"
75+
#endif
76+
#if PXR_VERSION >= 2308
77+
#include "hdPrman/displayFilter.h"
78+
#include "hdPrman/integrator.h"
79+
#include "hdPrman/renderSettings.h"
80+
#include "hdPrman/sampleFilter.h"
81+
#endif
5982

6083
PXR_NAMESPACE_OPEN_SCOPE
6184

@@ -323,13 +346,23 @@ HdPrmanRenderDelegate::_Initialize()
323346
// automate using PRManOptions.args.
324347
_settingDescriptors.reserve(5);
325348

326-
const std::string integrator = TfGetenv(
327-
"HD_PRMAN_INTEGRATOR", HdPrmanIntegratorTokens->PxrPathTracer);
328-
_settingDescriptors.push_back({
329-
std::string("Integrator"),
330-
HdPrmanRenderSettingsTokens->integratorName,
331-
VtValue(integrator)
332-
});
349+
const std::string integrator = TfGetenv("HD_PRMAN_INTEGRATOR");
350+
if (!integrator.empty()) {
351+
// The priority order should be:
352+
// 1) RenderSettings prim + Integrator prim
353+
// 2) Legacy RenderSettingsMap
354+
// 3) HD_PRMAN_INTEGRATOR
355+
// 4) HdPrman_RenderParam::SetDefaultIntegratorOverride()
356+
// 5) PxrPathTracer
357+
// So we only include this here if the env var is set. We cannot include
358+
// a fallback value here. Otherwise we cannot tell (3) from (5).
359+
// Fallback resolution is now handled by RenderParam.
360+
_settingDescriptors.push_back({
361+
std::string("Integrator"),
362+
HdPrmanRenderSettingsTokens->integratorName,
363+
VtValue(integrator)
364+
});
365+
}
333366

334367
if (TfGetEnvSetting(HD_PRMAN_ENABLE_QUICKINTEGRATE)) {
335368
const std::string interactiveIntegrator =

0 commit comments

Comments
 (0)