21const std::unordered_map<TfToken, PassType, TfToken::HashFunctor>
kAovToPass = {
40 : session(session_), keep_nodes(keep_nodes), _ownCyclesSession(
false)
51 unique_ptr<ShaderGraph>
graph = make_unique<ShaderGraph>();
56 graph->connect(bgNode->
output(
"Background"),
graph->output()->input(
"Surface"));
64 unique_ptr<ShaderGraph>
graph = make_unique<ShaderGraph>();
70 graph->connect(objectNode->
output(
"Color"), diffuseNode->input(
"Color"));
71 graph->connect(diffuseNode->output(
"BSDF"),
graph->output()->input(
"Surface"));
74 const ustring instanceId(HdAovTokens->instanceId.GetString());
77 aovNode->set_name(instanceId);
80 instanceIdNode->set_attribute(instanceId);
91 if (_ownCyclesSession) {
102 Light *background_light =
nullptr;
103 bool have_lights =
false;
105 if (!object->get_geometry()->is_light()) {
111 Light *light =
static_cast<Light *
>(
object->get_geometry());
113 background_light = light;
118 if (!background_light) {
125 if (
node->is_a(BackgroundNode::get_node_type())) {
149 _aovBindings = aovBindings;
150 for (
const HdRenderPassAovBinding &aovBinding : aovBindings) {
151 const auto cyclesAov = kAovToPass.find(aovBinding.aovName);
152 if (cyclesAov == kAovToPass.end()) {
154 TF_WARN(
"Unknown pass %s", aovBinding.aovName.GetText());
158 const PassType type = cyclesAov->second;
162 pass->set_type(type);
163 pass->set_mode(mode);
164 pass->set_name(ustring(aovBinding.aovName.GetString()));
170 for (HdRenderPassAovBinding &aovBinding : _aovBindings) {
171 if (renderBuffer == aovBinding.renderBuffer) {
172 aovBinding.renderBuffer =
nullptr;
177 if (renderBuffer == _displayAovBinding.renderBuffer) {
178 _displayAovBinding.renderBuffer =
nullptr;
KDTree *BLI_kdtree_nd_ new(unsigned int nodes_len_capacity)
void tag_update(Scene *scene)
HdCyclesSession(CCL_NS::Session *session_, const bool keep_nodes)
~HdCyclesSession() override
CCL_NS::Session * session
void RemoveAovBinding(PXR_NS::HdRenderBuffer *renderBuffer)
void SyncAovBindings(const PXR_NS::HdRenderPassAovBindingVector &aovBindings)
ShaderInput * input(const char *name)
ShaderOutput * output(const char *name)
void set_graph(unique_ptr< ShaderGraph > &&graph)
void tag_update(Scene *scene)
NODE_DECLARE unique_ptr< ShaderGraph > graph
#define HDCYCLES_NAMESPACE_CLOSE_SCOPE
ccl_device_inline float3 one_float3()
CCL_NAMESPACE_BEGIN ccl_device_inline float3 zero_float3()
const std::unordered_map< TfToken, PassType, TfToken::HashFunctor > kAovToPass
std::shared_ptr< const T > get(const GenericKey &key, FunctionRef< std::unique_ptr< T >()> compute_fn)
Shader * get_shader() const
SceneLock(const PXR_NS::HdRenderParam *renderParam)
unique_ptr< LightManager > light_manager
Shader * default_background
T * create_node(Args &&...)=delete
void delete_nodes(const set< T * > &nodes)
unique_ptr_vector< Object > objects
unique_ptr_vector< Pass > passes