Commit 6c456e0f authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

Merge branch 'release' into HEAD

* release: (25 commits)
  Fixed volume rendering not working for cell data
  Fixed typo which resulted in test failure
  Added API to turn on/off jittering
  Fixed edge conditions with clipping
  ...

Primarily brings in volume rendering fixes.
parents 9d870300 883cb5b8
Pipeline #8250 passed with stage
...@@ -54,6 +54,7 @@ endif() ...@@ -54,6 +54,7 @@ endif()
set (VolumeOpenGL2CxxTests set (VolumeOpenGL2CxxTests
TestGPURayCastCameraInside.cxx TestGPURayCastCameraInside.cxx
TestGPURayCastCameraInsideSmallSpacing.cxx TestGPURayCastCameraInsideSmallSpacing.cxx
TestGPURayCastCellData.cxx
TestGPURayCastClipping.cxx TestGPURayCastClipping.cxx
TestGPURayCastGradientOpacity.cxx TestGPURayCastGradientOpacity.cxx
TestGPURayCastPositionalLights.cxx TestGPURayCastPositionalLights.cxx
......
/*=========================================================================
Program: Visualization Toolkit
Module: TestGPURayCastVolumeUpdate.cxx
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.
=========================================================================*/
// This test volume tests whether updating the volume MTime updates the ,
// geometry in the volume mapper.
#include <vtkColorTransferFunction.h>
#include <vtkDataArray.h>
#include <vtkGPUVolumeRayCastMapper.h>
#include <vtkImageData.h>
#include <vtkInteractorStyleTrackballCamera.h>
#include <vtkNew.h>
#include <vtkOutlineFilter.h>
#include <vtkPiecewiseFunction.h>
#include <vtkPointDataToCellData.h>
#include <vtkPolyDataMapper.h>
#include <vtkRegressionTestImage.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRTAnalyticSource.h>
#include <vtkSmartPointer.h>
#include <vtkTesting.h>
#include <vtkTestUtilities.h>
#include <vtkVolumeProperty.h>
#include <vtkXMLImageDataReader.h>
int TestGPURayCastCellData(int argc, char *argv[])
{
cout << "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)" << endl;
double scalarRange[2];
vtkNew<vtkActor> outlineActor;
vtkNew<vtkPolyDataMapper> outlineMapper;
vtkNew<vtkGPUVolumeRayCastMapper> volumeMapper;
vtkNew<vtkXMLImageDataReader> reader;
char* volumeFile = vtkTestUtilities::ExpandDataFileName(
argc, argv, "Data/vase_1comp.vti");
reader->SetFileName(volumeFile);
delete[] volumeFile;
vtkNew<vtkPointDataToCellData> pointToCell;
pointToCell->SetInputConnection(reader->GetOutputPort());
volumeMapper->SetInputConnection(pointToCell->GetOutputPort());
// Add outline filter
vtkNew<vtkOutlineFilter> outlineFilter;
outlineFilter->SetInputConnection(pointToCell->GetOutputPort());
outlineMapper->SetInputConnection(outlineFilter->GetOutputPort());
outlineActor->SetMapper(outlineMapper.GetPointer());
volumeMapper->GetInput()->GetScalarRange(scalarRange);
volumeMapper->SetSampleDistance(0.1);
volumeMapper->SetAutoAdjustSampleDistances(0);
volumeMapper->SetBlendModeToComposite();
vtkNew<vtkRenderWindow> renWin;
renWin->SetMultiSamples(0);
renWin->SetSize(400, 400);
vtkNew<vtkRenderWindowInteractor> iren;
iren->SetRenderWindow(renWin.GetPointer());
vtkNew<vtkInteractorStyleTrackballCamera> style;
iren->SetInteractorStyle(style.GetPointer());
renWin->Render(); // make sure we have an OpenGL context.
vtkNew<vtkRenderer> ren;
ren->SetBackground(0.2, 0.2, 0.5);
renWin->AddRenderer(ren.GetPointer());
vtkNew<vtkPiecewiseFunction> scalarOpacity;
scalarOpacity->AddPoint(50, 0.0);
scalarOpacity->AddPoint(75, 1.0);
vtkNew<vtkVolumeProperty> volumeProperty;
volumeProperty->ShadeOn();
volumeProperty->SetInterpolationType(VTK_LINEAR_INTERPOLATION);
volumeProperty->SetScalarOpacity(scalarOpacity.GetPointer());
vtkNew<vtkColorTransferFunction> colorTransferFunction;
colorTransferFunction->RemoveAllPoints();
colorTransferFunction->AddRGBPoint(scalarRange[0], 0.6, 0.4, 0.1);
volumeProperty->SetColor(colorTransferFunction.GetPointer());
vtkNew<vtkVolume> volume;
volume->SetMapper(volumeMapper.GetPointer());
volume->SetProperty(volumeProperty.GetPointer());
ren->AddVolume(volume.GetPointer());
ren->AddActor(outlineActor.GetPointer());
ren->ResetCamera();
renWin->Render();
ren->ResetCamera();
iren->Initialize();
int retVal = vtkRegressionTestImage( renWin.GetPointer() );
if( retVal == vtkRegressionTester::DO_INTERACTOR)
{
iren->Start();
}
return !retVal;
}
...@@ -81,7 +81,8 @@ int TestGPURayCastClipping(int argc, char *argv[]) ...@@ -81,7 +81,8 @@ int TestGPURayCastClipping(int argc, char *argv[])
clipPlane1->SetNormal(0.8, 0.0, 0.0); clipPlane1->SetNormal(0.8, 0.0, 0.0);
vtkNew<vtkPlane> clipPlane2; vtkNew<vtkPlane> clipPlane2;
clipPlane2->SetOrigin(0.0, 0.35 * (bounds[2] + bounds[3]), 0.0); clipPlane2->SetOrigin(0.45 * (bounds[0] + bounds[1]),
0.35 * (bounds[2] + bounds[3]), 0.0);
clipPlane2->SetNormal(0.2, -0.2, 0.0); clipPlane2->SetNormal(0.2, -0.2, 0.0);
vtkNew<vtkPlaneCollection> clipPlaneCollection; vtkNew<vtkPlaneCollection> clipPlaneCollection;
......
8a9b985a6e629a234bc8d8d343b2c8a2 54622bc7c096d584f32fdf60b4d6495f
...@@ -45,6 +45,7 @@ vtkGPUVolumeRayCastMapper::vtkGPUVolumeRayCastMapper() ...@@ -45,6 +45,7 @@ vtkGPUVolumeRayCastMapper::vtkGPUVolumeRayCastMapper()
this->MinimumImageSampleDistance = 1.0; this->MinimumImageSampleDistance = 1.0;
this->MaximumImageSampleDistance = 10.0; this->MaximumImageSampleDistance = 10.0;
this->RenderToImage = 0; this->RenderToImage = 0;
this->UseJittering = 1;
this->SampleDistance = 1.0; this->SampleDistance = 1.0;
this->SmallVolumeRender = 0; this->SmallVolumeRender = 0;
this->BigTimeToDraw = 0.0; this->BigTimeToDraw = 0.0;
......
...@@ -46,6 +46,14 @@ public: ...@@ -46,6 +46,14 @@ public:
vtkGetMacro( AutoAdjustSampleDistances, int ); vtkGetMacro( AutoAdjustSampleDistances, int );
vtkBooleanMacro( AutoAdjustSampleDistances, int ); vtkBooleanMacro( AutoAdjustSampleDistances, int );
// Description:
// If UseJittering is on, each ray traversal direction will be
// perturbed slightly using a noise-texture to get rid of wood-grain
// effect.
vtkSetClampMacro( UseJittering, int, 0, 1 );
vtkGetMacro( UseJittering, int );
vtkBooleanMacro( UseJittering, int );
// Description: // Description:
// Set/Get the distance between samples used for rendering // Set/Get the distance between samples used for rendering
// when AutoAdjustSampleDistances is off, or when this mapper // when AutoAdjustSampleDistances is off, or when this mapper
...@@ -276,6 +284,9 @@ protected: ...@@ -276,6 +284,9 @@ protected:
// Render to texture mode flag // Render to texture mode flag
int RenderToImage; int RenderToImage;
// Enable / disable stochasting jittering
int UseJittering;
// The distance between sample points along the ray // The distance between sample points along the ray
float SampleDistance; float SampleDistance;
......
...@@ -42,6 +42,7 @@ vec3 g_dataPos; ...@@ -42,6 +42,7 @@ vec3 g_dataPos;
vec3 g_dirStep; vec3 g_dirStep;
vec4 g_srcColor; vec4 g_srcColor;
vec4 g_eyePosObj; vec4 g_eyePosObj;
bool g_exit;
uniform vec4 in_volume_scale; uniform vec4 in_volume_scale;
uniform vec4 in_volume_bias; uniform vec4 in_volume_bias;
...@@ -88,6 +89,7 @@ void main() ...@@ -88,6 +89,7 @@ void main()
g_fragColor = vec4(0.0); g_fragColor = vec4(0.0);
g_dirStep = vec3(0.0); g_dirStep = vec3(0.0);
g_srcColor = vec4(0.0); g_srcColor = vec4(0.0);
g_exit = false;
//VTK::Base::Init //VTK::Base::Init
...@@ -102,7 +104,7 @@ void main() ...@@ -102,7 +104,7 @@ void main()
//VTK::RenderToImage::Depth::Init //VTK::RenderToImage::Depth::Init
/// For all samples along the ray /// For all samples along the ray
while (true) while (!g_exit)
{ {
//VTK::Base::Impl //VTK::Base::Impl
......
...@@ -731,6 +731,16 @@ bool vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::LoadVolume( ...@@ -731,6 +731,16 @@ bool vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::LoadVolume(
// Update texture size // Update texture size
imageData->GetExtent(this->Extents); imageData->GetExtent(this->Extents);
if (this->Parent->CellFlag)
{
int i = 1;
while (i < 6)
{
this->Extents[i]--;
i += 2;
}
}
int i = 0; int i = 0;
while(i < 3) while(i < 3)
{ {
...@@ -929,6 +939,17 @@ void vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::ComputeBounds( ...@@ -929,6 +939,17 @@ void vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::ComputeBounds(
input->GetOrigin(origin); input->GetOrigin(origin);
input->GetExtent(this->Extents); input->GetExtent(this->Extents);
if (this->Parent->CellFlag)
{
int i = 1;
while (i < 6)
{
this->Extents[i]--;
i += 2;
}
}
int swapBounds[3]; int swapBounds[3];
swapBounds[0] = (this->CellSpacing[0] < 0); swapBounds[0] = (this->CellSpacing[0] < 0);
swapBounds[1] = (this->CellSpacing[1] < 0); swapBounds[1] = (this->CellSpacing[1] < 0);
...@@ -1790,7 +1811,7 @@ void vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::UpdateCropping( ...@@ -1790,7 +1811,7 @@ void vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::UpdateCropping(
static_cast<float>(croppingRegionPlanes[4]), static_cast<float>(croppingRegionPlanes[4]),
static_cast<float>(croppingRegionPlanes[5]) }; static_cast<float>(croppingRegionPlanes[5]) };
this->ShaderProgram->SetUniform1fv("cropping_planes", 6, cropPlanes); this->ShaderProgram->SetUniform1fv("in_croppingPlanes", 6, cropPlanes);
const int numberOfRegions = 32; const int numberOfRegions = 32;
int cropFlagsArray[numberOfRegions]; int cropFlagsArray[numberOfRegions];
cropFlagsArray[0] = 0; cropFlagsArray[0] = 0;
...@@ -1806,7 +1827,7 @@ void vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::UpdateCropping( ...@@ -1806,7 +1827,7 @@ void vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::UpdateCropping(
cropFlagsArray[i] = 0; cropFlagsArray[i] = 0;
} }
this->ShaderProgram->SetUniform1iv("cropping_flags", this->ShaderProgram->SetUniform1iv("in_croppingFlags",
numberOfRegions, numberOfRegions,
cropFlagsArray); cropFlagsArray);
} }
...@@ -1839,11 +1860,8 @@ void vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::UpdateClipping( ...@@ -1839,11 +1860,8 @@ void vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::UpdateClipping(
clippingPlanes.push_back(planeNormal[2]); clippingPlanes.push_back(planeNormal[2]);
} }
double croppingRegionPlanes[6]; clippingPlanes[0] = clippingPlanes.size() > 1 ?
this->Parent->GetCroppingRegionPlanes(croppingRegionPlanes); static_cast<int>(clippingPlanes.size() - 1): 0;
clippingPlanes[0] = clippingPlanes.size() > 0 ?
(clippingPlanes.size() - 1) : 0;
this->ShaderProgram->SetUniform1fv("in_clippingPlanes", this->ShaderProgram->SetUniform1fv("in_clippingPlanes",
static_cast<int>(clippingPlanes.size()), static_cast<int>(clippingPlanes.size()),
...@@ -3177,6 +3195,7 @@ void vtkOpenGLGPUVolumeRayCastMapper::GPURender(vtkRenderer* ren, ...@@ -3177,6 +3195,7 @@ void vtkOpenGLGPUVolumeRayCastMapper::GPURender(vtkRenderer* ren,
1.0 / this->Impl->WindowSize[1], fvalue2); 1.0 / this->Impl->WindowSize[1], fvalue2);
this->Impl->ShaderProgram->SetUniform2fv("in_inverseWindowSize", 1, &fvalue2); this->Impl->ShaderProgram->SetUniform2fv("in_inverseWindowSize", 1, &fvalue2);
this->Impl->ShaderProgram->SetUniformi("in_useJittering", this->GetUseJittering());
this->Impl->ShaderProgram->SetUniformi("in_cellFlag", this->CellFlag); this->Impl->ShaderProgram->SetUniformi("in_cellFlag", this->CellFlag);
// Updating cropping if enabled // Updating cropping if enabled
......
...@@ -180,7 +180,10 @@ namespace vtkvolume ...@@ -180,7 +180,10 @@ namespace vtkvolume
\nuniform vec3 in_ambient;\ \nuniform vec3 in_ambient;\
\nuniform vec3 in_specular;\ \nuniform vec3 in_specular;\
\nuniform float in_shininess;\ \nuniform float in_shininess;\
\n\
\n// Others\
\nuniform bool in_cellFlag;\ \nuniform bool in_cellFlag;\
\n uniform bool in_useJittering;\
"); ");
if (hasGradientOpacity || lightingComplexity > 0) if (hasGradientOpacity || lightingComplexity > 0)
...@@ -279,7 +282,15 @@ namespace vtkvolume ...@@ -279,7 +282,15 @@ namespace vtkvolume
\n g_dirStep = (in_inverseTextureDatasetMatrix *\ \n g_dirStep = (in_inverseTextureDatasetMatrix *\
\n vec4(rayDir, 0.0)).xyz * in_sampleDistance;\ \n vec4(rayDir, 0.0)).xyz * in_sampleDistance;\
\n\ \n\
\n g_dataPos += g_dirStep * (texture2D(in_noiseSampler, g_dataPos.xy).x);\ \n float jitterValue = (texture2D(in_noiseSampler, g_dataPos.xy).x);\
\n if (in_useJittering)\
\n {\
\n g_dataPos += g_dirStep * jitterValue;\
\n }\
\n else\
\n {\
\n g_dataPos += g_dirStep;\
\n }\
\n\ \n\
\n // Flag to deternmine if voxel should be considered for the rendering\ \n // Flag to deternmine if voxel should be considered for the rendering\
\n bool l_skip = false;"); \n bool l_skip = false;");
...@@ -1211,7 +1222,7 @@ namespace vtkvolume ...@@ -1211,7 +1222,7 @@ namespace vtkvolume
{ {
return std::string("\ return std::string("\
\n g_srcColor = computeColor(l_maxValue,\ \n g_srcColor = computeColor(l_maxValue,\
computeOpacity(l_maxValue));\ \n computeOpacity(l_maxValue));\
\n g_fragColor.rgb = g_srcColor.rgb * g_srcColor.a;\ \n g_fragColor.rgb = g_srcColor.rgb * g_srcColor.a;\
\n g_fragColor.a = g_srcColor.a;" \n g_fragColor.a = g_srcColor.a;"
); );
...@@ -1290,13 +1301,13 @@ namespace vtkvolume ...@@ -1290,13 +1301,13 @@ namespace vtkvolume
{ {
return std::string("\ return std::string("\
\n // Minimum texture access coordinate\ \n // Minimum texture access coordinate\
\n vec3 l_tex_min = vec3(0.0);\ \n vec3 l_texMin = vec3(0.0);\
\n vec3 l_tex_max = vec3(1.0);\ \n vec3 l_texMax = vec3(1.0);\
\n if (!in_cellFlag)\ \n if (!in_cellFlag)\
\n {\ \n {\
\n vec3 delta = in_textureExtentsMax - in_textureExtentsMin;\ \n vec3 delta = in_textureExtentsMax - in_textureExtentsMin;\
\n l_tex_min = vec3(0.5) / delta;\ \n l_texMin = vec3(0.5) / delta;\
\n l_tex_max = (delta - vec3(0.5)) / delta;\ \n l_texMax = (delta - vec3(0.5)) / delta;\
\n }\ \n }\
\n\ \n\
\n // Flag to indicate if the raymarch loop should terminate \ \n // Flag to indicate if the raymarch loop should terminate \
...@@ -1367,7 +1378,7 @@ namespace vtkvolume ...@@ -1367,7 +1378,7 @@ namespace vtkvolume
\n // if the difference is less than 0, 0 if equal to 0, and 1 if\ \n // if the difference is less than 0, 0 if equal to 0, and 1 if\
\n // above 0. So if the ray is inside the volume, dot product will\ \n // above 0. So if the ray is inside the volume, dot product will\
\n // always be 3.\ \n // always be 3.\
\n stop = dot(sign(g_dataPos - l_tex_min), sign(l_tex_max - g_dataPos))\ \n stop = dot(sign(g_dataPos - l_texMin), sign(l_texMax - g_dataPos))\
\n < 3.0;\ \n < 3.0;\
\n\ \n\
\n // If the stopping condition is true we brek out of the ray marching\ \n // If the stopping condition is true we brek out of the ray marching\
...@@ -1415,8 +1426,8 @@ namespace vtkvolume ...@@ -1415,8 +1426,8 @@ namespace vtkvolume
} }
return std::string("\ return std::string("\
\nuniform float cropping_planes[6];\ \nuniform float in_croppingPlanes[6];\
\nuniform int cropping_flags [32];\ \nuniform int in_croppingFlags [32];\
\n// X: axis = 0, Y: axis = 1, Z: axis = 2\ \n// X: axis = 0, Y: axis = 1, Z: axis = 2\
\n// cp Cropping plane bounds (minX, maxX, minY, maxY, minZ, maxZ)\ \n// cp Cropping plane bounds (minX, maxX, minY, maxY, minZ, maxZ)\
\nint computeRegionCoord(float cp[6], vec3 pos, int axis)\ \nint computeRegionCoord(float cp[6], vec3 pos, int axis)\
...@@ -1460,56 +1471,56 @@ namespace vtkvolume ...@@ -1460,56 +1471,56 @@ namespace vtkvolume
return std::string("\ return std::string("\
\n // Convert cropping region to texture space\ \n // Convert cropping region to texture space\
\n float cropping_planes_ts[6];\ \n float croppingPlanesTexture[6];\
\n mat4 datasetToTextureMat = in_inverseTextureDatasetMatrix;\ \n mat4 datasetToTextureMat = in_inverseTextureDatasetMatrix;\
\n\ \n\
\n vec4 temp = vec4(cropping_planes[0], 0.0, 0.0, 1.0);\ \n vec4 temp = vec4(in_croppingPlanes[0], 0.0, 0.0, 1.0);\
\n temp = datasetToTextureMat * temp;\ \n temp = datasetToTextureMat * temp;\
\n if (temp[3] != 0.0)\ \n if (temp[3] != 0.0)\
\n {\ \n {\
\n temp[0] /= temp[3];\ \n temp[0] /= temp[3];\
\n }\ \n }\
\n cropping_planes_ts[0] = temp[0];\ \n croppingPlanesTexture[0] = temp[0];\
\n\ \n\
\n temp = vec4(cropping_planes[1], 0.0, 0.0, 1.0);\ \n temp = vec4(in_croppingPlanes[1], 0.0, 0.0, 1.0);\
\n temp = datasetToTextureMat * temp;\ \n temp = datasetToTextureMat * temp;\
\n if (temp[3] != 0.0)\ \n if (temp[3] != 0.0)\
\n {\ \n {\
\n temp[0] /= temp[3];\ \n temp[0] /= temp[3];\
\n }\ \n }\
\n cropping_planes_ts[1] = temp[0];\ \n croppingPlanesTexture[1] = temp[0];\
\n\ \n\
\n temp = vec4(0.0, cropping_planes[2], 0.0, 1.0);\ \n temp = vec4(0.0, in_croppingPlanes[2], 0.0, 1.0);\
\n temp = datasetToTextureMat * temp;\ \n temp = datasetToTextureMat * temp;\
\n if (temp[3] != 0.0)\ \n if (temp[3] != 0.0)\
\n {\ \n {\
\n temp[1] /= temp[3];\ \n temp[1] /= temp[3];\
\n }\ \n }\
\n cropping_planes_ts[2] = temp[1];\ \n croppingPlanesTexture[2] = temp[1];\
\n\ \n\
\n temp = vec4(0.0, cropping_planes[3], 0.0, 1.0);\ \n temp = vec4(0.0, in_croppingPlanes[3], 0.0, 1.0);\
\n temp = datasetToTextureMat * temp;\ \n temp = datasetToTextureMat * temp;\
\n if (temp[3] != 0.0)\ \n if (temp[3] != 0.0)\
\n {\ \n {\
\n temp[1] /= temp[3];\ \n temp[1] /= temp[3];\
\n }\ \n }\
\n cropping_planes_ts[3] = temp[1];\ \n croppingPlanesTexture[3] = temp[1];\
\n\ \n\
\n temp = vec4(0.0, 0.0, cropping_planes[4], 1.0);\ \n temp = vec4(0.0, 0.0, in_croppingPlanes[4], 1.0);\
\n temp = datasetToTextureMat * temp;\ \n temp = datasetToTextureMat * temp;\
\n if (temp[3] != 0.0)\ \n if (temp[3] != 0.0)\
\n {\ \n {\
\n temp[2] /= temp[3];\ \n temp[2] /= temp[3];\
\n }\ \n }\
\n cropping_planes_ts[4] = temp[2];\ \n croppingPlanesTexture[4] = temp[2];\
\n\ \n\
\n temp = vec4(0.0, 0.0, cropping_planes[5], 1.0);\ \n temp = vec4(0.0, 0.0, in_croppingPlanes[5], 1.0);\
\n temp = datasetToTextureMat * temp;\ \n temp = datasetToTextureMat * temp;\
\n if (temp[3] != 0.0)\ \n if (temp[3] != 0.0)\
\n {\ \n {\
\n temp[2] /= temp[3];\ \n temp[2] /= temp[3];\
\n }\ \n }\
\n cropping_planes_ts[5] = temp[2];" \n croppingPlanesTexture[5] = temp[2];"
); );
} }
...@@ -1524,11 +1535,11 @@ namespace vtkvolume ...@@ -1524,11 +1535,11 @@ namespace vtkvolume
return std::string("\ return std::string("\
\n // Determine region\ \n // Determine region\
\n int regionNo = computeRegion(cropping_planes_ts, g_dataPos);\ \n int regionNo = computeRegion(croppingPlanesTexture, g_dataPos);\
\n\ \n\
\n // Do & operation with cropping flags\ \n // Do & operation with cropping flags\
\n // Pass the flag that its Ok to sample or not to sample\ \n // Pass the flag that its Ok to sample or not to sample\
\n if (cropping_flags[regionNo] == 0)\ \n if (in_croppingFlags[regionNo] == 0)\
\n {\ \n {\
\n // Skip this voxel\ \n // Skip this voxel\
\n l_skip = true;\ \n l_skip = true;\
...@@ -1569,48 +1580,66 @@ namespace vtkvolume ...@@ -1569,48 +1580,66 @@ namespace vtkvolume
{ {
return std::string(); return std::string();
} }
else else
{ {
return std::string("\ return std::string("\
\nfloat clippingPlanesTexture[48];\ \n int clippingPlanesSize = int(in_clippingPlanes[0]);\
\nint clippingPlanesSize = int(in_clippingPlanes[0]);\ \n vec4 objDataPos = vec4(0.0);\
\n\ \n mat4 textureToObjMat = in_volumeMatrix *\
\nmat4 world_to_texture_mat = in_inverseTextureDatasetMatrix *\ \n in_textureDatasetMatrix;\
\n in_inverseVolumeMatrix;\ \n for (int i = 0; i < clippingPlanesSize; i = i + 6)\
\nfor (int i = 0; i < clippingPlanesSize; i = i + 6)\
\n {\
\n vec4 origin = vec4(in_clippingPlanes[i + 1],\
\n in_clippingPlanes[i + 2],\
\n in_clippingPlanes[i + 3], 1.0);\