Commit fc6ca437 authored by Ken Martin's avatar Ken Martin

added light override

parent ece2ba8f
......@@ -301,13 +301,6 @@ set(opengl_overrides
list(APPEND vtk_module_overrides "vtkPolyDataMapper")
set(vtk_module_vtkPolyDataMapper_override "vtkPainterPolyDataMapper")
# A crazy hack, Ken encouraged me to write, where we override the overrides
# when the option is set to see what the new OpenGL2 code does in all regression
# tests. Right now there is just one (the poly data mapper) with more to follow.
if(VTK_REPLACE_OPENGL_OVERRIDES)
set(vtk_module_vtkPolyDataMapper_override "vtkVBOPolyDataMapper")
endif()
# FIXME: Not sure that this is the best way to handle X...
if(VTK_USE_X)
find_package(X11 REQUIRED)
......@@ -405,6 +398,14 @@ foreach(_override ${opengl_overrides})
vtk_add_override(vtk${_override} vtkOpenGL${_override})
endforeach()
# A crazy hack, Ken encouraged me to write, where we override the overrides
# when the option is set to see what the new OpenGL2 code does in all regression
# tests. Right now there is just one (the poly data mapper) with more to follow.
if(VTK_REPLACE_OPENGL_OVERRIDES)
set(vtk_module_vtkPolyDataMapper_override "vtkVBOPolyDataMapper")
set(vtk_module_vtkLight_override "vtkOpenGL2Light")
endif()
# Now we iterate and create that class file...
foreach(_class ${vtk_module_overrides})
set(_override ${vtk_module_${_class}_override})
......
......@@ -18,6 +18,7 @@ set(Module_SRCS
vtkglShader.cxx
vtkglShaderProgram.cxx
vtkglTexture2D.cxx
vtkOpenGL2Light.cxx
vtkVBOPolyDataMapper.cxx
${CMAKE_CURRENT_BINARY_DIR}/${vtk-module}ObjectFactory.cxx
)
......
/*=========================================================================
Program: Visualization Toolkit
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "vtkOpenGL2Light.h"
#include "vtkObjectFactory.h"
vtkStandardNewMacro(vtkOpenGL2Light);
// Implement base class method.
void vtkOpenGL2Light::Render(vtkRenderer *vtkNotUsed(ren), int vtkNotUsed(light_index))
{
// all handled by the mappers
}
//----------------------------------------------------------------------------
void vtkOpenGL2Light::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
}
/*=========================================================================
Program: Visualization Toolkit
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkOpenGL2Light - OpenGL light
// .SECTION Description
// vtkOpenGL2Light is a concrete implementation of the abstract class vtkLight.
// vtkOpenGL2Light interfaces to the OpenGL rendering library.
#ifndef __vtkOpenGL2Light_h
#define __vtkOpenGL2Light_h
#include "vtkRenderingOpenGL2Module.h" // For export macro
#include "vtkLight.h"
class vtkOpenGLRenderer;
class VTKRENDERINGOPENGL2_EXPORT vtkOpenGL2Light : public vtkLight
{
public:
static vtkOpenGL2Light *New();
vtkTypeMacro(vtkOpenGL2Light, vtkLight);
virtual void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Implement base class method.
void Render(vtkRenderer *ren, int light_index);
protected:
vtkOpenGL2Light() {}
~vtkOpenGL2Light() {}
private:
vtkOpenGL2Light(const vtkOpenGL2Light&); // Not implemented.
void operator=(const vtkOpenGL2Light&); // Not implemented.
};
#endif
......@@ -103,22 +103,10 @@ void vtkVBOPolyDataMapper::UpdateShader(vtkRenderer* ren, vtkActor *actor)
numberOfLights++;
}
double *dc = light->GetDiffuseColor();
double *sc = light->GetSpecularColor();
bool colored = false;
for (int i = 0; i < 3; ++i)
{
if (dc[i] != 1.0 || sc[i] != 1.0)
{
colored = true;
break;
}
}
if (lightComplexity == 1
&& (light->GetIntensity() != 1.0
|| light->GetLightType() != VTK_LIGHT_TYPE_HEADLIGHT
|| colored))
&& (numberOfLights > 1
|| light->GetIntensity() != 1.0
|| light->GetLightType() != VTK_LIGHT_TYPE_HEADLIGHT))
{
lightComplexity = 2;
}
......
Markdown is supported
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