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

Method UpdateShadingTable

Rendering/Volume/vtkEncodedGradientShader.cxx:180–350  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178}
179
180void vtkEncodedGradientShader::UpdateShadingTable(
181 vtkRenderer* ren, vtkVolume* vol, vtkEncodedGradientEstimator* gradest)
182{
183 double lightDirection[3], material[4];
184 double lightAmbientColor[3];
185 double lightDiffuseColor[3];
186 double lightSpecularColor[3];
187 double lightPosition[3], lightFocalPoint[3];
188 double lightIntensity, viewDirection[3];
189 double cameraPosition[3], cameraFocalPoint[3], mag;
190 vtkLightCollection* lightCollection;
191 vtkLight* light;
192 double norm;
193 int update_flag;
194 vtkVolumeProperty* property;
195 vtkTransform* transform;
196 vtkMatrix4x4* m;
197 double in[4], out[4], zero[4];
198 int index;
199
200 // Figure out which shading table we are working with
201 // First search through all existing ones, then if one
202 // is not found, use the first available index
203 for (index = 0; index < VTK_MAX_SHADING_TABLES; index++)
204 {
205 if (this->ShadingTableVolume[index] == vol)
206 {
207 break;
208 }
209 }
210
211 if (index == VTK_MAX_SHADING_TABLES)
212 {
213 for (index = 0; index < VTK_MAX_SHADING_TABLES; index++)
214 {
215 if (this->ShadingTableVolume[index] == nullptr)
216 {
217 this->ShadingTableVolume[index] = vol;
218 break;
219 }
220 }
221 }
222 if (index == VTK_MAX_SHADING_TABLES)
223 {
224 vtkErrorMacro(<< "Too many shading tables!\n"
225 << "Increase limit VTK_MAX_SHADING_TABLES and recompile!");
226 return;
227 }
228
229 transform = vtkTransform::New();
230 m = vtkMatrix4x4::New();
231
232 vol->GetMatrix(m);
233 transform->SetMatrix(m);
234 transform->Inverse();
235
236 property = vol->GetProperty();
237

Callers

nothing calls this directly

Calls 15

BuildShadingTableMethod · 0.95
GetSpecularPowerMethod · 0.80
GetActiveCameraMethod · 0.80
SetIntensityMethod · 0.80
GetNextLightMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
sqrtFunction · 0.50
GetMatrixMethod · 0.45
SetMatrixMethod · 0.45

Tested by

no test coverage detected