Skip to content

Commit

Permalink
hdPrman: making several classes private and removing some unneeded he…
Browse files Browse the repository at this point in the history
…aders.

(Internal change: 2205701)
  • Loading branch information
unhyperbolic authored and pixar-oss committed Dec 17, 2021
1 parent 04185ec commit 4a90e2b
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 63 deletions.
6 changes: 3 additions & 3 deletions third_party/renderman-24/plugin/hdPrman/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ pxr_plugin(${PXR_PACKAGE}
PUBLIC_CLASSES
basisCurves
camera
cameraContext
coordSys
debugCodes
gprim
Expand All @@ -75,20 +74,21 @@ pxr_plugin(${PXR_PACKAGE}
paramsSetter
points
renderDelegate
renderParam
renderViewContext
rixStrings
virtualStructResolvingSceneIndex
volume
xcpt
${optionalPublicClasses}

PRIVATE_CLASSES
cameraContext
renderPass
dataSourceMaterialNetworkInterface
framebuffer
hdMaterialNetwork2Interface
renderBuffer
renderParam
renderViewContext
resourceRegistry

PUBLIC_HEADERS
Expand Down
36 changes: 18 additions & 18 deletions third_party/renderman-24/plugin/hdPrman/cameraContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ PXR_NAMESPACE_OPEN_SCOPE

static const RtUString _us_main_cam_projection("main_cam_projection");

HdPrmanCameraContext::HdPrmanCameraContext()
HdPrman_CameraContext::HdPrman_CameraContext()
: _camera(nullptr)
, _policy(CameraUtilFit)
, _shutterOpenTime(0.0f)
Expand All @@ -48,7 +48,7 @@ HdPrmanCameraContext::HdPrmanCameraContext()
}

void
HdPrmanCameraContext::MarkCameraInvalid(const HdPrmanCamera * const camera)
HdPrman_CameraContext::MarkCameraInvalid(const HdPrmanCamera * const camera)
{
// No need to invalidate if camera that is not the active camera
// changed.
Expand All @@ -58,7 +58,7 @@ HdPrmanCameraContext::MarkCameraInvalid(const HdPrmanCamera * const camera)
}

void
HdPrmanCameraContext::SetCamera(const HdPrmanCamera * const camera)
HdPrman_CameraContext::SetCamera(const HdPrmanCamera * const camera)
{
if (camera) {
if (_cameraPath != camera->GetId()) {
Expand All @@ -78,7 +78,7 @@ HdPrmanCameraContext::SetCamera(const HdPrmanCamera * const camera)
}

void
HdPrmanCameraContext::SetFraming(const CameraUtilFraming &framing)
HdPrman_CameraContext::SetFraming(const CameraUtilFraming &framing)
{
if (_framing != framing) {
_framing = framing;
Expand All @@ -87,7 +87,7 @@ HdPrmanCameraContext::SetFraming(const CameraUtilFraming &framing)
}

void
HdPrmanCameraContext::SetWindowPolicy(
HdPrman_CameraContext::SetWindowPolicy(
const CameraUtilConformWindowPolicy policy)
{
if (_policy != policy) {
Expand All @@ -97,7 +97,7 @@ HdPrmanCameraContext::SetWindowPolicy(
}

void
HdPrmanCameraContext::SetShutterCurve(const float shutterOpenTime,
HdPrman_CameraContext::SetShutterCurve(const float shutterOpenTime,
const float shutterCloseTime,
const float shutteropeningPoints[8])
{
Expand All @@ -122,7 +122,7 @@ HdPrmanCameraContext::SetShutterCurve(const float shutterOpenTime,
}

bool
HdPrmanCameraContext::IsInvalid() const
HdPrman_CameraContext::IsInvalid() const
{
return _invalid;
}
Expand Down Expand Up @@ -320,7 +320,7 @@ _ComputeNodeParams(const HdCamera * const camera)

// Compute params given to Riley::ModifyCamera
RtParamList
HdPrmanCameraContext::_ComputeCameraParams(
HdPrman_CameraContext::_ComputeCameraParams(
const GfRange2d &screenWindow) const
{
RtParamList result;
Expand Down Expand Up @@ -406,7 +406,7 @@ _ToRtMatrices(
}

GfRange2d
HdPrmanCameraContext::_ComputeConformedScreenWindow() const
HdPrman_CameraContext::_ComputeConformedScreenWindow() const
{
return
CameraUtilConformedWindow(
Expand All @@ -416,7 +416,7 @@ HdPrmanCameraContext::_ComputeConformedScreenWindow() const
}

void
HdPrmanCameraContext::UpdateRileyCameraAndClipPlanes(
HdPrman_CameraContext::UpdateRileyCameraAndClipPlanes(
riley::Riley * const riley)
{
if (!_camera) {
Expand All @@ -435,7 +435,7 @@ HdPrmanCameraContext::UpdateRileyCameraAndClipPlanes(
}

void
HdPrmanCameraContext::UpdateRileyCameraAndClipPlanesInteractive(
HdPrman_CameraContext::UpdateRileyCameraAndClipPlanesInteractive(
riley::Riley * const riley,
const GfVec2i &renderBufferSize)
{
Expand Down Expand Up @@ -463,7 +463,7 @@ HdPrmanCameraContext::UpdateRileyCameraAndClipPlanesInteractive(
}

void
HdPrmanCameraContext::_UpdateRileyCamera(
HdPrman_CameraContext::_UpdateRileyCamera(
riley::Riley * const riley,
const GfRange2d &screenWindow)
{
Expand Down Expand Up @@ -550,7 +550,7 @@ _ToClipPlaneParams(const GfVec4d &plane, RtParamList * const params)
}

void
HdPrmanCameraContext::_UpdateClipPlanes(riley::Riley * const riley)
HdPrman_CameraContext::_UpdateClipPlanes(riley::Riley * const riley)
{
// Delete clipping planes
for (riley::ClippingPlaneId const& id: _clipPlaneIds) {
Expand Down Expand Up @@ -644,15 +644,15 @@ _ComputeCropWindow(
}

GfVec2i
HdPrmanCameraContext::GetResolutionFromDisplayWindow() const
HdPrman_CameraContext::GetResolutionFromDisplayWindow() const
{
const GfVec2f size = _framing.displayWindow.GetSize();

return GfVec2i(std::ceil(size[0]), std::ceil(size[1]));
}

void
HdPrmanCameraContext::SetRileyOptions(
HdPrman_CameraContext::SetRileyOptions(
RtParamList * const options) const
{
const GfVec2i res = GetResolutionFromDisplayWindow();
Expand All @@ -678,7 +678,7 @@ HdPrmanCameraContext::SetRileyOptions(
}

void
HdPrmanCameraContext::SetRileyOptionsInteractive(
HdPrman_CameraContext::SetRileyOptionsInteractive(
RtParamList * const options,
const GfVec2i &renderBufferSize) const
{
Expand All @@ -701,13 +701,13 @@ HdPrmanCameraContext::SetRileyOptionsInteractive(
}

void
HdPrmanCameraContext::MarkValid()
HdPrman_CameraContext::MarkValid()
{
_invalid = false;
}

void
HdPrmanCameraContext::Begin(riley::Riley * const riley)
HdPrman_CameraContext::Begin(riley::Riley * const riley)
{
// Create camera

Expand Down
6 changes: 3 additions & 3 deletions third_party/renderman-24/plugin/hdPrman/cameraContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ PXR_NAMESPACE_OPEN_SCOPE

class HdPrmanCamera;

/// HdPrmanCameraContext holds all the data necessary to populate the
/// HdPrman_CameraContext holds all the data necessary to populate the
/// riley camera and other camera-related riley options. It also keeps
/// track whether the camera or camera-related settings such as the
/// framing have changed so that updating riley is necessary.
///
class HdPrmanCameraContext final
class HdPrman_CameraContext final
{
public:
HdPrmanCameraContext();
HdPrman_CameraContext();

/// Call when hydra changed the transform or parameters of a camera.
void MarkCameraInvalid(const HdPrmanCamera * camera);
Expand Down
7 changes: 1 addition & 6 deletions third_party/renderman-24/plugin/hdPrman/renderDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@

PXR_NAMESPACE_OPEN_SCOPE

class HdPrman_RenderPass;
class HdPrman_RenderParam;
class HdPrman_InteractiveRenderParam;
class RixParamList;

#define HDPRMAN_RENDER_SETTINGS_TOKENS \
((integrator, "integrator")) \
((integratorName, "ri:integrator:name")) \
Expand Down Expand Up @@ -184,7 +179,7 @@ class HdPrmanRenderDelegate : public HdRenderDelegate
static const TfTokenVector SUPPORTED_SPRIM_TYPES;
static const TfTokenVector SUPPORTED_BPRIM_TYPES;

std::shared_ptr<HdPrman_RenderParam> _renderParam;
std::shared_ptr<class HdPrman_RenderParam> _renderParam;
HdResourceRegistrySharedPtr _resourceRegistry;
HdRenderPassSharedPtr _renderPass;
HdRenderSettingDescriptorList _settingDescriptors;
Expand Down
22 changes: 11 additions & 11 deletions third_party/renderman-24/plugin/hdPrman/renderParam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

#include "pxr/base/arch/fileSystem.h"
#include "pxr/base/work/threadLimits.h"
#include "pxr/base/gf/matrix4d.h"
#include "pxr/base/gf/matrix4f.h"
#include "pxr/base/gf/vec2f.h"
#include "pxr/base/gf/vec3f.h"
Expand All @@ -51,6 +50,7 @@
#include "pxr/imaging/hd/extComputationUtils.h"
#include "pxr/imaging/hd/sceneDelegate.h"
#include "pxr/imaging/hd/renderBuffer.h"
#include "pxr/imaging/hd/renderThread.h"

#include "Riley.h"
#include "RiTypesHelper.h"
Expand Down Expand Up @@ -1562,14 +1562,14 @@ _ToRtParamList(VtDictionary const& dict)
}

static
HdPrmanRenderViewDesc
HdPrman_RenderViewDesc
_ComputeRenderViewDesc(
const VtDictionary &renderSpec,
const riley::CameraId cameraId,
const riley::IntegratorId integratorId,
const GfVec2i &resolution)
{
HdPrmanRenderViewDesc renderViewDesc;
HdPrman_RenderViewDesc renderViewDesc;

renderViewDesc.cameraId = cameraId;
renderViewDesc.integratorId = integratorId;
Expand All @@ -1587,7 +1587,7 @@ _ComputeRenderViewDesc(
HdPrmanExperimentalRenderSpecTokens->name);
const RtUString name(nameStr.c_str());

HdPrmanRenderViewDesc::RenderOutputDesc renderOutputDesc;
HdPrman_RenderViewDesc::RenderOutputDesc renderOutputDesc;
renderOutputDesc.name = name;
renderOutputDesc.type = _ToRenderOutputType(
VtDictionaryGet<TfToken>(
Expand All @@ -1609,7 +1609,7 @@ _ComputeRenderViewDesc(
HdPrmanExperimentalRenderSpecTokens->renderProducts);

for (const VtDictionary &renderProduct : renderProducts) {
HdPrmanRenderViewDesc::DisplayDesc displayDesc;
HdPrman_RenderViewDesc::DisplayDesc displayDesc;

const TfToken &name =
VtDictionaryGet<TfToken>(
Expand Down Expand Up @@ -1654,7 +1654,7 @@ void
HdPrman_RenderParam::CreateRenderViewFromSpec(
const VtDictionary &renderSpec)
{
const HdPrmanRenderViewDesc renderViewDesc =
const HdPrman_RenderViewDesc renderViewDesc =
_ComputeRenderViewDesc(
renderSpec,
GetCameraContext().GetCameraId(),
Expand Down Expand Up @@ -1837,7 +1837,7 @@ HdPrman_RenderParam::_RenderThreadCallback()
break;
}

HdPrmanRenderViewContext &ctx = GetRenderViewContext();
HdPrman_RenderViewContext &ctx = GetRenderViewContext();

const riley::RenderViewId renderViewIds[] = { ctx.GetRenderViewId() };

Expand Down Expand Up @@ -2106,7 +2106,7 @@ HdPrman_RenderParam::CreateFramebufferAndRenderViewFromAovs(
_framebuffer->h = 0;
}
// Displays & Display Channels
HdPrmanRenderViewDesc renderViewDesc;
HdPrman_RenderViewDesc renderViewDesc;

std::unordered_map<RtUString, RtUString> sourceNames;
for( size_t aov = 0; aov < aovBindings.size(); ++aov )
Expand Down Expand Up @@ -2257,7 +2257,7 @@ HdPrman_RenderParam::CreateFramebufferAndRenderViewFromAovs(
}

{
HdPrmanRenderViewDesc::RenderOutputDesc renderOutputDesc;
HdPrman_RenderViewDesc::RenderOutputDesc renderOutputDesc;
renderOutputDesc.name = aovName;
renderOutputDesc.type = rt;
renderOutputDesc.sourceName = sourceName;
Expand All @@ -2275,7 +2275,7 @@ HdPrman_RenderParam::CreateFramebufferAndRenderViewFromAovs(
// This assumption is reflected in framebuffer.cpp HydraDspyData
if(rt == riley::RenderOutputType::k_Color && componentCount == 4)
{
HdPrmanRenderViewDesc::RenderOutputDesc renderOutputDesc;
HdPrman_RenderViewDesc::RenderOutputDesc renderOutputDesc;
renderOutputDesc.name = RixStr.k_a;
renderOutputDesc.type = riley::RenderOutputType::k_Float;
renderOutputDesc.sourceName = RixStr.k_a;
Expand Down Expand Up @@ -2320,7 +2320,7 @@ HdPrman_RenderParam::CreateFramebufferAndRenderViewFromAovs(
}

{
HdPrmanRenderViewDesc::DisplayDesc displayDesc;
HdPrman_RenderViewDesc::DisplayDesc displayDesc;
displayDesc.name = RixStr.k_framebuffer;
displayDesc.driver = driver;
displayDesc.params = displayParams;
Expand Down
11 changes: 5 additions & 6 deletions third_party/renderman-24/plugin/hdPrman/renderParam.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "hdPrman/renderViewContext.h"
#include "pxr/imaging/hd/sceneDelegate.h"
#include "pxr/imaging/hd/renderDelegate.h"
#include "pxr/imaging/hd/renderThread.h"
#include "pxr/base/gf/matrix4d.h"

#include "Riley.h"
Expand Down Expand Up @@ -201,9 +200,9 @@ class HdPrman_RenderParam : public HdRenderParam
// Provides external access to resources used to set parameters for
// options and the active integrator.
RtParamList &GetOptions() { return _options; }
HdPrmanCameraContext &GetCameraContext() { return _cameraContext; }
HdPrman_CameraContext &GetCameraContext() { return _cameraContext; }

HdPrmanRenderViewContext &GetRenderViewContext() {
HdPrman_RenderViewContext &GetRenderViewContext() {
return _renderViewContext;
}

Expand Down Expand Up @@ -301,7 +300,7 @@ class HdPrman_RenderParam : public HdRenderParam

void _RenderThreadCallback();

std::unique_ptr<HdRenderThread> _renderThread;
std::unique_ptr<class HdRenderThread> _renderThread;
std::unique_ptr<HdPrmanFramebuffer> _framebuffer;

int _sceneLightCount;
Expand Down Expand Up @@ -350,8 +349,8 @@ class HdPrman_RenderParam : public HdRenderParam
std::mutex _coordSysMutex;

RtParamList _options;
HdPrmanCameraContext _cameraContext;
HdPrmanRenderViewContext _renderViewContext;
HdPrman_CameraContext _cameraContext;
HdPrman_RenderViewContext _renderViewContext;

// A quick way to disable motion blur, making shutter close same as open
bool _instantaneousShutter;
Expand Down
4 changes: 2 additions & 2 deletions third_party/renderman-24/plugin/hdPrman/renderPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ HdPrman_RenderPass::_Execute(
const HdPrmanCamera * const hdCam =
dynamic_cast<HdPrmanCamera const *>(renderPassState->GetCamera());

HdPrmanCameraContext &cameraContext =
HdPrman_CameraContext &cameraContext =
_renderParam->GetCameraContext();
cameraContext.SetCamera(hdCam);
if (renderPassState->GetFraming().IsValid()) {
Expand Down Expand Up @@ -471,7 +471,7 @@ HdPrman_RenderPass::_RenderInMainThread()
_renderParam->SetActiveIntegratorId(
_renderParam->GetIntegratorId());

HdPrmanRenderViewContext &ctx =
HdPrman_RenderViewContext &ctx =
_renderParam->GetRenderViewContext();

const riley::RenderViewId renderViews[] = { ctx.GetRenderViewId() };
Expand Down
Loading

0 comments on commit 4a90e2b

Please sign in to comment.