All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
offlineContext.h
1 //
2 // Copyright 2021 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef EXT_RMANPKG_24_0_PLUGIN_RENDERMAN_PLUGIN_HD_PRMAN_OFFLINE_CONTEXT_H
25 #define EXT_RMANPKG_24_0_PLUGIN_RENDERMAN_PLUGIN_HD_PRMAN_OFFLINE_CONTEXT_H
26 
27 #include "pxr/pxr.h"
28 #include "hdPrman/api.h"
29 #include "hdPrman/context.h"
30 
31 #include "Riley.h"
32 
33 PXR_NAMESPACE_OPEN_SCOPE
34 
35 // Context for offline rendering in HdPrman.
36 struct HdPrman_OfflineContext: public HdPrman_Context
37 {
38  struct RenderOutput
39  {
40  RtUString name;
41  riley::RenderOutputType type;
42  RtParamList params;
43  };
44 
45  HDPRMAN_API
46  HdPrman_OfflineContext();
47 
48  HDPRMAN_API
49  ~HdPrman_OfflineContext();
50 
51  // Produces a render
52  HDPRMAN_API
53  void Render();
54 
55  // Checks whether context was successfully initialized.
56  HDPRMAN_API
57  bool IsValid() const;
58 
59  HDPRMAN_API
60  void InitializeWithDefaults();
61  HDPRMAN_API
62  void Initialize(
63  RtParamList rileyOptions,
64  riley::ShadingNode integratorNode,
65  RtUString cameraName,
66  riley::ShadingNode cameraNode,
67  riley::Transform cameraXform, RtParamList cameraParams,
68  riley::Extent outputFormat, TfToken outputFilename,
69  std::vector<riley::ShadingNode> const & fallbackMaterialNodes,
70  std::vector<riley::ShadingNode> const & fallbackVolumeNodes,
71  std::vector<RenderOutput> const & renderOutputs);
72 
73  // Optional facility to quickly add a light to Riley
74  HDPRMAN_API
75  void SetFallbackLight(
76  riley::ShadingNode node,
77  riley::Transform xform,
78  RtParamList params);
79 
80  riley::CameraId cameraId;
81 
82 private:
83  // Finishes the renderer
84  void _End();
85  void _SetRileyOptions(RtParamList options);
86  void _SetRileyIntegrator(riley::ShadingNode node);
87  void _SetCamera(RtUString name,
88  riley::ShadingNode node,
89  riley::Transform xform,
90  RtParamList params);
91  void _AddRenderOutput(RtUString name,
92  riley::RenderOutputType type,
93  RtParamList const& params);
94  void _SetRenderTargetAndDisplay(
95  riley::Extent format,TfToken outputFilename);
96  void _SetFallbackMaterial(
97  std::vector<riley::ShadingNode> const & materialNodes);
98  void _SetFallbackVolumeMaterial(
99  std::vector<riley::ShadingNode> const & materialNodes);
100 
101  riley::IntegratorId _integratorId;
102  riley::RenderTargetId _rtid;
103  std::vector<riley::RenderViewId> _renderViews;
104  std::vector<riley::RenderOutputId> _renderOutputs;
105  riley::LightInstanceId _fallbackLightId;
106 };
107 
108 PXR_NAMESPACE_CLOSE_SCOPE
109 
110 #endif // EXT_RMANPKG_24_0_PLUGIN_RENDERMAN_PLUGIN_HD_PRMAN_OFFLINE_CONTEXT_H
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:87