Skip to content

Commit 519be1b

Browse files
ENH:Deprecate GetColor() on vtkLightSource as it just does not make sense.
1 parent ef9df1e commit 519be1b

File tree

10 files changed

+60
-33
lines changed

10 files changed

+60
-33
lines changed

Hybrid/vtkRIBExporter.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ void vtkRIBExporter::WriteLight (vtkLight *aLight, int count)
372372

373373
// get required info from light
374374
Intensity = aLight->GetIntensity();
375-
Color = aLight->GetColor();
375+
Color = aLight->GetDiffuseColor();
376376
color[0] = Intensity * Color[0];
377377
color[1] = Intensity * Color[1];
378378
color[2] = Intensity * Color[2];

Hybrid/vtkX3DExporter.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ void vtkX3DExporter::WriteALight(vtkLight *aLight,
323323

324324
pos = aLight->GetPosition();
325325
focus = aLight->GetFocalPoint();
326-
colord = aLight->GetColor();
326+
colord = aLight->GetDiffuseColor();
327327

328328
dir[0] = focus[0] - pos[0];
329329
dir[1] = focus[1] - pos[1];

Rendering/vtkIVExporter.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ void vtkIVExporter::WriteALight(vtkLight *aLight, FILE *fp)
189189

190190
pos = aLight->GetPosition();
191191
focus = aLight->GetFocalPoint();
192-
color = aLight->GetColor();
192+
color = aLight->GetDiffuseColor();
193193

194194
dir[0] = focus[0] - pos[0];
195195
dir[1] = focus[1] - pos[1];

Rendering/vtkLight.cxx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,23 +141,29 @@ void vtkLight::SetColor(double R, double G, double B)
141141
this->SetSpecularColor(R, G, B);
142142
}
143143

144+
#ifndef VTK_LEGACY_REMOVE
144145
// This method assumes that the SetColor() method was called which sets both
145146
// the specular and diffuse colors to the same value. In the future, we may
146147
// want to change this to compute the composite light color, similar to
147148
// vtkProperty.
148149
double *vtkLight::GetColor()
149150
{
151+
VTK_LEGACY_REPLACED_BODY(vtkLight::GetColor,"VTK 5.7",
152+
vtkLight::GetDiffuseColor);
150153
return this->DiffuseColor;
151154
}
152155

153156
void vtkLight::GetColor(double rgb[3])
154157
{
158+
VTK_LEGACY_REPLACED_BODY(vtkLight::GetColor,"VTK 5.7",
159+
vtkLight::GetDiffuseColor);
155160
// May want to change this to compute the composite
156161
// light color, similar to vtkProperty.
157162
rgb[0] = this->DiffuseColor[0];
158163
rgb[1] = this->DiffuseColor[1];
159164
rgb[2] = this->DiffuseColor[2];
160165
}
166+
#endif // #ifndef VTK_LEGACY_REMOVE
161167

162168
int vtkLight::LightTypeIsHeadlight()
163169
{

Rendering/vtkLight.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,11 @@ class VTK_RENDERING_EXPORT vtkLight : public vtkObject
9090
vtkGetVectorMacro(SpecularColor,double,3);
9191
void SetColor(double, double, double);
9292
void SetColor(double a[3]) { this->SetColor(a[0], a[1], a[2]); }
93-
void GetColor(double rgb[3]);
94-
double *GetColor();
93+
94+
// Description:
95+
// @deprecated Use GetDiffuseColor instead as of VTK 5.7.
96+
VTK_LEGACY(void GetColor(double rgb[3]));
97+
VTK_LEGACY(double *GetColor());
9598

9699
// Description:
97100
// Set/Get the position of the light.

Rendering/vtkLightActor.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ void vtkLightActor::UpdateViewProps()
249249

250250
vtkProperty *p=this->ConeActor->GetProperty();
251251
p->SetLighting(false);
252-
p->SetColor(this->Light->GetColor());
252+
p->SetColor(this->Light->GetDiffuseColor());
253253
p->SetRepresentationToWireframe();
254254

255255
if(this->CameraLight==0)

Rendering/vtkOOGLExporter.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ void vtkOOGLExporter::WriteALight(vtkLight *aLight, FILE *fp)
237237

238238
pos = aLight->GetPosition();
239239
focus = aLight->GetFocalPoint();
240-
color = aLight->GetColor();
240+
color = aLight->GetDiffuseColor();
241241

242242
dir[0] = focus[0] - pos[0];
243243
dir[1] = focus[1] - pos[1];

Rendering/vtkPOVExporter.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ void vtkPOVExporter::WriteLight(vtkLight *light)
283283
fprintf(this->FilePtr, "\t<%f, %f, %f>\n",
284284
position[0], position[1], position[2]);
285285

286-
double *color = light->GetColor();
286+
double *color = light->GetDiffuseColor();
287287
fprintf(this->FilePtr, "\tcolor <%f, %f, %f>*%f\n",
288288
color[0], color[1], color[2],
289289
light->GetIntensity());

Rendering/vtkVRMLExporter.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ void vtkVRMLExporter::WriteALight(vtkLight *aLight, FILE *fp)
189189

190190
pos = aLight->GetPosition();
191191
focus = aLight->GetFocalPoint();
192-
color = aLight->GetColor();
192+
color = aLight->GetDiffuseColor();
193193

194194
dir[0] = focus[0] - pos[0];
195195
dir[1] = focus[1] - pos[1];

VolumeRendering/vtkOpenGLVolumeTextureMapper3D.cxx

Lines changed: 42 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,9 +1514,12 @@ void vtkOpenGLVolumeTextureMapper3D::GetLightInformation(
15141514
else
15151515
{
15161516
float lightIntensity = light[lightIndex]->GetIntensity();
1517-
double lightColor[3];
1518-
1519-
light[lightIndex]->GetColor( lightColor );
1517+
double lightAmbColor[3];
1518+
double lightDiffColor[3];
1519+
double lightSpecColor[3];
1520+
light[lightIndex]->GetAmbientColor( lightAmbColor );
1521+
light[lightIndex]->GetDiffuseColor( lightDiffColor );
1522+
light[lightIndex]->GetSpecularColor( lightSpecColor );
15201523

15211524
double lightPosition[3];
15221525
double lightFocalPoint[3];
@@ -1532,14 +1535,20 @@ void vtkOpenGLVolumeTextureMapper3D::GetLightInformation(
15321535

15331536
vtkMath::Normalize( dir );
15341537

1535-
lightDiffuseColor[lightIndex][0] = lightColor[0]*diffuse*lightIntensity;
1536-
lightDiffuseColor[lightIndex][1] = lightColor[1]*diffuse*lightIntensity;
1537-
lightDiffuseColor[lightIndex][2] = lightColor[2]*diffuse*lightIntensity;
1538+
lightDiffuseColor[lightIndex][0] = lightDiffColor[0]*diffuse
1539+
*lightIntensity;
1540+
lightDiffuseColor[lightIndex][1] = lightDiffColor[1]*diffuse
1541+
*lightIntensity;
1542+
lightDiffuseColor[lightIndex][2] = lightDiffColor[2]*diffuse
1543+
*lightIntensity;
15381544
lightDiffuseColor[lightIndex][3] = 1.0;
15391545

1540-
lightSpecularColor[lightIndex][0]= lightColor[0]*specular*lightIntensity;
1541-
lightSpecularColor[lightIndex][1]= lightColor[1]*specular*lightIntensity;
1542-
lightSpecularColor[lightIndex][2]= lightColor[2]*specular*lightIntensity;
1546+
lightSpecularColor[lightIndex][0]= lightSpecColor[0]*specular
1547+
*lightIntensity;
1548+
lightSpecularColor[lightIndex][1]= lightSpecColor[1]*specular
1549+
*lightIntensity;
1550+
lightSpecularColor[lightIndex][2]= lightSpecColor[2]*specular
1551+
*lightIntensity;
15431552
lightSpecularColor[lightIndex][3] = 0.0;
15441553

15451554
half[0] = dir[0] - viewDirection[0];
@@ -1548,9 +1557,9 @@ void vtkOpenGLVolumeTextureMapper3D::GetLightInformation(
15481557

15491558
vtkMath::Normalize( half );
15501559

1551-
ambientColor[0] += ambient*lightColor[0];
1552-
ambientColor[1] += ambient*lightColor[1];
1553-
ambientColor[2] += ambient*lightColor[2];
1560+
ambientColor[0] += ambient*lightAmbColor[0];
1561+
ambientColor[1] += ambient*lightAmbColor[1];
1562+
ambientColor[2] += ambient*lightAmbColor[2];
15541563
}
15551564

15561565
lightDirection[lightIndex][0] = (dir[0]+1.0)/2.0;
@@ -1641,9 +1650,12 @@ void vtkOpenGLVolumeTextureMapper3D::SetupProgramLocalsForShadingFP(
16411650
else
16421651
{
16431652
float lightIntensity = light[lightIndex]->GetIntensity();
1644-
double lightColor[3];
1645-
1646-
light[lightIndex]->GetColor( lightColor );
1653+
double lightAmbColor[3];
1654+
double lightDiffColor[3];
1655+
double lightSpecColor[3];
1656+
light[lightIndex]->GetAmbientColor( lightAmbColor );
1657+
light[lightIndex]->GetDiffuseColor( lightDiffColor );
1658+
light[lightIndex]->GetSpecularColor( lightSpecColor );
16471659

16481660
double lightPosition[3];
16491661
double lightFocalPoint[3];
@@ -1659,14 +1671,20 @@ void vtkOpenGLVolumeTextureMapper3D::SetupProgramLocalsForShadingFP(
16591671

16601672
vtkMath::Normalize( dir );
16611673

1662-
lightDiffuseColor[lightIndex][0] = lightColor[0]*diffuse*lightIntensity;
1663-
lightDiffuseColor[lightIndex][1] = lightColor[1]*diffuse*lightIntensity;
1664-
lightDiffuseColor[lightIndex][2] = lightColor[2]*diffuse*lightIntensity;
1674+
lightDiffuseColor[lightIndex][0] = lightDiffColor[0]*diffuse
1675+
*lightIntensity;
1676+
lightDiffuseColor[lightIndex][1] = lightDiffColor[1]*diffuse
1677+
*lightIntensity;
1678+
lightDiffuseColor[lightIndex][2] = lightDiffColor[2]*diffuse
1679+
*lightIntensity;
16651680
lightDiffuseColor[lightIndex][3] = 0.0;
16661681

1667-
lightSpecularColor[lightIndex][0]= lightColor[0]*specular*lightIntensity;
1668-
lightSpecularColor[lightIndex][1]= lightColor[1]*specular*lightIntensity;
1669-
lightSpecularColor[lightIndex][2]= lightColor[2]*specular*lightIntensity;
1682+
lightSpecularColor[lightIndex][0]= lightSpecColor[0]*specular
1683+
*lightIntensity;
1684+
lightSpecularColor[lightIndex][1]= lightSpecColor[1]*specular
1685+
*lightIntensity;
1686+
lightSpecularColor[lightIndex][2]= lightSpecColor[2]*specular
1687+
*lightIntensity;
16701688
lightSpecularColor[lightIndex][3] = 0.0;
16711689

16721690
half[0] = dir[0] - viewDirection[0];
@@ -1675,9 +1693,9 @@ void vtkOpenGLVolumeTextureMapper3D::SetupProgramLocalsForShadingFP(
16751693

16761694
vtkMath::Normalize( half );
16771695

1678-
ambientColor[0] += ambient*lightColor[0];
1679-
ambientColor[1] += ambient*lightColor[1];
1680-
ambientColor[2] += ambient*lightColor[2];
1696+
ambientColor[0] += ambient*lightAmbColor[0];
1697+
ambientColor[1] += ambient*lightAmbColor[1];
1698+
ambientColor[2] += ambient*lightAmbColor[2];
16811699
}
16821700

16831701
lightDirection[lightIndex][0] = dir[0];

0 commit comments

Comments
 (0)