Commit 5c453769 authored by dpugmire's avatar dpugmire
Browse files

Merge branch 'master' of https://gitlab.kitware.com/vtk/vtk-m into messenger_cleanup

parents 43b4bf46 32b87b8b
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:b4f049b4f0e79a27ebbdab187325db55653abe2ce661c8f1d2f3fcb413e3b961 oid sha256:785051d9773c4a0ced2701de3499f9cd948da2a4c846a5187e30dfb5cb0783cb
size 10883 size 10830
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:8c22f2d4e19191ff05d9dc52ea740269fcdfe129b9d100ea8db6d4cbb989b161 oid sha256:1d990b5f0e9ef27e4e5f87f4c62c4f9974992506521f32bd5901ac6670e71bfa
size 9652 size 9656
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:74995441b8f0c0c19b16d45c489932958784bb3f32c65fd274985b3ecfcc87d6 oid sha256:54e09a09c97a20627e54c835d2d488bc9f692ef1315122ab60241c006ab78813
size 19885 size 19742
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:573927195d4a2dbcc5f92b9f443dcdeaa30b0e27c77da3563bf91064b6d037ad oid sha256:e1472e6002ca4ad4012e0c9f067f8254290fabe93c82713a4994ad97a7fdbdfc
size 31339 size 31218
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:db2f033837778828b54f398bbc9df180eb8da425cb29025c13e3930aa9c02da3 oid sha256:5ff6d72bd325ffe0fb3b22bfdc294b6d674384afd662290424bb77634202b4ef
size 71673 size 71150
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:a20e53e0ed56502d9a821fcceef2c0b34e71d2a5748519fd55352c3824582675 oid sha256:24c71e8846fe62e6f6eefdb72c9729639061af80bf9d3453d35c8c6838de9174
size 37150 size 37162
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:a2147c3e30227d41dca5b6b18a1df6474ffe7f4fd6a72614979c5245299c973a oid sha256:b4c905ec76e72513519515ec41cf5efd34490b98255ee7465f8b6746fcff41e5
size 51846 size 51865
...@@ -208,7 +208,7 @@ private: ...@@ -208,7 +208,7 @@ private:
{ {
static std::string TestDataBasePath; static std::string TestDataBasePath;
if (path != "") if (!path.empty())
{ {
TestDataBasePath = path; TestDataBasePath = path;
if ((TestDataBasePath.back() != '/') && (TestDataBasePath.back() != '\\')) if ((TestDataBasePath.back() != '/') && (TestDataBasePath.back() != '\\'))
...@@ -217,6 +217,13 @@ private: ...@@ -217,6 +217,13 @@ private:
} }
} }
if (TestDataBasePath.empty())
{
VTKM_LOG_S(
vtkm::cont::LogLevel::Error,
"TestDataBasePath was never set, was --data-dir set correctly? (hint: ../data/data)");
}
return TestDataBasePath; return TestDataBasePath;
} }
...@@ -224,7 +231,7 @@ private: ...@@ -224,7 +231,7 @@ private:
{ {
static std::string RegressionTestImageBasePath; static std::string RegressionTestImageBasePath;
if (path != "") if (!path.empty())
{ {
RegressionTestImageBasePath = path; RegressionTestImageBasePath = path;
if ((RegressionTestImageBasePath.back() != '/') && if ((RegressionTestImageBasePath.back() != '/') &&
...@@ -234,6 +241,13 @@ private: ...@@ -234,6 +241,13 @@ private:
} }
} }
if (RegressionTestImageBasePath.empty())
{
VTKM_LOG_S(vtkm::cont::LogLevel::Error,
"RegressionTestImageBasePath was never set, was --baseline-dir set correctly? "
"(hint: ../data/baseline)");
}
return RegressionTestImageBasePath; return RegressionTestImageBasePath;
} }
...@@ -241,7 +255,7 @@ private: ...@@ -241,7 +255,7 @@ private:
{ {
static std::string WriteDirBasePath; static std::string WriteDirBasePath;
if (path != "") if (!path.empty())
{ {
WriteDirBasePath = path; WriteDirBasePath = path;
if ((WriteDirBasePath.back() != '/') && (WriteDirBasePath.back() != '\\')) if ((WriteDirBasePath.back() != '/') && (WriteDirBasePath.back() != '\\'))
......
...@@ -122,9 +122,9 @@ public: ...@@ -122,9 +122,9 @@ public:
} }
} }
VTKM_DEPRECATED(1.6, "Locators no longer pointers. Use . operator.") VTKM_DEPRECATED(1.6, "Locators are no longer pointers. Use . operator.")
VTKM_EXEC CellLocatorBoundingIntervalHierarchy* operator->() { return this; } VTKM_EXEC CellLocatorBoundingIntervalHierarchy* operator->() { return this; }
VTKM_DEPRECATED(1.6, "Locators no longer pointers. Use . operator.") VTKM_DEPRECATED(1.6, "Locators are no longer pointers. Use . operator.")
VTKM_EXEC const CellLocatorBoundingIntervalHierarchy* operator->() const { return this; } VTKM_EXEC const CellLocatorBoundingIntervalHierarchy* operator->() const { return this; }
private: private:
......
...@@ -58,9 +58,9 @@ public: ...@@ -58,9 +58,9 @@ public:
return this->Locators.CastAndCall(detail::FindCellFunctor{}, point, cellId, parametric); return this->Locators.CastAndCall(detail::FindCellFunctor{}, point, cellId, parametric);
} }
VTKM_DEPRECATED(1.6, "Locators no longer pointers. Use . operator.") VTKM_DEPRECATED(1.6, "Locators are no longer pointers. Use . operator.")
VTKM_EXEC CellLocatorMultiplexer* operator->() { return this; } VTKM_EXEC CellLocatorMultiplexer* operator->() { return this; }
VTKM_DEPRECATED(1.6, "Locators no longer pointers. Use . operator.") VTKM_DEPRECATED(1.6, "Locators are no longer pointers. Use . operator.")
VTKM_EXEC const CellLocatorMultiplexer* operator->() const { return this; } VTKM_EXEC const CellLocatorMultiplexer* operator->() const { return this; }
}; };
......
...@@ -144,9 +144,9 @@ public: ...@@ -144,9 +144,9 @@ public:
return vtkm::ErrorCode::Success; return vtkm::ErrorCode::Success;
} }
VTKM_DEPRECATED(1.6, "Locators no longer pointers. Use . operator.") VTKM_DEPRECATED(1.6, "Locators are no longer pointers. Use . operator.")
VTKM_EXEC CellLocatorRectilinearGrid* operator->() { return this; } VTKM_EXEC CellLocatorRectilinearGrid* operator->() { return this; }
VTKM_DEPRECATED(1.6, "Locators no longer pointers. Use . operator.") VTKM_DEPRECATED(1.6, "Locators are no longer pointers. Use . operator.")
VTKM_EXEC const CellLocatorRectilinearGrid* operator->() const { return this; } VTKM_EXEC const CellLocatorRectilinearGrid* operator->() const { return this; }
private: private:
......
...@@ -200,9 +200,9 @@ public: ...@@ -200,9 +200,9 @@ public:
return vtkm::ErrorCode::CellNotFound; return vtkm::ErrorCode::CellNotFound;
} }
VTKM_DEPRECATED(1.6, "Locators no longer pointers. Use . operator.") VTKM_DEPRECATED(1.6, "Locators are no longer pointers. Use . operator.")
VTKM_EXEC CellLocatorTwoLevel* operator->() { return this; } VTKM_EXEC CellLocatorTwoLevel* operator->() { return this; }
VTKM_DEPRECATED(1.6, "Locators no longer pointers. Use . operator.") VTKM_DEPRECATED(1.6, "Locators are no longer pointers. Use . operator.")
VTKM_EXEC const CellLocatorTwoLevel* operator->() const { return this; } VTKM_EXEC const CellLocatorTwoLevel* operator->() const { return this; }
private: private:
......
...@@ -82,9 +82,9 @@ public: ...@@ -82,9 +82,9 @@ public:
return vtkm::ErrorCode::Success; return vtkm::ErrorCode::Success;
} }
VTKM_DEPRECATED(1.6, "Locators no longer pointers. Use . operator.") VTKM_DEPRECATED(1.6, "Locators are no longer pointers. Use . operator.")
VTKM_EXEC CellLocatorUniformGrid* operator->() { return this; } VTKM_EXEC CellLocatorUniformGrid* operator->() { return this; }
VTKM_DEPRECATED(1.6, "Locators no longer pointers. Use . operator.") VTKM_DEPRECATED(1.6, "Locators are no longer pointers. Use . operator.")
VTKM_EXEC const CellLocatorUniformGrid* operator->() const { return this; } VTKM_EXEC const CellLocatorUniformGrid* operator->() const { return this; }
private: private:
......
...@@ -85,6 +85,11 @@ public: ...@@ -85,6 +85,11 @@ public:
this->FindInBox(queryPoint, ijk, level, nearestNeighborId, distance2); this->FindInBox(queryPoint, ijk, level, nearestNeighborId, distance2);
} }
VTKM_DEPRECATED(1.6, "Locators are no longer pointers. Use . operator.")
VTKM_EXEC PointLocatorSparseGrid* operator->() { return this; }
VTKM_DEPRECATED(1.6, "Locators are no longer pointers. Use . operator.")
VTKM_EXEC const PointLocatorSparseGrid* operator->() const { return this; }
private: private:
vtkm::Vec3f Min; vtkm::Vec3f Min;
vtkm::Id3 Dims; vtkm::Id3 Dims;
......
...@@ -286,7 +286,7 @@ void Camera::ResetToBounds(const vtkm::Bounds& dataBounds, ...@@ -286,7 +286,7 @@ void Camera::ResetToBounds(const vtkm::Bounds& dataBounds,
vtkm::Float32 diagonalLength = vtkm::Magnitude(totalExtent); vtkm::Float32 diagonalLength = vtkm::Magnitude(totalExtent);
this->SetPosition(center + directionOfProjection * diagonalLength * 1.0f); this->SetPosition(center + directionOfProjection * diagonalLength * 1.0f);
this->SetFieldOfView(60.0f); this->SetFieldOfView(60.0f);
this->SetClippingRange(0.1f * diagonalLength, diagonalLength * 10.0f); this->SetClippingRange(0.1f * diagonalLength, diagonalLength * 5.0f);
// Reset for 2D camera // Reset for 2D camera
this->SetViewRange2D(db); this->SetViewRange2D(db);
......
...@@ -27,11 +27,13 @@ namespace internal ...@@ -27,11 +27,13 @@ namespace internal
class SurfaceConverter : public vtkm::worklet::WorkletMapField class SurfaceConverter : public vtkm::worklet::WorkletMapField
{ {
vtkm::Matrix<vtkm::Float32, 4, 4> ViewProjMat; vtkm::Matrix<vtkm::Float32, 4, 4> ViewProjMat;
bool Is3d;
public: public:
VTKM_CONT VTKM_CONT
SurfaceConverter(const vtkm::Matrix<vtkm::Float32, 4, 4> viewProjMat) SurfaceConverter(const vtkm::Matrix<vtkm::Float32, 4, 4> viewProjMat, bool is3d)
: ViewProjMat(viewProjMat) : ViewProjMat(viewProjMat)
, Is3d(is3d)
{ {
} }
...@@ -51,7 +53,18 @@ public: ...@@ -51,7 +53,18 @@ public:
ColorBufferPortalType& colorBuffer, ColorBufferPortalType& colorBuffer,
const vtkm::Id& index) const const vtkm::Id& index) const
{ {
vtkm::Vec<Precision, 3> intersection = origin + inDepth * dir; vtkm::Vec<Precision, 3> intersection;
// For reasons I can't explain atm, the view direction
// is different for for 2d and 3d so that it matches the
// gl depth buffer values for annotations
if (Is3d)
{
intersection = origin + inDepth * dir;
}
else
{
intersection = origin + inDepth * (-dir);
}
vtkm::Vec4f_32 point; vtkm::Vec4f_32 point;
point[0] = static_cast<vtkm::Float32>(intersection[0]); point[0] = static_cast<vtkm::Float32>(intersection[0]);
point[1] = static_cast<vtkm::Float32>(intersection[1]); point[1] = static_cast<vtkm::Float32>(intersection[1]);
...@@ -105,7 +118,8 @@ VTKM_CONT void WriteToCanvas(const vtkm::rendering::raytracing::Ray<Precision>& ...@@ -105,7 +118,8 @@ VTKM_CONT void WriteToCanvas(const vtkm::rendering::raytracing::Ray<Precision>&
vtkm::MatrixMultiply(camera.CreateProjectionMatrix(canvas->GetWidth(), canvas->GetHeight()), vtkm::MatrixMultiply(camera.CreateProjectionMatrix(canvas->GetWidth(), canvas->GetHeight()),
camera.CreateViewMatrix()); camera.CreateViewMatrix());
vtkm::worklet::DispatcherMapField<SurfaceConverter>(SurfaceConverter(viewProjMat)) bool is3d = camera.GetMode() == vtkm::rendering::Camera::MODE_3D;
vtkm::worklet::DispatcherMapField<SurfaceConverter>(SurfaceConverter(viewProjMat, is3d))
.Invoke(rays.PixelIdx, .Invoke(rays.PixelIdx,
colors, colors,
rays.Distance, rays.Distance,
......
...@@ -55,6 +55,11 @@ void LineRenderer::RenderLine(const vtkm::Vec3f_64& point0, ...@@ -55,6 +55,11 @@ void LineRenderer::RenderLine(const vtkm::Vec3f_64& point0,
vtkm::Id dx = vtkm::Abs(x1 - x0), sx = x0 < x1 ? 1 : -1; vtkm::Id dx = vtkm::Abs(x1 - x0), sx = x0 < x1 ? 1 : -1;
vtkm::Id dy = -vtkm::Abs(y1 - y0), sy = y0 < y1 ? 1 : -1; vtkm::Id dy = -vtkm::Abs(y1 - y0), sy = y0 < y1 ? 1 : -1;
vtkm::Id err = dx + dy, err2 = 0; vtkm::Id err = dx + dy, err2 = 0;
const vtkm::Id xStart = x0;
const vtkm::Id yStart = y0;
const vtkm::Float32 pdist = vtkm::Sqrt(vtkm::Float32(dx * dx) + vtkm::Float32(dy * dy));
auto colorPortal = auto colorPortal =
vtkm::rendering::Canvas::ColorBufferType(Canvas->GetColorBuffer()).WritePortal(); vtkm::rendering::Canvas::ColorBufferType(Canvas->GetColorBuffer()).WritePortal();
auto depthPortal = auto depthPortal =
...@@ -63,9 +68,19 @@ void LineRenderer::RenderLine(const vtkm::Vec3f_64& point0, ...@@ -63,9 +68,19 @@ void LineRenderer::RenderLine(const vtkm::Vec3f_64& point0,
while (x0 >= 0 && x0 < Canvas->GetWidth() && y0 >= 0 && y0 < Canvas->GetHeight()) while (x0 >= 0 && x0 < Canvas->GetWidth() && y0 >= 0 && y0 < Canvas->GetHeight())
{ {
vtkm::Float32 t = (dx == 0) ? 1.0f : (static_cast<vtkm::Float32>(x0) - p0[0]) / (p1[0] - p0[0]); vtkm::Float32 deltaX = static_cast<vtkm::Float32>(x0 - xStart);
vtkm::Float32 deltaY = static_cast<vtkm::Float32>(y0 - yStart);
// Depth is wrong, but its far less wrong that it used to be.
// These depth values are in screen space, which have been
// potentially tranformed by a perspective correction.
// To interpolated the depth correctly, there must be a perspective correction.
// I haven't looked, but the wireframmer probably suffers from this too.
// Additionally, this should not happen on the CPU. Annotations take
// far longer than the the geometry.
vtkm::Float32 t = pdist == 0.f ? 1.0f : vtkm::Sqrt(deltaX * deltaX + deltaY * deltaY) / pdist;
t = vtkm::Min(1.f, vtkm::Max(0.f, t)); t = vtkm::Min(1.f, vtkm::Max(0.f, t));
vtkm::Float32 z = vtkm::Lerp(z0, z1, t); vtkm::Float32 z = vtkm::Lerp(z0, z1, t);
vtkm::Id index = y0 * Canvas->GetWidth() + x0; vtkm::Id index = y0 * Canvas->GetWidth() + x0;
vtkm::Vec4f_32 currentColor = colorPortal.Get(index); vtkm::Vec4f_32 currentColor = colorPortal.Get(index);
vtkm::Float32 currentZ = depthPortal.Get(index); vtkm::Float32 currentZ = depthPortal.Get(index);
...@@ -85,6 +100,7 @@ void LineRenderer::RenderLine(const vtkm::Vec3f_64& point0, ...@@ -85,6 +100,7 @@ void LineRenderer::RenderLine(const vtkm::Vec3f_64& point0,
writeColor[2] = currentColor[2] + colorC[2] * alpha; writeColor[2] = currentColor[2] + colorC[2] * alpha;
writeColor[3] = 1.f * alpha + currentColor[3]; // we are always drawing opaque lines writeColor[3] = 1.f * alpha + currentColor[3]; // we are always drawing opaque lines
// keep the current z. Line z interpolation is not accurate // keep the current z. Line z interpolation is not accurate
// Matt: this is correct. Interpolation is wrong
depth = currentZ; depth = currentZ;
} }
......
...@@ -379,7 +379,7 @@ public: ...@@ -379,7 +379,7 @@ public:
: MinScalar(minScalar) : MinScalar(minScalar)
{ {
Normalize = true; Normalize = true;
if (minScalar > maxScalar) if (minScalar >= maxScalar)
{ {
// support the scalar renderer // support the scalar renderer
Normalize = false; Normalize = false;
......
...@@ -366,7 +366,7 @@ public: ...@@ -366,7 +366,7 @@ public:
: MinScalar(minScalar) : MinScalar(minScalar)
{ {
Normalize = true; Normalize = true;
if (minScalar > maxScalar) if (minScalar >= maxScalar)
{ {
// support the scalar renderer // support the scalar renderer
Normalize = false; Normalize = false;
......
...@@ -28,7 +28,7 @@ void RayOperations::MapCanvasToRays(Ray<vtkm::Float32>& rays, ...@@ -28,7 +28,7 @@ void RayOperations::MapCanvasToRays(Ray<vtkm::Float32>& rays,
(void)valid; // this can be a false negative for really tiny spatial domains. (void)valid; // this can be a false negative for really tiny spatial domains.
vtkm::worklet::DispatcherMapField<detail::RayMapCanvas>( vtkm::worklet::DispatcherMapField<detail::RayMapCanvas>(
detail::RayMapCanvas(inverse, width, height, camera.GetPosition())) detail::RayMapCanvas(inverse, width, height, camera.GetPosition()))
.Invoke(rays.PixelIdx, rays.MaxDistance, canvas.GetDepthBuffer()); .Invoke(rays.PixelIdx, rays.MaxDistance, rays.Origin, canvas.GetDepthBuffer());
} }
} }
} }
......
Supports Markdown
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