MCPcopy Create free account
hub / github.com/Kitware/VTK / UpdateViewProps

Method UpdateViewProps

Rendering/Core/vtkLightActor.cxx:195–294  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

193
194//------------------------------------------------------------------------------
195void vtkLightActor::UpdateViewProps()
196{
197 if (this->Light == nullptr)
198 {
199 vtkDebugMacro(<< "no light.");
200 return;
201 }
202 double angle = this->Light->GetConeAngle();
203
204 if (this->Light->GetPositional() && angle < 90.0)
205 {
206 if (this->ConeSource == nullptr)
207 {
208 this->ConeSource = vtkConeSource::New();
209 }
210
211 this->ConeSource->SetResolution(24);
212 double* pos = this->Light->GetPosition();
213 double* f = this->Light->GetFocalPoint();
214
215 double direction[3];
216 int i = 0;
217 while (i < 3)
218 {
219 direction[i] = pos[i] - f[i];
220 ++i;
221 }
222 double height = 1.0;
223 double center[3]; //=pos
224
225 double n = vtkMath::Norm(direction);
226
227 // cone center is the middle of its axis, not the center of the base...
228 i = 0;
229 while (i < 3)
230 {
231 center[i] = pos[i] - 0.5 * height / n * direction[i];
232 ++i;
233 }
234 this->ConeSource->SetCenter(center);
235 this->ConeSource->SetDirection(direction);
236 this->ConeSource->SetHeight(height);
237 this->ConeSource->SetAngle(angle);
238
239 if (this->ConeMapper == nullptr)
240 {
241 this->ConeMapper = vtkPolyDataMapper::New();
242 this->ConeMapper->SetInputConnection(this->ConeSource->GetOutputPort());
243 this->ConeMapper->SetScalarVisibility(0);
244 }
245
246 if (this->ConeActor == nullptr)
247 {
248 this->ConeActor = vtkActor::New();
249 this->ConeActor->SetMapper(this->ConeMapper);
250 }
251
252 this->ConeActor->SetVisibility(this->Light->GetSwitch());

Callers 4

GetConePropertyMethod · 0.95
GetFrustumPropertyMethod · 0.95
RenderOpaqueGeometryMethod · 0.95
GetBoundsMethod · 0.95

Calls 15

SetViewUpMethod · 0.80
SetViewAngleMethod · 0.80
NewFunction · 0.70
NormFunction · 0.50
SetResolutionMethod · 0.45
GetPositionMethod · 0.45
SetCenterMethod · 0.45
SetDirectionMethod · 0.45
SetHeightMethod · 0.45
SetAngleMethod · 0.45
SetInputConnectionMethod · 0.45
GetOutputPortMethod · 0.45

Tested by

no test coverage detected