MCPcopy Create free account
hub / github.com/NVIDIA-RTX/Donut / SetDirection

Method SetDirection

src/engine/SceneTypes.cpp:95–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93}
94
95void Light::SetDirection(const dm::double3& direction) const
96{
97 auto node = GetNode();
98 if (!node)
99 {
100 assert(!"Lights must be attached in order to set their direction");
101 return;
102 }
103
104 SceneGraphNode* parent = node->GetParent();
105 dm::daffine3 parentToWorld = dm::daffine3::identity();
106 if (parent)
107 parentToWorld = daffine3(parent->GetLocalToWorldTransform());
108
109 daffine3 worldToLocal = lookatZ(direction);
110 daffine3 localToParent = inverse(worldToLocal * parentToWorld);
111
112 dquat rotation;
113 double3 scaling;
114 decomposeAffine<double>(localToParent, nullptr, &rotation, &scaling);
115
116 node->SetTransform(nullptr, &rotation, &scaling);
117}
118
119std::shared_ptr<SceneGraphLeaf> DirectionalLight::Clone()
120{

Callers 2

LightEditor_SpotMethod · 0.80

Calls 4

lookatZFunction · 0.85
GetParentMethod · 0.80
inverseFunction · 0.50
SetTransformMethod · 0.45

Tested by

no test coverage detected