Skip to content

Commit

Permalink
Add support for treatAsPoint on the sphere light. (#578)
Browse files Browse the repository at this point in the history
Fixes #577
  • Loading branch information
sirpalee committed Oct 20, 2020
1 parent 0fd3bc3 commit 4e5710f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions render_delegate/constant_strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ ASTR(node_idxs);
ASTR(nodes);
ASTR(none);
ASTR(normal);
ASTR(normalize);
ASTR(normal_nonexistant_rename);
ASTR(nsides);
ASTR(opacity);
Expand Down
9 changes: 8 additions & 1 deletion render_delegate/light.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ TF_DEFINE_PRIVATE_TOKENS(
(barndoorrightedge)
(barndoortop)
(barndoortopedge)
(treatAsPoint)
);
// clang-format on

Expand Down Expand Up @@ -207,7 +208,13 @@ 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);
iterateParams(light, nentry, id, delegate, pointParams);
const auto treatAsPointValue = delegate->GetLightParamValue(id, _tokens->treatAsPoint);
if (treatAsPointValue.IsHolding<bool>() && treatAsPointValue.UncheckedGet<bool>()) {
AiNodeSetFlt(light, str::radius, 0.0f);
AiNodeSetBool(light, str::normalize, true);
} else {
iterateParams(light, nentry, id, delegate, pointParams);
}
};

auto photometricLightSync = [](AtNode* light, AtNode** filter, const AtNodeEntry* nentry, const SdfPath& id,
Expand Down

0 comments on commit 4e5710f

Please sign in to comment.