Commit 519be1b0 authored by François Bertel's avatar François Bertel
Browse files

ENH:Deprecate GetColor() on vtkLightSource as it just does not make sense.

parent ef9df1e7
......@@ -372,7 +372,7 @@ void vtkRIBExporter::WriteLight (vtkLight *aLight, int count)
// get required info from light
Intensity = aLight->GetIntensity();
Color = aLight->GetColor();
Color = aLight->GetDiffuseColor();
color[0] = Intensity * Color[0];
color[1] = Intensity * Color[1];
color[2] = Intensity * Color[2];
......
......@@ -323,7 +323,7 @@ void vtkX3DExporter::WriteALight(vtkLight *aLight,
pos = aLight->GetPosition();
focus = aLight->GetFocalPoint();
colord = aLight->GetColor();
colord = aLight->GetDiffuseColor();
dir[0] = focus[0] - pos[0];
dir[1] = focus[1] - pos[1];
......
......@@ -189,7 +189,7 @@ void vtkIVExporter::WriteALight(vtkLight *aLight, FILE *fp)
pos = aLight->GetPosition();
focus = aLight->GetFocalPoint();
color = aLight->GetColor();
color = aLight->GetDiffuseColor();
dir[0] = focus[0] - pos[0];
dir[1] = focus[1] - pos[1];
......
......@@ -141,23 +141,29 @@ void vtkLight::SetColor(double R, double G, double B)
this->SetSpecularColor(R, G, B);
}
#ifndef VTK_LEGACY_REMOVE
// This method assumes that the SetColor() method was called which sets both
// the specular and diffuse colors to the same value. In the future, we may
// want to change this to compute the composite light color, similar to
// vtkProperty.
double *vtkLight::GetColor()
{
VTK_LEGACY_REPLACED_BODY(vtkLight::GetColor,"VTK 5.7",
vtkLight::GetDiffuseColor);
return this->DiffuseColor;
}
void vtkLight::GetColor(double rgb[3])
{
VTK_LEGACY_REPLACED_BODY(vtkLight::GetColor,"VTK 5.7",
vtkLight::GetDiffuseColor);
// May want to change this to compute the composite
// light color, similar to vtkProperty.
rgb[0] = this->DiffuseColor[0];
rgb[1] = this->DiffuseColor[1];
rgb[2] = this->DiffuseColor[2];
}
#endif // #ifndef VTK_LEGACY_REMOVE
int vtkLight::LightTypeIsHeadlight()
{
......
......@@ -90,8 +90,11 @@ public:
vtkGetVectorMacro(SpecularColor,double,3);
void SetColor(double, double, double);
void SetColor(double a[3]) { this->SetColor(a[0], a[1], a[2]); }
void GetColor(double rgb[3]);
double *GetColor();
// Description:
// @deprecated Use GetDiffuseColor instead as of VTK 5.7.
VTK_LEGACY(void GetColor(double rgb[3]));
VTK_LEGACY(double *GetColor());
// Description:
// Set/Get the position of the light.
......
......@@ -249,7 +249,7 @@ void vtkLightActor::UpdateViewProps()
vtkProperty *p=this->ConeActor->GetProperty();
p->SetLighting(false);
p->SetColor(this->Light->GetColor());
p->SetColor(this->Light->GetDiffuseColor());
p->SetRepresentationToWireframe();
if(this->CameraLight==0)
......
......@@ -237,7 +237,7 @@ void vtkOOGLExporter::WriteALight(vtkLight *aLight, FILE *fp)
pos = aLight->GetPosition();
focus = aLight->GetFocalPoint();
color = aLight->GetColor();
color = aLight->GetDiffuseColor();
dir[0] = focus[0] - pos[0];
dir[1] = focus[1] - pos[1];
......
......@@ -283,7 +283,7 @@ void vtkPOVExporter::WriteLight(vtkLight *light)
fprintf(this->FilePtr, "\t<%f, %f, %f>\n",
position[0], position[1], position[2]);
double *color = light->GetColor();
double *color = light->GetDiffuseColor();
fprintf(this->FilePtr, "\tcolor <%f, %f, %f>*%f\n",
color[0], color[1], color[2],
light->GetIntensity());
......
......@@ -189,7 +189,7 @@ void vtkVRMLExporter::WriteALight(vtkLight *aLight, FILE *fp)
pos = aLight->GetPosition();
focus = aLight->GetFocalPoint();
color = aLight->GetColor();
color = aLight->GetDiffuseColor();
dir[0] = focus[0] - pos[0];
dir[1] = focus[1] - pos[1];
......
......@@ -1514,9 +1514,12 @@ void vtkOpenGLVolumeTextureMapper3D::GetLightInformation(
else
{
float lightIntensity = light[lightIndex]->GetIntensity();
double lightColor[3];
light[lightIndex]->GetColor( lightColor );
double lightAmbColor[3];
double lightDiffColor[3];
double lightSpecColor[3];
light[lightIndex]->GetAmbientColor( lightAmbColor );
light[lightIndex]->GetDiffuseColor( lightDiffColor );
light[lightIndex]->GetSpecularColor( lightSpecColor );
double lightPosition[3];
double lightFocalPoint[3];
......@@ -1532,14 +1535,20 @@ void vtkOpenGLVolumeTextureMapper3D::GetLightInformation(
vtkMath::Normalize( dir );
lightDiffuseColor[lightIndex][0] = lightColor[0]*diffuse*lightIntensity;
lightDiffuseColor[lightIndex][1] = lightColor[1]*diffuse*lightIntensity;
lightDiffuseColor[lightIndex][2] = lightColor[2]*diffuse*lightIntensity;
lightDiffuseColor[lightIndex][0] = lightDiffColor[0]*diffuse
*lightIntensity;
lightDiffuseColor[lightIndex][1] = lightDiffColor[1]*diffuse
*lightIntensity;
lightDiffuseColor[lightIndex][2] = lightDiffColor[2]*diffuse
*lightIntensity;
lightDiffuseColor[lightIndex][3] = 1.0;
lightSpecularColor[lightIndex][0]= lightColor[0]*specular*lightIntensity;
lightSpecularColor[lightIndex][1]= lightColor[1]*specular*lightIntensity;
lightSpecularColor[lightIndex][2]= lightColor[2]*specular*lightIntensity;
lightSpecularColor[lightIndex][0]= lightSpecColor[0]*specular
*lightIntensity;
lightSpecularColor[lightIndex][1]= lightSpecColor[1]*specular
*lightIntensity;
lightSpecularColor[lightIndex][2]= lightSpecColor[2]*specular
*lightIntensity;
lightSpecularColor[lightIndex][3] = 0.0;
half[0] = dir[0] - viewDirection[0];
......@@ -1548,9 +1557,9 @@ void vtkOpenGLVolumeTextureMapper3D::GetLightInformation(
vtkMath::Normalize( half );
ambientColor[0] += ambient*lightColor[0];
ambientColor[1] += ambient*lightColor[1];
ambientColor[2] += ambient*lightColor[2];
ambientColor[0] += ambient*lightAmbColor[0];
ambientColor[1] += ambient*lightAmbColor[1];
ambientColor[2] += ambient*lightAmbColor[2];
}
lightDirection[lightIndex][0] = (dir[0]+1.0)/2.0;
......@@ -1641,9 +1650,12 @@ void vtkOpenGLVolumeTextureMapper3D::SetupProgramLocalsForShadingFP(
else
{
float lightIntensity = light[lightIndex]->GetIntensity();
double lightColor[3];
light[lightIndex]->GetColor( lightColor );
double lightAmbColor[3];
double lightDiffColor[3];
double lightSpecColor[3];
light[lightIndex]->GetAmbientColor( lightAmbColor );
light[lightIndex]->GetDiffuseColor( lightDiffColor );
light[lightIndex]->GetSpecularColor( lightSpecColor );
double lightPosition[3];
double lightFocalPoint[3];
......@@ -1659,14 +1671,20 @@ void vtkOpenGLVolumeTextureMapper3D::SetupProgramLocalsForShadingFP(
vtkMath::Normalize( dir );
lightDiffuseColor[lightIndex][0] = lightColor[0]*diffuse*lightIntensity;
lightDiffuseColor[lightIndex][1] = lightColor[1]*diffuse*lightIntensity;
lightDiffuseColor[lightIndex][2] = lightColor[2]*diffuse*lightIntensity;
lightDiffuseColor[lightIndex][0] = lightDiffColor[0]*diffuse
*lightIntensity;
lightDiffuseColor[lightIndex][1] = lightDiffColor[1]*diffuse
*lightIntensity;
lightDiffuseColor[lightIndex][2] = lightDiffColor[2]*diffuse
*lightIntensity;
lightDiffuseColor[lightIndex][3] = 0.0;
lightSpecularColor[lightIndex][0]= lightColor[0]*specular*lightIntensity;
lightSpecularColor[lightIndex][1]= lightColor[1]*specular*lightIntensity;
lightSpecularColor[lightIndex][2]= lightColor[2]*specular*lightIntensity;
lightSpecularColor[lightIndex][0]= lightSpecColor[0]*specular
*lightIntensity;
lightSpecularColor[lightIndex][1]= lightSpecColor[1]*specular
*lightIntensity;
lightSpecularColor[lightIndex][2]= lightSpecColor[2]*specular
*lightIntensity;
lightSpecularColor[lightIndex][3] = 0.0;
half[0] = dir[0] - viewDirection[0];
......@@ -1675,9 +1693,9 @@ void vtkOpenGLVolumeTextureMapper3D::SetupProgramLocalsForShadingFP(
vtkMath::Normalize( half );
ambientColor[0] += ambient*lightColor[0];
ambientColor[1] += ambient*lightColor[1];
ambientColor[2] += ambient*lightColor[2];
ambientColor[0] += ambient*lightAmbColor[0];
ambientColor[1] += ambient*lightAmbColor[1];
ambientColor[2] += ambient*lightAmbColor[2];
}
lightDirection[lightIndex][0] = dir[0];
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment