Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
VTK
VTK
Commits
5282543e
Commit
5282543e
authored
Jul 17, 2015
by
Aashish Chaudhary
1
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'paraview_volume_issue' into fix_interactive_volume_issues
parents
938c8790
9b2883aa
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1403 additions
and
19 deletions
+1403
-19
Rendering/Volume/Testing/Cxx/CMakeLists.txt
Rendering/Volume/Testing/Cxx/CMakeLists.txt
+1
-0
Rendering/Volume/Testing/Cxx/TestGPURayCastMapperBenchmark.cxx
...ring/Volume/Testing/Cxx/TestGPURayCastMapperBenchmark.cxx
+3
-6
Rendering/Volume/Testing/Cxx/TestGPUVolumeRayCastMapper.cxx
Rendering/Volume/Testing/Cxx/TestGPUVolumeRayCastMapper.cxx
+1310
-0
Rendering/Volume/Testing/Data/Baseline/TestGPUVolumeRayCastMapper.png.md5
.../Testing/Data/Baseline/TestGPUVolumeRayCastMapper.png.md5
+1
-0
Rendering/VolumeOpenGL2/vtkSmartVolumeMapper.cxx
Rendering/VolumeOpenGL2/vtkSmartVolumeMapper.cxx
+43
-11
Rendering/VolumeOpenGL2/vtkSmartVolumeMapper.h
Rendering/VolumeOpenGL2/vtkSmartVolumeMapper.h
+45
-2
No files found.
Rendering/Volume/Testing/Cxx/CMakeLists.txt
View file @
5282543e
...
...
@@ -23,6 +23,7 @@ set (GenericVolumeCxxTests
TestGPURayCastNearestDataTypesMIP.cxx
TestGPURayCastPerspectiveParallel.cxx
TestGPURayCastVolumeUpdate.cxx
TestGPUVolumeRayCastMapper.cxx
TestMinIntensityRendering.cxx
TestProjectedTetrahedra.cxx
TestSmartVolumeMapper.cxx
...
...
Rendering/Volume/Testing/Cxx/TestGPURayCastMapperBenchmark.cxx
View file @
5282543e
...
...
@@ -19,17 +19,14 @@
#include "vtkImageData.h"
#include "vtkNew.h"
#include "vtkPiecewiseFunction.h"
#include "vtkRTAnalyticSource.h"
#include "vtkRegressionTestImage.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkR
enderer
.h"
#include "vtkR
TAnalyticSource
.h"
#include "vtkTimerLog.h"
#include "vtkVolume.h"
#include "vtkVolumeProperty.h"
#include "vtkXMLImageDataReader.h"
#include "vtkRegressionTestImage.h"
#include "vtkTestUtilities.h"
//----------------------------------------------------------------------------
int
TestGPURayCastMapperBenchmark
(
int
argc
,
char
*
argv
[])
...
...
Rendering/Volume/Testing/Cxx/TestGPUVolumeRayCastMapper.cxx
0 → 100644
View file @
5282543e
This diff is collapsed.
Click to expand it.
Rendering/Volume/Testing/Data/Baseline/TestGPUVolumeRayCastMapper.png.md5
0 → 100644
View file @
5282543e
00b6935d399b80e4f9edc1414a4c363f
Rendering/VolumeOpenGL2/vtkSmartVolumeMapper.cxx
View file @
5282543e
...
...
@@ -52,9 +52,17 @@ vtkSmartVolumeMapper::vtkSmartVolumeMapper()
this
->
LowResGPUNecessary
=
0
;
this
->
InterpolationMode
=
VTK_RESLICE_CUBIC
;
// If the render window has a desired update greater than or equal to the
// interactive update rate, we apply certain optimizations to ensure that the
// rendering is interactive.
this
->
InteractiveUpdateRate
=
1.0
;
// Enable checking whether the render is interactive and use the appropriate
// sample distance for rendering
this
->
InteractiveAdjustSampleDistances
=
1
;
// Initial sample distance
this
->
AutoAdjustSampleDistances
=
1
;
this
->
SampleDistance
=
1.0
;
this
->
SampleDistance
=
-
1.0
;
// Create all the mappers we might need
this
->
RayCastMapper
=
vtkFixedPointVolumeRayCastMapper
::
New
();
...
...
@@ -161,6 +169,17 @@ void vtkSmartVolumeMapper::Render( vtkRenderer *ren, vtkVolume *vol )
switch
(
this
->
CurrentRenderMode
)
{
case
vtkSmartVolumeMapper
::
RayCastRenderMode
:
if
(
this
->
InteractiveAdjustSampleDistances
)
{
this
->
RayCastMapper
->
SetAutoAdjustSampleDistances
(
ren
->
GetRenderWindow
()
->
GetDesiredUpdateRate
()
>=
this
->
InteractiveUpdateRate
);
}
else
{
this
->
RayCastMapper
->
SetAutoAdjustSampleDistances
(
this
->
AutoAdjustSampleDistances
);
}
this
->
RayCastMapper
->
Render
(
ren
,
vol
);
break
;
case
vtkSmartVolumeMapper
::
GPURenderMode
:
...
...
@@ -172,6 +191,17 @@ void vtkSmartVolumeMapper::Render( vtkRenderer *ren, vtkVolume *vol )
{
usedMapper
=
this
->
GPUMapper
;
}
if
(
this
->
InteractiveAdjustSampleDistances
)
{
usedMapper
->
SetAutoAdjustSampleDistances
(
ren
->
GetRenderWindow
()
->
GetDesiredUpdateRate
()
>=
this
->
InteractiveUpdateRate
);
}
else
{
usedMapper
->
SetAutoAdjustSampleDistances
(
this
->
AutoAdjustSampleDistances
);
}
usedMapper
->
Render
(
ren
,
vol
);
break
;
case
vtkSmartVolumeMapper
::
InvalidRenderMode
:
...
...
@@ -285,6 +315,15 @@ void vtkSmartVolumeMapper::ComputeRenderMode(vtkRenderer *ren, vtkVolume *vol)
double
spacing
[
3
];
this
->
GetInput
()
->
GetSpacing
(
spacing
);
// Compute the sample distance based on dataset spacing.
// It is assumed that a negative SampleDistance means the user would like to
// compute volume mapper sample distance based on data spacing.
if
(
this
->
SampleDistance
<
0
)
{
this
->
SampleDistance
=
static_cast
<
float
>
((
spacing
[
0
]
+
spacing
[
1
]
+
spacing
[
2
])
/
6.0
);
}
vtkRenderWindow
*
win
=
ren
->
GetRenderWindow
();
switch
(
this
->
RequestedRenderMode
)
...
...
@@ -350,8 +389,6 @@ void vtkSmartVolumeMapper::ComputeRenderMode(vtkRenderer *ren, vtkVolume *vol)
this
->
RayCastMapper
->
SetBlendMode
(
this
->
GetBlendMode
()
);
this
->
RayCastMapper
->
SetFinalColorWindow
(
this
->
FinalColorWindow
);
this
->
RayCastMapper
->
SetFinalColorLevel
(
this
->
FinalColorLevel
);
this
->
RayCastMapper
->
SetAutoAdjustSampleDistances
(
this
->
AutoAdjustSampleDistances
);
this
->
RayCastMapper
->
SetSampleDistance
(
this
->
SampleDistance
);
break
;
...
...
@@ -368,8 +405,6 @@ void vtkSmartVolumeMapper::ComputeRenderMode(vtkRenderer *ren, vtkVolume *vol)
this
->
GPUMapper
->
SetScalarMode
(
this
->
GetScalarMode
());
this
->
GPUMapper
->
SetMaxMemoryInBytes
(
this
->
MaxMemoryInBytes
);
this
->
GPUMapper
->
SetMaxMemoryFraction
(
this
->
MaxMemoryFraction
);
this
->
GPUMapper
->
SetSampleDistance
(
static_cast
<
float
>
((
spacing
[
0
]
+
spacing
[
1
]
+
spacing
[
2
]
)
/
6.0
)
);
this
->
ConnectMapperInput
(
this
->
GPUMapper
);
this
->
GPUMapper
->
SetClippingPlanes
(
this
->
GetClippingPlanes
());
this
->
GPUMapper
->
SetCropping
(
this
->
GetCropping
());
...
...
@@ -380,8 +415,6 @@ void vtkSmartVolumeMapper::ComputeRenderMode(vtkRenderer *ren, vtkVolume *vol)
this
->
GPUMapper
->
SetBlendMode
(
this
->
GetBlendMode
()
);
this
->
GPUMapper
->
SetFinalColorWindow
(
this
->
FinalColorWindow
);
this
->
GPUMapper
->
SetFinalColorLevel
(
this
->
FinalColorLevel
);
this
->
GPUMapper
->
SetAutoAdjustSampleDistances
(
this
->
AutoAdjustSampleDistances
);
this
->
GPUMapper
->
SetSampleDistance
(
this
->
SampleDistance
);
// Make the window current because we need the OpenGL context
...
...
@@ -405,8 +438,6 @@ void vtkSmartVolumeMapper::ComputeRenderMode(vtkRenderer *ren, vtkVolume *vol)
this
->
GPULowResMapper
->
SetMaxMemoryInBytes
(
this
->
MaxMemoryInBytes
);
this
->
GPULowResMapper
->
SetMaxMemoryFraction
(
this
->
MaxMemoryFraction
);
this
->
GPULowResMapper
->
SetSampleDistance
(
static_cast
<
float
>
((
spacing
[
0
]
+
spacing
[
1
]
+
spacing
[
2
]
)
/
6.0
)
);
this
->
GPULowResMapper
->
SetInputConnection
(
this
->
GPUResampleFilter
->
GetOutputPort
());
...
...
@@ -419,8 +450,6 @@ void vtkSmartVolumeMapper::ComputeRenderMode(vtkRenderer *ren, vtkVolume *vol)
this
->
GPULowResMapper
->
SetBlendMode
(
this
->
GetBlendMode
()
);
this
->
GPULowResMapper
->
SetFinalColorWindow
(
this
->
FinalColorWindow
);
this
->
GPULowResMapper
->
SetFinalColorLevel
(
this
->
FinalColorLevel
);
this
->
GPULowResMapper
->
SetAutoAdjustSampleDistances
(
this
->
AutoAdjustSampleDistances
);
this
->
GPULowResMapper
->
SetSampleDistance
(
this
->
SampleDistance
);
}
else
...
...
@@ -626,6 +655,9 @@ void vtkSmartVolumeMapper::PrintSelf(ostream& os, vtkIndent indent)
os
<<
"FinalColorWindow: "
<<
this
->
FinalColorWindow
<<
endl
;
os
<<
"FinalColorLevel: "
<<
this
->
FinalColorLevel
<<
endl
;
os
<<
"RequestedRenderMode: "
<<
this
->
RequestedRenderMode
<<
endl
;
os
<<
"InteractiveUpdateRate: "
<<
this
->
InteractiveUpdateRate
<<
endl
;
os
<<
"InteractiveAdjustSampleDistances: "
<<
this
->
InteractiveAdjustSampleDistances
<<
endl
;
os
<<
"InterpolationMode: "
<<
this
->
InterpolationMode
<<
endl
;
os
<<
"MaxMemoryInBytes:"
<<
this
->
MaxMemoryInBytes
<<
endl
;
os
<<
"MaxMemoryFraction:"
<<
this
->
MaxMemoryFraction
<<
endl
;
...
...
Rendering/VolumeOpenGL2/vtkSmartVolumeMapper.h
View file @
5282543e
...
...
@@ -200,10 +200,37 @@ public:
double
viewUp
[
3
]
);
// Description:
// If AutoAdjustSampleDistances is on, the the ImageSampleDistance
// If the DesiredUpdateRate of the vtkRenderWindow that caused the Render
// falls at or above this rate, the render is considered interactive and
// the mapper may be adjusted (depending on the render mode).
// Initial value is 1.0.
vtkSetClampMacro
(
InteractiveUpdateRate
,
double
,
1.0e-10
,
1.0e10
);
// Description:
// Get the update rate at or above which this is considered an
// interactive render.
// Initial value is 1.0.
vtkGetMacro
(
InteractiveUpdateRate
,
double
);
// Description:
// If the InteractiveAdjustSampleDistances flag is enabled,
// vtkSmartVolumeMapper interactively sets and resets the
// AutoAdjustSampleDistances flag on the internal volume mapper. This flag
// along with InteractiveUpdateRate is useful to adjust volume mapper sample
// distance based on whether the render is interactive or still.
// By default, InteractiveAdjustSampleDistances is enabled.
vtkSetClampMacro
(
InteractiveAdjustSampleDistances
,
int
,
0
,
1
);
vtkGetMacro
(
InteractiveAdjustSampleDistances
,
int
);
vtkBooleanMacro
(
InteractiveAdjustSampleDistances
,
int
);
// Description:
// If AutoAdjustSampleDistances is on, the ImageSampleDistance
// will be varied to achieve the allocated render time of this
// prop (controlled by the desired update rate and any culling in
// use).
// Note that, this flag is ignored when InteractiveAdjustSampleDistances is
// enabled. To explicitly set and use this flag, one must disable
// InteractiveAdjustSampleDistances.
vtkSetClampMacro
(
AutoAdjustSampleDistances
,
int
,
0
,
1
);
vtkGetMacro
(
AutoAdjustSampleDistances
,
int
);
vtkBooleanMacro
(
AutoAdjustSampleDistances
,
int
);
...
...
@@ -212,7 +239,8 @@ public:
// Set/Get the distance between samples used for rendering
// when AutoAdjustSampleDistances is off, or when this mapper
// has more than 1 second allocated to it for rendering.
// Initial value is 1.0.
// If SampleDistance is negative, it will be computed based on the dataset
// spacing. Initial value is -1.0.
vtkSetMacro
(
SampleDistance
,
float
);
vtkGetMacro
(
SampleDistance
,
float
);
...
...
@@ -298,8 +326,23 @@ protected:
// The distance between sample points along the ray
float
SampleDistance
;
// Set whether or not the sample distance should be automatically calculated
// within the internal volume mapper
int
AutoAdjustSampleDistances
;
// If the DesiredUpdateRate of the vtkRenderWindow causing the Render is at
// or above this value, the render is considered interactive. Otherwise it is
// considered still.
double
InteractiveUpdateRate
;
// If the InteractiveAdjustSampleDistances flag is enabled,
// vtkSmartVolumeMapper interactively sets and resets the
// AutoAdjustSampleDistances flag on the internal volume mapper. This flag
// along with InteractiveUpdateRate is useful to adjust volume mapper sample
// distance based on whether the render is interactive or still.
int
InteractiveAdjustSampleDistances
;
private:
vtkSmartVolumeMapper
(
const
vtkSmartVolumeMapper
&
);
// Not implemented.
void
operator
=
(
const
vtkSmartVolumeMapper
&
);
// Not implemented.
...
...
Sankhesh Jhaveri
💬
@sankhesh
mentioned in commit
56155d23
·
Jul 18, 2015
mentioned in commit
56155d23
mentioned in commit 56155d23d15b8be06a2cad8885a6ff0cbf071d5a
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment