Commit b77f5498 authored by Marcus D. Hanwell's avatar Marcus D. Hanwell
Browse files

ENH: Added build system for RenderingVolumeOpenGL

Removed the hard coded object factory, and use the standard mechanism.
Make the tests depend on vtkRenderingVolumeOpenGL, kept them in the
vtkRenderingVolume module as they do not use the OpenGL classes.

Change-Id: Ie70b18058aafd56ea0a338ca5c7c7019cced3f9a
parent fae19f6b
......@@ -13,13 +13,6 @@ set(Module_SRCS
vtkFixedPointVolumeRayCastMIPHelper.cxx
vtkGPUVolumeRayCastMapper.cxx
vtkHAVSVolumeMapper.cxx
vtkOpenGLGPUVolumeRayCastMapper.cxx
vtkOpenGLHAVSVolumeMapper.cxx
vtkOpenGLProjectedAAHexahedraMapper.cxx
vtkOpenGLProjectedTetrahedraMapper.cxx
vtkOpenGLRayCastImageDisplayHelper.cxx
vtkOpenGLVolumeTextureMapper2D.cxx
vtkOpenGLVolumeTextureMapper3D.cxx
vtkProjectedAAHexahedraMapper.cxx
vtkProjectedTetrahedraMapper.cxx
vtkRayCastImageDisplayHelper.cxx
......@@ -67,70 +60,4 @@ set_source_files_properties(
ABSTRACT
)
set(shader_files
vtkGPUVolumeRayCastMapper_AdditiveFS.glsl
vtkGPUVolumeRayCastMapper_AdditiveCroppingFS.glsl
vtkGPUVolumeRayCastMapper_AdditiveNoCroppingFS.glsl
vtkGPUVolumeRayCastMapper_CompositeFS.glsl
vtkGPUVolumeRayCastMapper_CompositeMaskFS.glsl
vtkGPUVolumeRayCastMapper_CompositeBinaryMaskFS.glsl
vtkGPUVolumeRayCastMapper_CompositeCroppingFS.glsl
vtkGPUVolumeRayCastMapper_CompositeNoCroppingFS.glsl
vtkGPUVolumeRayCastMapper_HeaderFS.glsl
vtkGPUVolumeRayCastMapper_MIPCroppingFS.glsl
vtkGPUVolumeRayCastMapper_MIPFS.glsl
vtkGPUVolumeRayCastMapper_MIPBinaryMaskFS.glsl
vtkGPUVolumeRayCastMapper_MIPFourDependentFS.glsl
vtkGPUVolumeRayCastMapper_MIPFourDependentCroppingFS.glsl
vtkGPUVolumeRayCastMapper_MIPFourDependentNoCroppingFS.glsl
vtkGPUVolumeRayCastMapper_MIPNoCroppingFS.glsl
vtkGPUVolumeRayCastMapper_MinIPCroppingFS.glsl
vtkGPUVolumeRayCastMapper_MinIPFS.glsl
vtkGPUVolumeRayCastMapper_MinIPBinaryMaskFS.glsl
vtkGPUVolumeRayCastMapper_MinIPFourDependentFS.glsl
vtkGPUVolumeRayCastMapper_MinIPFourDependentCroppingFS.glsl
vtkGPUVolumeRayCastMapper_MinIPFourDependentNoCroppingFS.glsl
vtkGPUVolumeRayCastMapper_MinIPNoCroppingFS.glsl
vtkGPUVolumeRayCastMapper_ParallelProjectionFS.glsl
vtkGPUVolumeRayCastMapper_PerspectiveProjectionFS.glsl
vtkGPUVolumeRayCastMapper_ScaleBiasFS.glsl
vtkGPUVolumeRayCastMapper_OneComponentFS.glsl
vtkGPUVolumeRayCastMapper_FourComponentsFS.glsl
vtkGPUVolumeRayCastMapper_NoShadeFS.glsl
vtkGPUVolumeRayCastMapper_ShadeFS.glsl
vtkHAVSVolumeMapper_kbufferVP.asm
vtkHAVSVolumeMapper_k2FP.asm
vtkHAVSVolumeMapper_k2BeginFP.asm
vtkHAVSVolumeMapper_k2EndFP.asm
vtkHAVSVolumeMapper_k6FP.asm
vtkHAVSVolumeMapper_k6BeginFP.asm
vtkHAVSVolumeMapper_k6EndFP.asm
vtkProjectedAAHexahedraMapper_VS.glsl
vtkProjectedAAHexahedraMapper_GS.glsl
vtkProjectedAAHexahedraMapper_FS.glsl
vtkVolumeTextureMapper3D_FourDependentNoShadeFP.asm
vtkVolumeTextureMapper3D_FourDependentShadeFP.asm
vtkVolumeTextureMapper3D_OneComponentNoShadeFP.asm
vtkVolumeTextureMapper3D_OneComponentShadeFP.asm
vtkVolumeTextureMapper3D_TwoDependentNoShadeFP.asm
vtkVolumeTextureMapper3D_TwoDependentShadeFP.asm
)
unset(shader_h_files)
foreach(file ${shader_files})
get_filename_component(file_we ${file} NAME_WE)
set(src ${CMAKE_CURRENT_SOURCE_DIR}/${file})
set(res ${CMAKE_CURRENT_BINARY_DIR}/${file_we}.cxx)
set(resh ${CMAKE_CURRENT_BINARY_DIR}/${file_we}.h)
list(APPEND shader_h_files ${resh})
add_custom_command(
OUTPUT ${res} ${resh}
DEPENDS ${src} vtkEncodeString
COMMAND vtkEncodeString
ARGS ${res} ${src} ${file_we} --build-header VTKRENDERINGVOLUME_EXPORT vtkRenderingVolumeModule.h
)
list(APPEND Module_SRCS ${res})
set_source_files_properties(${file_we} WRAP_EXCLUDE)
endforeach()
vtk_module_library(vtkRenderingVolume ${Module_SRCS})
......@@ -29,7 +29,6 @@
#include "vtkDataSetTriangleFilter.h"
#include "vtkMaskFields.h"
#include "vtkMergeFields.h"
#include "vtkOpenGLProjectedTetrahedraMapper.h"
#include "vtkProjectedAAHexahedraMapper.h"
#include "vtkPiecewiseFunction.h"
#include "vtkPolyDataMapper.h"
......@@ -40,6 +39,7 @@
#include "vtkUnstructuredGridReader.h"
#include "vtkUnstructuredGrid.h"
#include "vtkVolumeProperty.h"
#include "vtkProjectedTetrahedraMapper.h"
#include "vtkTestUtilities.h"
#include "vtkRegressionTestImage.h"
......
......@@ -4,12 +4,14 @@ vtk_module(vtkRenderingVolume
StandAlone
DEPENDS
vtkImagingCore
vtkRenderingOpenGL
vtkRenderingCore
TEST_DEPENDS
vtkTestingCore
vtkTestingRendering
vtkRenderingVolumeOpenGL
vtkRenderingFreeType
vtkImagingSources
vtkImagingGeneral
vtkImagingHybrid
vtkInteractionStyle
)
......@@ -17,20 +17,6 @@
#include "vtkVolumeRenderingFactory.h"
#include "vtkToolkits.h"
#include "vtkDebugLeaks.h"
#include "vtkGraphicsFactory.h"
// if using some sort of opengl, then include these files
#include "vtkOpenGLGPUVolumeRayCastMapper.h"
#include "vtkOpenGLHAVSVolumeMapper.h"
#include "vtkOpenGLProjectedAAHexahedraMapper.h"
#include "vtkOpenGLProjectedTetrahedraMapper.h"
#include "vtkOpenGLRayCastImageDisplayHelper.h"
#include "vtkOpenGLVolumeTextureMapper2D.h"
#include "vtkOpenGLVolumeTextureMapper3D.h"
#include "vtkCriticalSection.h"
#include "stdlib.h"
vtkStandardNewMacro(vtkVolumeRenderingFactory);
......@@ -49,52 +35,6 @@ vtkObject* vtkVolumeRenderingFactory::CreateInstance(const char* vtkclassname )
#ifdef VTK_DEBUG_LEAKS
vtkDebugLeaks::DestructClass(vtkclassname);
#endif
const char *rl = vtkGraphicsFactory::GetRenderLibrary();
// if (!strcmp("OpenGL",rl) || !strcmp("Win32OpenGL",rl) || !strcmp("CarbonOpenGL",rl) || !strcmp("CocoaOpenGL",rl))
{
// GPU Ray Cast Mapper
if(strcmp(vtkclassname, "vtkGPUVolumeRayCastMapper") == 0)
{
return vtkOpenGLGPUVolumeRayCastMapper::New();
}
// Projected axis-aligned hexahedra mapper
if(strcmp(vtkclassname, "vtkProjectedAAHexahedraMapper") == 0)
{
return vtkOpenGLProjectedAAHexahedraMapper::New();
}
// Projected Tetrahedra Mapper
if(strcmp(vtkclassname, "vtkProjectedTetrahedraMapper") == 0)
{
return vtkOpenGLProjectedTetrahedraMapper::New();
}
// HAVS Mapper
if(strcmp(vtkclassname, "vtkHAVSVolumeMapper") == 0)
{
return vtkOpenGLHAVSVolumeMapper::New();
}
// 2D Volume Texture Mapper
if(strcmp(vtkclassname, "vtkVolumeTextureMapper2D") == 0)
{
return vtkOpenGLVolumeTextureMapper2D::New();
}
// 3D Volume Texture Mapper
if(strcmp(vtkclassname, "vtkVolumeTextureMapper3D") == 0)
{
return vtkOpenGLVolumeTextureMapper3D::New();
}
// Ray Cast Image Display Helper
if(strcmp(vtkclassname, "vtkRayCastImageDisplayHelper") == 0)
{
return vtkOpenGLRayCastImageDisplayHelper::New();
}
}
return 0;
}
......
set(Module_SRCS
vtkOpenGLGPUVolumeRayCastMapper.cxx
vtkOpenGLHAVSVolumeMapper.cxx
vtkOpenGLProjectedAAHexahedraMapper.cxx
vtkOpenGLProjectedTetrahedraMapper.cxx
vtkOpenGLRayCastImageDisplayHelper.cxx
vtkOpenGLVolumeTextureMapper2D.cxx
vtkOpenGLVolumeTextureMapper3D.cxx
)
set(shader_files
vtkGPUVolumeRayCastMapper_AdditiveFS.glsl
vtkGPUVolumeRayCastMapper_AdditiveCroppingFS.glsl
vtkGPUVolumeRayCastMapper_AdditiveNoCroppingFS.glsl
vtkGPUVolumeRayCastMapper_CompositeFS.glsl
vtkGPUVolumeRayCastMapper_CompositeMaskFS.glsl
vtkGPUVolumeRayCastMapper_CompositeBinaryMaskFS.glsl
vtkGPUVolumeRayCastMapper_CompositeCroppingFS.glsl
vtkGPUVolumeRayCastMapper_CompositeNoCroppingFS.glsl
vtkGPUVolumeRayCastMapper_HeaderFS.glsl
vtkGPUVolumeRayCastMapper_MIPCroppingFS.glsl
vtkGPUVolumeRayCastMapper_MIPFS.glsl
vtkGPUVolumeRayCastMapper_MIPBinaryMaskFS.glsl
vtkGPUVolumeRayCastMapper_MIPFourDependentFS.glsl
vtkGPUVolumeRayCastMapper_MIPFourDependentCroppingFS.glsl
vtkGPUVolumeRayCastMapper_MIPFourDependentNoCroppingFS.glsl
vtkGPUVolumeRayCastMapper_MIPNoCroppingFS.glsl
vtkGPUVolumeRayCastMapper_MinIPCroppingFS.glsl
vtkGPUVolumeRayCastMapper_MinIPFS.glsl
vtkGPUVolumeRayCastMapper_MinIPBinaryMaskFS.glsl
vtkGPUVolumeRayCastMapper_MinIPFourDependentFS.glsl
vtkGPUVolumeRayCastMapper_MinIPFourDependentCroppingFS.glsl
vtkGPUVolumeRayCastMapper_MinIPFourDependentNoCroppingFS.glsl
vtkGPUVolumeRayCastMapper_MinIPNoCroppingFS.glsl
vtkGPUVolumeRayCastMapper_ParallelProjectionFS.glsl
vtkGPUVolumeRayCastMapper_PerspectiveProjectionFS.glsl
vtkGPUVolumeRayCastMapper_ScaleBiasFS.glsl
vtkGPUVolumeRayCastMapper_OneComponentFS.glsl
vtkGPUVolumeRayCastMapper_FourComponentsFS.glsl
vtkGPUVolumeRayCastMapper_NoShadeFS.glsl
vtkGPUVolumeRayCastMapper_ShadeFS.glsl
vtkHAVSVolumeMapper_kbufferVP.asm
vtkHAVSVolumeMapper_k2FP.asm
vtkHAVSVolumeMapper_k2BeginFP.asm
vtkHAVSVolumeMapper_k2EndFP.asm
vtkHAVSVolumeMapper_k6FP.asm
vtkHAVSVolumeMapper_k6BeginFP.asm
vtkHAVSVolumeMapper_k6EndFP.asm
vtkProjectedAAHexahedraMapper_VS.glsl
vtkProjectedAAHexahedraMapper_GS.glsl
vtkProjectedAAHexahedraMapper_FS.glsl
vtkVolumeTextureMapper3D_FourDependentNoShadeFP.asm
vtkVolumeTextureMapper3D_FourDependentShadeFP.asm
vtkVolumeTextureMapper3D_OneComponentNoShadeFP.asm
vtkVolumeTextureMapper3D_OneComponentShadeFP.asm
vtkVolumeTextureMapper3D_TwoDependentNoShadeFP.asm
vtkVolumeTextureMapper3D_TwoDependentShadeFP.asm
)
unset(shader_h_files)
foreach(file ${shader_files})
get_filename_component(file_we ${file} NAME_WE)
set(src ${CMAKE_CURRENT_SOURCE_DIR}/${file})
set(res ${CMAKE_CURRENT_BINARY_DIR}/${file_we}.cxx)
set(resh ${CMAKE_CURRENT_BINARY_DIR}/${file_we}.h)
list(APPEND shader_h_files ${resh})
add_custom_command(
OUTPUT ${res} ${resh}
DEPENDS ${src} vtkEncodeString
COMMAND vtkEncodeString
ARGS ${res} ${src} ${file_we}
--build-header VTKRENDERINGVOLUMEOPENGL_EXPORT vtkRenderingVolumeOpenGLModule.h
)
list(APPEND Module_SRCS ${res})
set_source_files_properties(${file_we} WRAP_EXCLUDE)
endforeach()
# Nwo for the object factory.
set(opengl_overrides
GPUVolumeRayCastMapper
HAVSVolumeMapper
ProjectedAAHexahedraMapper
ProjectedTetrahedraMapper
RayCastImageDisplayHelper
VolumeTextureMapper2D
VolumeTextureMapper3D
)
foreach(_override ${opengl_overrides})
vtk_add_override(vtk${_override} vtkOpenGL${_override})
endforeach()
# Now we iterate and create that class file...
foreach(_class ${vtk_module_overrides})
set(_override ${vtk_module_${_class}_override})
set(_vtk_override_includes "${_vtk_override_includes}
#include \"${_override}.h\"")
set(_vtk_override_creates "${_vtk_override_creates}
VTK_CREATE_CREATE_FUNCTION(${_override})")
set(_vtk_override_do "${_vtk_override_do}
this->RegisterOverride(\"${_class}\",
\"${_override}\",
\"Override for ${vtk-module} module\", 1,
vtkObjectFactoryCreate${_override});")
endforeach()
# Now lets create the object factory classes
string(TOUPPER ${vtk-module} VTK-MODULE)
configure_file(${VTK_CMAKE_DIR}/vtkObjectFactory.h.in
${CMAKE_CURRENT_BINARY_DIR}/${vtk-module}ObjectFactory.h)
configure_file(${VTK_CMAKE_DIR}/vtkObjectFactory.cxx.in
${CMAKE_CURRENT_BINARY_DIR}/${vtk-module}ObjectFactory.cxx)
list(APPEND Module_SRCS
${CMAKE_CURRENT_BINARY_DIR}/${vtk-module}ObjectFactory.cxx)
set_source_files_properties(
${vtk-module}ObjectFactory.cxx
WRAP_EXCLUDE
)
vtk_module_library(vtkRenderingVolumeOpenGL ${Module_SRCS})
vtk_module(vtkRenderingVolumeOpenGL
GROUPS
Rendering
StandAlone
IMPLEMENTS
vtkRenderingVolume
DEPENDS
vtkRenderingOpenGL
TEST_DEPENDS
vtkTestingCore
vtkTestingRendering
vtkRenderingFreeType
vtkImagingSources
vtkImagingGeneral
vtkInteractionStyle
)
......@@ -27,7 +27,7 @@
#ifndef __vtkOpenGLGPUVolumeRayCastMapper_h
#define __vtkOpenGLGPUVolumeRayCastMapper_h
#include "vtkRenderingVolumeModule.h" // For export macro
#include "vtkRenderingVolumeOpenGLModule.h" // For export macro
#include "vtkGPUVolumeRayCastMapper.h"
class vtkVolume;
......@@ -54,7 +54,8 @@ class vtkStdString;
class vtkShaderProgram2;
class vtkShader2;
class VTKRENDERINGVOLUME_EXPORT vtkOpenGLGPUVolumeRayCastMapper : public vtkGPUVolumeRayCastMapper
class VTKRENDERINGVOLUMEOPENGL_EXPORT vtkOpenGLGPUVolumeRayCastMapper
: public vtkGPUVolumeRayCastMapper
{
public:
static vtkOpenGLGPUVolumeRayCastMapper *New();
......
......@@ -105,7 +105,7 @@ PURPOSE. See the above copyright notice for more information.
#ifndef __vtkOpenGLHAVSVolumeMapper_h
#define __vtkOpenGLHAVSVolumeMapper_h
#include "vtkRenderingVolumeModule.h" // For export macro
#include "vtkRenderingVolumeOpenGLModule.h" // For export macro
#include "vtkHAVSVolumeMapper.h"
#include <vtkWeakPointer.h> // to cache the vtkRenderWindow
......@@ -113,7 +113,8 @@ class vtkRenderer;
class vtkRenderWindow;
class VTKRENDERINGVOLUME_EXPORT vtkOpenGLHAVSVolumeMapper : public vtkHAVSVolumeMapper
class VTKRENDERINGVOLUMEOPENGL_EXPORT vtkOpenGLHAVSVolumeMapper
: public vtkHAVSVolumeMapper
{
public:
static vtkOpenGLHAVSVolumeMapper *New();
......
......@@ -28,7 +28,7 @@
#ifndef __vtkOpenGLProjectedAAHexahedraMapper_h
#define __vtkOpenGLProjectedAAHexahedraMapper_h
#include "vtkRenderingVolumeModule.h" // For export macro
#include "vtkRenderingVolumeOpenGLModule.h" // For export macro
#include "vtkProjectedAAHexahedraMapper.h"
class vtkFloatArray;
......@@ -39,7 +39,8 @@ class vtkVolumeProperty;
class vtkRenderWindow;
class vtkShaderProgram2;
class VTKRENDERINGVOLUME_EXPORT vtkOpenGLProjectedAAHexahedraMapper : public vtkProjectedAAHexahedraMapper
class VTKRENDERINGVOLUMEOPENGL_EXPORT vtkOpenGLProjectedAAHexahedraMapper
: public vtkProjectedAAHexahedraMapper
{
public:
vtkTypeMacro(vtkOpenGLProjectedAAHexahedraMapper,
......
......@@ -33,14 +33,15 @@
#ifndef __vtkOpenGLProjectedTetrahedraMapper_h
#define __vtkOpenGLProjectedTetrahedraMapper_h
#include "vtkRenderingVolumeModule.h" // For export macro
#include "vtkRenderingVolumeOpenGLModule.h" // For export macro
#include "vtkProjectedTetrahedraMapper.h"
class vtkVisibilitySort;
class vtkUnsignedCharArray;
class vtkFloatArray;
class VTKRENDERINGVOLUME_EXPORT vtkOpenGLProjectedTetrahedraMapper : public vtkProjectedTetrahedraMapper
class VTKRENDERINGVOLUMEOPENGL_EXPORT vtkOpenGLProjectedTetrahedraMapper
: public vtkProjectedTetrahedraMapper
{
public:
vtkTypeMacro(vtkOpenGLProjectedTetrahedraMapper,
......
......@@ -24,14 +24,15 @@
#ifndef __vtkOpenGLRayCastImageDisplayHelper_h
#define __vtkOpenGLRayCastImageDisplayHelper_h
#include "vtkRenderingVolumeModule.h" // For export macro
#include "vtkRenderingVolumeOpenGLModule.h" // For export macro
#include "vtkRayCastImageDisplayHelper.h"
class vtkVolume;
class vtkRenderer;
class vtkFixedPointRayCastImage;
class VTKRENDERINGVOLUME_EXPORT vtkOpenGLRayCastImageDisplayHelper : public vtkRayCastImageDisplayHelper
class VTKRENDERINGVOLUMEOPENGL_EXPORT vtkOpenGLRayCastImageDisplayHelper
: public vtkRayCastImageDisplayHelper
{
public:
static vtkOpenGLRayCastImageDisplayHelper *New();
......
......@@ -24,10 +24,11 @@
#ifndef __vtkOpenGLVolumeTextureMapper2D_h
#define __vtkOpenGLVolumeTextureMapper2D_h
#include "vtkRenderingVolumeModule.h" // For export macro
#include "vtkRenderingVolumeOpenGLModule.h" // For export macro
#include "vtkVolumeTextureMapper2D.h"
class VTKRENDERINGVOLUME_EXPORT vtkOpenGLVolumeTextureMapper2D : public vtkVolumeTextureMapper2D
class VTKRENDERINGVOLUMEOPENGL_EXPORT vtkOpenGLVolumeTextureMapper2D
: public vtkVolumeTextureMapper2D
{
public:
vtkTypeMacro(vtkOpenGLVolumeTextureMapper2D,vtkVolumeTextureMapper2D);
......
......@@ -24,14 +24,15 @@
#ifndef __vtkOpenGLVolumeTextureMapper3D_h
#define __vtkOpenGLVolumeTextureMapper3D_h
#include "vtkRenderingVolumeModule.h" // For export macro
#include "vtkRenderingVolumeOpenGLModule.h" // For export macro
#include "vtkVolumeTextureMapper3D.h"
#include "vtkOpenGL.h" // GLfloat type is used in some method signatures.
class vtkRenderWindow;
class vtkVolumeProperty;
class VTKRENDERINGVOLUME_EXPORT vtkOpenGLVolumeTextureMapper3D : public vtkVolumeTextureMapper3D
class VTKRENDERINGVOLUMEOPENGL_EXPORT vtkOpenGLVolumeTextureMapper3D
: public vtkVolumeTextureMapper3D
{
public:
vtkTypeMacro(vtkOpenGLVolumeTextureMapper3D,vtkVolumeTextureMapper3D);
......@@ -156,5 +157,4 @@ private:
void operator=(const vtkOpenGLVolumeTextureMapper3D&); // Not implemented.
};
#endif
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