Commit Graph

2048 Commits

Author SHA1 Message Date
Kenneth Moreland
15d7132a2f Do not use "near" and "far" as variable names
Microsoft visual studio treats these as keywords. These keywords were
used for pointers on 16-bit architectures. That makes them pretty much
obsolete for any software written in the last 20 years, but happily they
stick around to give us confusing compile errors.
2016-06-15 14:37:18 -06:00
John Biddiscombe
208b1ddda3 Add a DeviceAdapter Copy test 2016-06-15 16:27:06 -04:00
Robert Maynard
1e19101eee Obey VisualStudio checked iterator levels, and NULL checked iterators
When compiling under VisualStudio we need to first determine if checked
iterators are enabled ( _ITERATOR_DEBUG_LEVEL ). We don't want to use the
NDEBUG key, as we could be inside a project that is in Debug mode with
disabled checked iterators.

Secondly if they are enabled we need to handle the use case of NULL iterators
that get advanced by length zero. This last case is valid, but isn't supported
by the checked iterators so we need to work around it
2016-06-15 13:13:02 -04:00
Dave Pugmire
af1daf2f66 Add support for offscreen rendering with EGL. Added new class CanvasEGL, and a test. 2016-06-15 09:48:45 -04:00
Kenneth Moreland
d861c1ec60 Reset Camera pan and zoom when setting range
It is odd to set the Camera range based on bounds and still have pan and
zoom activitated. This change resets the pan and zoom in these cases.
2016-06-14 17:44:16 -06:00
Kenneth Moreland
303b4da4c8 Remove BackgroundColor from Mapper
This was supposed to be removed in an earlier commit where the
background color was consolidated to Canvas, but I missed this one.
2016-06-14 14:18:21 -06:00
Kenneth Moreland
45a73baab1 Use degrees instead of radians for rotation transforms
It is more common to use degrees when specifying a transform (thanks to
the classic OpenGL interface). Also, camera specifies the field of view in
degrees, which made rotations inconsistent. This change unifies all that.
2016-06-14 13:52:55 -06:00
Kenneth Moreland
a2fee371b3 Add vtkm::Float64 versions of Camera methods
All of the Camera math (currently) uses 32-bit floats. However, to make
it easier to use the Camera class, I've duplicated the accessor methods
to also accept 64-bit floats.
2016-06-14 13:08:10 -06:00
Kenneth Moreland
123a3da8e6 Correct near clipping plane in ResetToBounds
Make it proportional to the size of the geometry.
2016-06-14 12:50:17 -06:00
Kenneth Moreland
dfc160a155 Merge branch 'resolve-conflicting-merges' into 'master'
Resolve conflicting merges

Merge request !445 (Camera enhancements) and merge request !448
(Consolidate background color) had conflicting changes in View.h.
Although git did not pick up on the conflict because each merge modified a
different portion of View.h, the final merge with both of these resulted
in a compile error.

Basically what happened was `Consolidate background color` changed all
the View constructors to reflect changes. `Camera enhancements` added a
new constructor to View using the old construction method. The new
constructor with the old construction method caused an error.

See merge request !451
2016-06-13 13:03:03 -04:00
Kenneth Moreland
fb68755924 Merge branch 'type-conversion' into 'master'
Fix warning about type conversion

C has a feature where if you perform arithmetic on small integers (like
char and short), it will automatically promote the result to a 32 bit
integer. If you then store that back in the same type you started with
GCC will warn you that you are loosing the precision (that you didn't ask
for in the first place). This is particularly annoying in templated
code.

Anyway, fixed yet another instance of that happening.

See merge request !450
2016-06-13 12:38:46 -04:00
Kenneth Moreland
d4e5bb0aee Resolve conflicting merges
Merge request !445 (Camera enhancements) and merge request !448
(Consolidate background color) had conflicting changes in View.h.
Although git did not pick up on the conflict because each merge modified a
different portion of View.h, the final merge with both of these resulted
in a compile error.

Basically what happened was `Consolidate background color` changed all
the View constructors to reflect changes. `Camera enhancements` added a
new constructor to View using the old construction method. The new
constructor with the old construction method caused an error.
2016-06-13 09:57:19 -06:00
Kenneth Moreland
e50d91199c Merge branch 'consolidate-background-color' into 'master'
Consolidate background color in rendering classes

Before this commit, there were three separate classes (Mapper, Canvas,
and View) that were all managing their own version of the background
color. As you can imagine, this could easily become out of sync, and in
fact if the user code did not specify the same background at least
twice, it would not work.

Fix this by consolidating the background color management to the Canvas.
This is the class most responsible for maintaining the background. All
other classes get or set the background from the Canvas.

That said, I also removed setting the background color from the
constructor in the Canvas. This background color is overridden by the
View anyway, so having it there was only confusing.

See merge request !448
2016-06-13 11:46:18 -04:00
Kenneth Moreland
b656baeeb6 Merge branch 'parameteric-coord-precision' into 'master'
Loosen threshold on test of parametric coordinates

The UnitTestParametricCoordinates test uses a pseudorandom number
generator to create some random set of parametric coordinates, convert
to world coordinates, and then back to parametric coordinates.

This has been working fine except that the world coordinate to parametric
coordinate conversion is not extremely precise for some cell shapes. (It
would not be cost effective to make it more precise.) Because of this,
the test_equal for this comparison has a pretty high threshold.

While looking at a dashboard I happened across a failure for this test.
It turns out that one of the parametric coordinates created for the
pyramid test for seed 1465529014 was just outside of this threshold, but
otherwise correct. I raised the threshold a little to try to prevent
this error.

See merge request !449
2016-06-13 11:36:04 -04:00
Kenneth Moreland
5a473b0012 Fix warning about type conversion
C has a feature where if you perform arithmetic on small integers (like
char and short), it will automatically promote the result to a 32 bit
integer. If you then store that back in the same type you started with
GCC will warn you that you are loosing the precision (that you didn't ask
for in the first place). This is particularly annoying in templated
code.

Anyway, fixed yet another instance of that happening.
2016-06-13 09:31:48 -06:00
Kenneth Moreland
9110214e7c Update OSMesa test
In the previous commit, I removed the background color arguments from
all the constructors from the Canvas class. I had missed the fact that
this was used in UnitTestMapperOSMesa.
2016-06-13 09:23:49 -06:00
Kenneth Moreland
f1e54ab568 Merge branch 'camera-enhancements' into 'master'
Camera enhancements



See merge request !445
2016-06-13 11:02:36 -04:00
Kenneth Moreland
a778d373f1 Loosen threshold on test of parametric coordinates
The UnitTestParametricCoordinates test uses a pseudorandom number
generator to create some random set of parametric coordinates, convert
to world coordinates, and then back to parametric coordinates.

This has been working fine except that the world coordinate to parametric
coordinate conversion is not extremely precise for some cell shapes. (It
would not be cost effective to make it more precise.) Because of this,
the test_equal for this comparison has a pretty high threshold.

While looking at a dashboard I happened across a failure for this test.
It turns out that one of the parametric coordinates created for the
pyramid test for seed 1465529014 was just outside of this threshold, but
otherwise correct. I raised the threshold a little to try to prevent
this error.
2016-06-13 08:56:40 -06:00
Kenneth Moreland
5dbcb33259 Modify implementation of Transform3DPoint
The new implementation assumes that the fourth component of the
homogeneous coordinate is not changed, which is true for all common
transforms except perspective projections. This should save several math
instructions to compute the fourth component and then divide the others
by it. If needed we can make a second method that does the complete
transform.

I am hoping that this will also solve what appears to be an optimization
bug on one of the dashboards.
2016-06-11 12:27:35 -06:00
Kenneth Moreland
72b43d7151 Consolidate background color in rendering classes
Before this commit, there were three separate classes (Mapper, Canvas,
and View) that were all managing their own version of the background
color. As you can imagine, this could easily become out of sync, and in
fact if the user code did not specify the same background at least
twice, it would not work.

Fix this by consolidating the background color management to the Canvas.
This is the class most responsible for maintaining the background. All
other classes get or set the background from the Canvas.

That said, I also removed setting the background color from the
constructor in the Canvas. This background color is overridden by the
View anyway, so having it there was only confusing.
2016-06-11 12:09:51 -06:00
Robert Maynard
5b6c6a7c72 Merge topic 'remove_UseVTKmCUDA.cmake_debug_message'
8a9fa5d2 Remove debug message from UseVTKmCUDA.cmake

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !446
2016-06-10 17:47:24 -04:00
Robert Maynard
65a3de9df8 Only generate code paths for Hexahedron input cells.
We currently only support Hex cells as our input cell type, so no reason
to compile in other cell type support currently.
2016-06-10 17:06:39 -04:00
Robert Maynard
8a9fa5d2cd Remove debug message from UseVTKmCUDA.cmake 2016-06-10 13:33:07 -04:00
Robert Maynard
6a395f06a4 Merge topic 'disable_vtkmAssume_windows_nvcc'
a2f5278f Disable VTKM_ASSUME when inside CUDA code compiled with VisualStudio.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !444
2016-06-09 15:43:31 -04:00
Kenneth Moreland
e47db6f610 Add dolly for 3D cameras
I forgot this one when adding roll, elevation, and azimuth.
2016-06-09 13:34:29 -06:00
Kenneth Moreland
ebfb1e7389 Make giving Camera to View optional
It is now optional to give a Camera object when constructing a View. If
a Camera is not specified, one is automatically set up by calling
ResetToBounds on the spatial bounds of the scene.

This makes it even easier to set up a view.
2016-06-09 13:34:29 -06:00
Kenneth Moreland
9f3e0e5952 Implement roll, elevation, and azimuth for 3D cameras
Also implement pan and zoom for 2D cameras.

Update the rendering tests to do these camera rotations. This matches
better the viewpoint used before the previous camera changes.
2016-06-09 13:34:29 -06:00
Kenneth Moreland
cdeeda67bb Make a shared header of 3D transformations
Affine transformations of homogeneous coordinates using 4x4 matrices are
quite common in visualization. Create a new math header file in the base
vtkm namespace that has common functions for such coordinates.

Much of this implementation was taken from the rendering matrix helpers.
2016-06-09 13:34:29 -06:00
Kenneth Moreland
d55402e998 Merge branch 'render-interface-consistency' into 'master'
Render interface consistency

These changes mostly represent changing the interface to some of
the rendering classes to be more consistent with the reset of VTK-m.
In particular, several exposed class members become private and
are accessed through methods.

There are some other changes to make the interface simpler to
use. One example is consolidating the width/height of the image
to the Canvas. (All other classes refer to the Canvas for the
width/height). Another example is removing the template from
the View class.

See merge request !442
2016-06-09 15:32:53 -04:00
Kenneth Moreland
9b34f9eccc Perform missing updates to OSMesa code
I do not have OSMesa on my main development platform, so I missed updating
some of the code when I changed the interface.

Also removed some inline statements on pure virtual functions that GCC
was complaining about.
2016-06-09 12:35:59 -06:00
Kenneth Moreland
ca87b5f736 Make defining WorldAnnotator for View optional
Most of the time, you just match the WorldAnnotator with the canvas of
the same type. Rather than make the user specify it every time, add a
method to the canvas that creates a "good" WorldAnnotator to use with
it. Then, if a WorldAnnotator is not given to the View constructor, one
is automatically created from the Canvas.
2016-06-09 12:08:03 -06:00
Kenneth Moreland
6e6177e2a8 Restore camera view diagnostics 2016-06-09 12:08:02 -06:00
Kenneth Moreland
2be7a8e032 Remove templating from View
The template parameters on vtkm::rendering::View are unnecessary. All
three of the templated classes are polymorphic (with virtual functions).
Thus, you just have to specify them at the constructor. Removing the
template parameters makes the syntax a bit cleaner and removes some
unnecessary duplication in the executable.

Removing the template does mean we cannot optimize in the future.
However, I expect us to start using more virtual methods rather than
less, so I think this is a move in the right direction.
2016-06-09 12:08:01 -06:00
Kenneth Moreland
5af7c6ff4c Hide internal parts of Canvas 2016-06-09 12:07:59 -06:00
Kenneth Moreland
55af901f60 Hide Camera private parts
With only a few exceptions for simple structures, we do not expose the
members of classes. Instead, we provide accessor methods. Do this for
Camera as well as add some helper methods.
2016-06-09 12:07:58 -06:00
Kenneth Moreland
0769b96bf3 Remove Width and Height from Camera
The width and height are maintained out of necessity by the canvas. A
second copy was maintained by the camera, which was only used for
computing the aspect ratio and similar metrics for projections.

Having to maintain the width/height in two places is a bit of a hassle
and provides the opportunity for bugs if they get out of sync. Instead,
have the width/height managed in one place (the canvas) and pass them as
parameters as necessary.
2016-06-09 12:07:56 -06:00
Kenneth Moreland
b01e8391b4 Consolidate functionality in Canvas classes
Move some of the management of the width, height, and buffers to the base
Canvas class. Also, when it makes sense, get the width and height from
the rendering system.

Also changed the color buffer to be a Vec so that you don't have to
manage array offsets by hand.

All of these changes snowballed from the observation that the glut
example did not properly enable the depth buffer.
2016-06-09 12:07:55 -06:00
Kenneth Moreland
c613145706 Add cool2warm color map as default
Make default color map automatic when creating a Plot.
2016-06-09 12:07:54 -06:00
Kenneth Moreland
e30607f134 Hide internal std::vector in Scene
Generally we try not to expose the implementation details of how things
are stored in objects.

Also changed some arguments that should have been declared const to
actually be const.
2016-06-09 12:07:53 -06:00
Kenneth Moreland
0569219b62 Merge branch 'gcc-warning' into 'master'
Fix conversion warning

This warning happened on GCC 4.8.0.

See merge request !443
2016-06-09 14:03:42 -04:00
Robert Maynard
a2f5278f12 Disable VTKM_ASSUME when inside CUDA code compiled with VisualStudio.
We have found a bug inside NVCC/VS where it will generate bad PTX code when
it encounters __assume.
2016-06-09 13:29:14 -04:00
Kenneth Moreland
eaa5747527 Fix conversion warning
This warning happened on GCC 4.8.0.
2016-06-09 11:00:06 -06:00
Kenneth Moreland
1d5fbea3e9 Merge branch 'volume-raytracing-crash' into 'master'
Fix use of uninitialized invSpacing value in volume raytracing

The SamplerRect worklet had an error where it was possible that the
invSpacing stack-local values could be used uninitialized. On the first
iteration of the loop in the SamplerRect operation, it calls LocateCell,
which is supposed to set invSpacing. Under most conditions it does, but
if one of the ray directions is 0 (which can happen with axis-aligned
views), one of the invSpacing dimensions was skipped, leaving the value
to whatever garbage happened to be on the stack. Later, the invSpacing
value was used to interpolate a scalar, which under some circumstances
could cause an array index error when looking up a color in the color
map.

This fix changes the condition for when the ray direction is 0 to still
initialize invSpacing.

See merge request !441
2016-06-07 12:54:29 -04:00
Kenneth Moreland
8834458238 Fix use of uninitialized invSpacing value
The SamplerRect worklet had an error where it was possible that the
invSpacing stack-local values could be used uninitialized. On the first
iteration of the loop in the SamplerRect operation, it calls LocateCell,
which is supposed to set invSpacing. Under most conditions it does, but
if one of the ray directions is 0 (which can happen with axis-aligned
views), one of the invSpacing dimensions was skipped, leaving the value
to whatever garbage happened to be on the stack. Later, the invSpacing
value was used to interpolate a scalar, which under some circumstances
could cause an array index error when looking up a color in the color
map.

This fix changes the condition for when the ray direction is 0 to still
initialize invSpacing.
2016-06-07 09:36:56 -06:00
Kenneth Moreland
30fdc7f984 Merge branch 'osmesa-link-error' into 'master'
Fix minor issues with building with OSMesa



See merge request !440
v1.0.0
2016-06-06 14:40:56 -04:00
Kenneth Moreland
74f93807d9 Add OpenGL library to renering tests when applicable
It is necessary for the OSMesa test, and will probably be needed for
tests in the future.
2016-06-06 09:55:38 -06:00
Kenneth Moreland
7673c739d1 Link rendering tests to OSMesa library, not include dir
There was an error in the CMakeLists.txt in the rendering tests where
the include directory was linked in instead of the OSMesa library.
It was a simple mistake of typing the wrong CMake variable.
2016-06-06 09:48:37 -06:00
Robert Maynard
5ba6afe688 Merge topic 'cmake_cuda_detection_use_working_dir'
a0af013c Auto-detection of cuda version requires usage of a working directory.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !439
2016-06-03 14:46:56 -04:00
Robert Maynard
c792dd505c Merge topic 'build_rendering_without_mesa'
1d379db4 Allow people to build rendering without mesa.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !438
2016-06-03 14:19:11 -04:00
Kenneth Moreland
bbb42a014c Merge branch 'rename-rendering-classes' into 'master'
Rename rendering classes

Per our discussion in our last technical meeting, we are renaming several
of the rendering classes to be more clear and consistent with other
software products.

See merge request !437
2016-06-03 14:15:26 -04:00