Commit 480822bf authored by Ken Martin's avatar Ken Martin

reduce opengl2 module dependencies

Reduce opengl2 dependencies in two ways
first move a class that renderingcore depends on from
filterExtraction to FiltersGeneral. FiltersExtraction pulls
in a lot of other modules where FiltersGeneral does not.
FiltersExtraction already depends on filtersGeneral so it
should be backwards compatible.

The second change is a new feature to allow a back implementation
to be required or not. In this case gl2ps was originally required
by OpenGl2 now it is optional. This required adding an option to
the module code to specify when a backend implementation is required.
parent 94c297a1
......@@ -44,7 +44,9 @@ foreach(backend ${VTK_BACKENDS})
if(${backend} STREQUAL "${VTK_RENDERING_BACKEND}")
message(STATUS "Enabling modules for ${backend}.")
foreach(module ${VTK_BACKEND_${backend}_MODULES})
list(APPEND ${${module}_IMPLEMENTS}_IMPLEMENTATIONS ${module})
if (${${module}_IMPLEMENTATION_REQUIRED_BY_BACKEND})
list(APPEND ${${module}_IMPLEMENTS}_IMPLEMENTATIONS ${module})
endif()
endforeach()
endif()
endforeach()
......
......@@ -50,6 +50,7 @@ macro(vtk_module _name)
set(${vtk-module}_PRIVATE_DEPENDS "")
set(${vtk-module-test}_DEPENDS "${vtk-module}")
set(${vtk-module}_IMPLEMENTS "")
set(${vtk-module}_IMPLEMENTATION_REQUIRED_BY_BACKEND 0)
set(${vtk-module}_BACKEND "")
set(${vtk-module}_DESCRIPTION "description")
set(${vtk-module}_TCL_NAME "${vtk-module}")
......@@ -75,6 +76,9 @@ macro(vtk_module _name)
elseif("${arg}" STREQUAL "EXCLUDE_FROM_WRAP_HIERARCHY")
set(_doing "")
set(${vtk-module}_EXCLUDE_FROM_WRAP_HIERARCHY 1)
elseif("${arg}" STREQUAL "IMPLEMENTATION_REQUIRED_BY_BACKEND")
set(_doing "")
set(${vtk-module}_IMPLEMENTATION_REQUIRED_BY_BACKEND 1)
elseif("${arg}" MATCHES "^[A-Z][A-Z][A-Z]$" AND
NOT "${arg}" MATCHES "^(ON|OFF|MPI)$")
set(_doing "")
......
......@@ -292,6 +292,19 @@ foreach(vtk-module ${VTK_MODULES_ALL})
endif()
endforeach()
#hide options of modules that are part of a different backend
# or are required by the backend
foreach(backend ${VTK_BACKENDS})
foreach(module ${VTK_BACKEND_${backend}_MODULES})
if(NOT ${module}_IS_TEST)
if((NOT (${backend} STREQUAL "${VTK_RENDERING_BACKEND}")) OR
${module}_IMPLEMENTATION_REQUIRED_BY_BACKEND)
set_property(CACHE Module_${module} PROPERTY TYPE INTERNAL)
endif()
endif()
endforeach()
endforeach()
if(NOT VTK_MODULES_ENABLED)
message(WARNING "No modules enabled!")
file(REMOVE "${VTK_BINARY_DIR}/VTKTargets.cmake")
......
......@@ -12,14 +12,12 @@ set(Module_SRCS
vtkExtractPolyDataGeometry.cxx
vtkExtractRectilinearGrid.cxx
vtkExtractSelectedBlock.cxx
vtkExtractSelectedFrustum.cxx
vtkExtractSelectedIds.cxx
vtkExtractSelectedLocations.cxx
vtkExtractSelectedPolyDataIds.cxx
vtkExtractSelectedRows.cxx
vtkExtractSelectedThresholds.cxx
vtkExtractSelection.cxx
vtkExtractSelectionBase.cxx
vtkExtractTemporalFieldData.cxx
vtkExtractTensorComponents.cxx
vtkExtractUnstructuredGrid.cxx
......
......@@ -28,6 +28,8 @@ set(Module_SRCS
vtkDicer.cxx
vtkDiscreteMarchingCubes.cxx
vtkEdgePoints.cxx
vtkExtractSelectedFrustum.cxx
vtkExtractSelectionBase.cxx
vtkGradientFilter.cxx
vtkGraphLayoutFilter.cxx
vtkGraphToPoints.cxx
......
......@@ -33,7 +33,7 @@
#ifndef vtkExtractSelectedFrustum_h
#define vtkExtractSelectedFrustum_h
#include "vtkFiltersExtractionModule.h" // For export macro
#include "vtkFiltersGeneralModule.h" // For export macro
#include "vtkExtractSelectionBase.h"
class vtkPlanes;
......@@ -43,7 +43,7 @@ class vtkCell;
class vtkPoints;
class vtkDoubleArray;
class VTKFILTERSEXTRACTION_EXPORT vtkExtractSelectedFrustum : public vtkExtractSelectionBase
class VTKFILTERSGENERAL_EXPORT vtkExtractSelectedFrustum : public vtkExtractSelectionBase
{
public:
static vtkExtractSelectedFrustum *New();
......@@ -152,5 +152,3 @@ private:
};
#endif
......@@ -128,4 +128,3 @@ void vtkExtractSelectionBase::PrintSelf(ostream& os, vtkIndent indent)
this->Superclass::PrintSelf(os, indent);
os << indent << "PreserveTopology: " << this->PreserveTopology << endl;
}
......@@ -21,10 +21,10 @@
#ifndef vtkExtractSelectionBase_h
#define vtkExtractSelectionBase_h
#include "vtkFiltersExtractionModule.h" // For export macro
#include "vtkFiltersGeneralModule.h" // For export macro
#include "vtkDataObjectAlgorithm.h"
class VTKFILTERSEXTRACTION_EXPORT vtkExtractSelectionBase : public vtkDataObjectAlgorithm
class VTKFILTERSGENERAL_EXPORT vtkExtractSelectionBase : public vtkDataObjectAlgorithm
{
public:
vtkTypeMacro(vtkExtractSelectionBase, vtkDataObjectAlgorithm);
......@@ -67,5 +67,3 @@ private:
};
#endif
......@@ -5,6 +5,7 @@ vtk_module(vtkRenderingContextOpenGL
vtkRenderingContext2D
BACKEND
OpenGL
IMPLEMENTATION_REQUIRED_BY_BACKEND
PRIVATE_DEPENDS
vtkRenderingFreeType
KIT
......
......@@ -8,6 +8,7 @@ vtk_module(vtkRenderingContextOpenGL2
vtkRenderingContext2D
BACKEND
OpenGL2
IMPLEMENTATION_REQUIRED_BY_BACKEND
PRIVATE_DEPENDS
vtkRenderingFreeType
vtkglew
......
......@@ -8,7 +8,6 @@ vtk_module(vtkRenderingCore
PRIVATE_DEPENDS
vtkFiltersSources
vtkFiltersGeometry
vtkFiltersExtraction
vtksys
TEST_DEPENDS
vtkIOLegacy
......
......@@ -3,6 +3,7 @@ vtk_module(vtkRenderingOpenGL
vtkRenderingCore
BACKEND
OpenGL
IMPLEMENTATION_REQUIRED_BY_BACKEND
PRIVATE_DEPENDS
# These are likely to be removed soon - split Rendering/OpenGL further.
vtkImagingHybrid # For vtkSampleFunction
......
......@@ -7,8 +7,8 @@ vtk_module(vtkRenderingOpenGL2
vtkRenderingCore
BACKEND
OpenGL2
IMPLEMENTATION_REQUIRED_BY_BACKEND
PRIVATE_DEPENDS
vtkImagingHybrid
vtkglew
vtksys
COMPILE_DEPENDS
......
......@@ -45,10 +45,7 @@ Ph.D. thesis of Christian BOUCHENY.
#include "vtkTextureObject.h"
#include "vtkOpenGLRenderWindow.h"
#include "vtkPNGWriter.h"
#include "vtkImageImport.h"
#include "vtkPixelBufferObject.h"
#include "vtkImageExtractComponents.h"
#include "vtkCamera.h"
#include "vtkMath.h"
......
......@@ -20,8 +20,6 @@
#include "vtkCamera.h"
#include "vtkFrameBufferObject.h"
#include "vtkImageData.h"
#include "vtkImageExport.h"
#include "vtkImplicitHalo.h"
#include "vtkImplicitSum.h"
#include "vtkInformation.h"
#include "vtkInformationObjectBaseKey.h"
......@@ -39,7 +37,6 @@
#include "vtkPerspectiveTransform.h"
#include "vtkRenderPassCollection.h"
#include "vtkRenderState.h"
#include "vtkSampleFunction.h"
#include "vtkSequencePass.h"
#include "vtkShaderProgram.h"
#include "vtkShadowMapBakerPass.h"
......@@ -50,7 +47,6 @@
// debugging
#include "vtkTimerLog.h"
//#include "vtkBreakPoint.h"
#include <cassert>
#include <sstream>
......@@ -91,11 +87,6 @@ vtkShadowMapPass::vtkShadowMapPass()
vtkNew<vtkShadowMapBakerPass> bp;
this->ShadowMapBakerPass = 0;
this->SetShadowMapBakerPass(bp.Get());
this->IntensityMap=0;
this->IntensitySource=0;
this->IntensityExporter=0;
this->Halo=0;
}
// ----------------------------------------------------------------------------
......@@ -109,26 +100,6 @@ vtkShadowMapPass::~vtkShadowMapPass()
{
this->OpaqueSequence->Delete();
}
if(this->IntensityMap!=0)
{
vtkErrorMacro(<<"IntensityMap should have been deleted in ReleaseGraphicsResources().");
}
if(this->IntensitySource!=0)
{
this->IntensitySource->Delete();
}
if(this->IntensityExporter!=0)
{
this->IntensityExporter->Delete();
}
if(this->Halo!=0)
{
this->Halo->Delete();
}
}
// ----------------------------------------------------------------------------
......@@ -458,41 +429,6 @@ void vtkShadowMapPass::BuildShaderCode()
this->FragmentImplementation = fimpl;
}
// ----------------------------------------------------------------------------
void vtkShadowMapPass::BuildSpotLightIntensityMap()
{
if(this->IntensitySource==0)
{
this->IntensitySource=vtkSampleFunction::New();
this->IntensityExporter=vtkImageExport::New();
this->Halo=vtkImplicitHalo::New();
vtkImplicitSum *scale=vtkImplicitSum::New();
scale->AddFunction(this->Halo,255.0);
scale->SetNormalizeByWeight(false);
this->IntensitySource->SetImplicitFunction(scale);
scale->Delete();
}
unsigned int resolution=this->ShadowMapBakerPass->GetResolution();
this->Halo->SetRadius(resolution/2.0);
this->Halo->SetCenter(resolution/2.0,
resolution/2.0,0.0);
this->Halo->SetFadeOut(0.1);
this->IntensitySource->SetOutputScalarType(VTK_UNSIGNED_CHAR);
this->IntensitySource->SetSampleDimensions(
static_cast<int>(resolution),
static_cast<int>(resolution),1);
this->IntensitySource->SetModelBounds(0.0,resolution-1.0,
0.0,resolution-1.0,
0.0,0.0);
this->IntensitySource->SetComputeNormals(false);
this->IntensityExporter->SetInputConnection(
this->IntensitySource->GetOutputPort());
}
// ----------------------------------------------------------------------------
// Description:
// Release graphics resources and ask components to release their own
......@@ -505,10 +441,4 @@ void vtkShadowMapPass::ReleaseGraphicsResources(vtkWindow *w)
{
this->ShadowMapBakerPass->ReleaseGraphicsResources(w);
}
if(this->IntensityMap!=0)
{
this->IntensityMap->Delete();
this->IntensityMap=0;
}
}
......@@ -50,10 +50,6 @@ class vtkLight;
class vtkFrameBufferObject;
class vtkShadowMapPassTextures; // internal
class vtkShadowMapPassLightCameras; // internal
class vtkImageExport;
class vtkTextureObject;
class vtkImplicitHalo;
class vtkSampleFunction;
class vtkShadowMapBakerPass;
class vtkInformationObjectBaseKey;
class vtkShaderProgram;
......@@ -132,10 +128,6 @@ public:
// Destructor.
virtual ~vtkShadowMapPass();
// Description:
// Build the intensity map.
void BuildSpotLightIntensityMap();
// Description:
// Check if shadow mapping is supported by the current OpenGL context.
// \pre w_exists: w!=0
......@@ -153,12 +145,6 @@ public:
vtkShadowMapPassTextures *ShadowMaps;
vtkShadowMapPassLightCameras *LightCameras;
vtkTextureObject *IntensityMap;
vtkSampleFunction *IntensitySource;
vtkImageExport *IntensityExporter;
vtkImplicitHalo *Halo;
vtkTimeStamp LastRenderTime;
// to store the shader code and settings
......
......@@ -12,6 +12,7 @@ vtk_module(vtkRenderingVolumeOpenGL
vtkRenderingVolume
BACKEND
OpenGL
IMPLEMENTATION_REQUIRED_BY_BACKEND
DEPENDS
vtkRenderingOpenGL
${VTK_RENDERINGVOLUMEOPENGLNEW}
......
vtk_module(vtkRenderingVolumeOpenGL2
TCL_NAME
vtkRenderingVolumeOpenGLII
IMPLEMENTS
vtkRenderingVolume
BACKEND
OpenGL2
vtkRenderingVolumeOpenGLII
DEPENDS
vtkglew
vtkRenderingOpenGL2
IMPLEMENTS
vtkRenderingVolume
BACKEND
OpenGL2
IMPLEMENTATION_REQUIRED_BY_BACKEND
PRIVATE_DEPENDS
vtksys
vtkFiltersGeneral
......
......@@ -93,7 +93,7 @@ def ParseModuleFile(fileName):
languages = ['PYTHON', 'TCL', 'JAVA']
keywords = ['BACKEND', 'COMPILE_DEPENDS', 'DEPENDS', 'EXCLUDE_FROM_ALL',
'EXCLUDE_FROM_WRAPPING', 'GROUPS', 'IMPLEMENTS', 'KIT',
'PRIVATE_DEPENDS', 'TEST_DEPENDS'] + \
'PRIVATE_DEPENDS', 'TEST_DEPENDS', 'IMPLEMENTATION_REQUIRED_BY_BACKEND'] + \
map(lambda l: 'EXCLUDE_FROM_%s_WRAPPING' % l, languages)
moduleName = ""
depends = []
......
......@@ -168,7 +168,7 @@ def ParseModuleFile(fileName, renderingBackend='OpenGL'):
languages = ['PYTHON', 'TCL', 'JAVA']
keywords = ['BACKEND', 'COMPILE_DEPENDS', 'DEPENDS', 'EXCLUDE_FROM_ALL',
'EXCLUDE_FROM_WRAPPING', 'GROUPS', 'IMPLEMENTS', 'KIT',
'PRIVATE_DEPENDS', 'TEST_DEPENDS'] + \
'PRIVATE_DEPENDS', 'TEST_DEPENDS', 'IMPLEMENTATION_REQUIRED_BY_BACKEND'] + \
map(lambda l: 'EXCLUDE_FROM_%s_WRAPPING' % l, languages)
moduleName = ""
depends = []
......
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