mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 21:33:55 +00:00
Fix multiple warnings about unused params and precision loss
This commit is contained in:
parent
ee73ab96a8
commit
68c18b2e38
@ -162,7 +162,7 @@ public:
|
||||
for (std::size_t xIndex=0; xIndex < this->Width; xIndex++)
|
||||
{
|
||||
const vtkm::Float32 *tuple =
|
||||
&(this->ColorBuffer[yIndex*this->Width*4 + xIndex*4]);
|
||||
&(this->ColorBuffer[static_cast<std::size_t>(yIndex)*this->Width*4 + xIndex*4]);
|
||||
of<<(unsigned char)(tuple[0]*255);
|
||||
of<<(unsigned char)(tuple[1]*255);
|
||||
of<<(unsigned char)(tuple[2]*255);
|
||||
|
@ -86,7 +86,7 @@ public:
|
||||
for (std::size_t xIndex=0; xIndex < this->Width; xIndex++)
|
||||
{
|
||||
const vtkm::Float32 *tuple =
|
||||
&(this->ColorBuffer[yIndex*this->Width*4 + xIndex*4]);
|
||||
&(this->ColorBuffer[static_cast<std::size_t>(yIndex)*this->Width*4 + xIndex*4]);
|
||||
of<<(unsigned char)(tuple[0]*255);
|
||||
of<<(unsigned char)(tuple[1]*255);
|
||||
of<<(unsigned char)(tuple[2]*255);
|
||||
@ -99,7 +99,8 @@ public:
|
||||
this->ColorArray = vtkm::cont::make_ArrayHandle(this->ColorBuffer);
|
||||
this->DepthArray = vtkm::cont::make_ArrayHandle(this->DepthBuffer);
|
||||
vtkm::worklet::DispatcherMapField< ClearBuffers >(
|
||||
ClearBuffers( this->BackgroundColor, this->Width*this->Height ) )
|
||||
ClearBuffers( this->BackgroundColor,
|
||||
static_cast<vtkm::Int32>(this->Width*this->Height) ) )
|
||||
.Invoke( this->DepthArray,
|
||||
vtkm::exec::ExecutionWholeArray<vtkm::Float32>(this->ColorArray) );
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ public:
|
||||
virtual void EndScene()
|
||||
{
|
||||
}
|
||||
virtual void SetRenderSurface(RenderSurface *surface)
|
||||
virtual void SetRenderSurface(RenderSurface *vtkmNotUsed(surface))
|
||||
{
|
||||
}
|
||||
protected:
|
||||
|
@ -34,7 +34,7 @@ namespace rendering {
|
||||
// static bool doOnce = true;
|
||||
template<typename DeviceAdapter = VTKM_DEFAULT_DEVICE_ADAPTER_TAG>
|
||||
class SceneRendererRayTracer : public SceneRenderer
|
||||
{
|
||||
{
|
||||
protected:
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float32,4> > ColorMap;
|
||||
vtkm::rendering::raytracing::RayTracer<DeviceAdapter> Tracer;
|
||||
@ -48,9 +48,9 @@ public:
|
||||
VTKM_CONT_EXPORT
|
||||
void SetRenderSurface(RenderSurface *surface)
|
||||
{
|
||||
if(surface != NULL)
|
||||
if(surface != NULL)
|
||||
{
|
||||
|
||||
|
||||
Surface = dynamic_cast<RenderSurfaceRayTracer*>(surface);
|
||||
if(Surface == NULL)
|
||||
{
|
||||
@ -69,11 +69,11 @@ public:
|
||||
void RenderCells(const vtkm::cont::DynamicCellSet &cellset,
|
||||
const vtkm::cont::CoordinateSystem &coords,
|
||||
vtkm::cont::Field &scalarField,
|
||||
const vtkm::rendering::ColorTable &colorTable,
|
||||
vtkm::rendering::View &view,
|
||||
const vtkm::rendering::ColorTable &vtkmNotUsed(colorTable),
|
||||
vtkm::rendering::View &view,
|
||||
vtkm::Float64 *scalarBounds)
|
||||
{
|
||||
|
||||
|
||||
vtkm::cont::Timer<DeviceAdapter> timer;
|
||||
const vtkm::cont::DynamicArrayHandleCoordinateSystem dynamicCoordsHandle = coords.GetData();
|
||||
vtkm::cont::ArrayHandle< vtkm::Vec<vtkm::Id, 4> > indices;
|
||||
@ -86,7 +86,7 @@ public:
|
||||
|
||||
Triangulator<DeviceAdapter> triangulator;
|
||||
triangulator.run(cellset, indices, numberOfTriangles);//,dynamicCoordsHandle,dataBounds);
|
||||
|
||||
|
||||
Tracer.SetData(dynamicCoordsHandle, indices, scalarField, numberOfTriangles, scalarBounds, dataBounds);
|
||||
Tracer.SetColorMap(ColorMap);
|
||||
Tracer.SetBackgroundColor(BackgroundColor);
|
||||
|
@ -34,7 +34,7 @@ namespace vtkm {
|
||||
namespace rendering {
|
||||
template<typename DeviceAdapter = VTKM_DEFAULT_DEVICE_ADAPTER_TAG>
|
||||
class SceneRendererVolume : public SceneRenderer
|
||||
{
|
||||
{
|
||||
protected:
|
||||
vtkm::rendering::raytracing::VolumeRendererStructured<DeviceAdapter> Tracer;
|
||||
RenderSurfaceRayTracer *Surface;
|
||||
@ -50,13 +50,13 @@ public:
|
||||
{
|
||||
Tracer.SetNumberOfSamples(numSamples);
|
||||
}
|
||||
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
void SetRenderSurface(RenderSurface *surface)
|
||||
{
|
||||
if(surface != NULL)
|
||||
if(surface != NULL)
|
||||
{
|
||||
|
||||
|
||||
Surface = dynamic_cast<RenderSurfaceRayTracer*>(surface);
|
||||
if(Surface == NULL)
|
||||
{
|
||||
@ -78,13 +78,11 @@ public:
|
||||
vtkm::Float64 coordsBounds[6]; // Xmin,Xmax,Ymin..
|
||||
coords.GetBounds(coordsBounds,DeviceAdapter());
|
||||
|
||||
bool isExplicit = false;
|
||||
bool isUniform = false;
|
||||
if(!cellset.IsSameType(vtkm::cont::CellSetStructured<3>()))
|
||||
{
|
||||
std::cerr<<"ERROR cell set type not currently supported\n";
|
||||
std::string theType = typeid(cellset).name();
|
||||
std::cerr<<"Type : "<<theType<<std::endl;
|
||||
std::cerr<<"Type : "<<theType<<std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -98,7 +96,7 @@ public:
|
||||
Tracer.SetBackgroundColor(this->BackgroundColor);
|
||||
Tracer.Render(Surface);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
}} //namespace vtkm::rendering
|
||||
|
@ -48,7 +48,7 @@ namespace raytracing {
|
||||
//template<typename DeviceAdapter>
|
||||
class LinearBVH
|
||||
{
|
||||
|
||||
|
||||
public:
|
||||
vtkm::cont::ArrayHandle< vtkm::Vec<vtkm::Float32, 4> > FlatBVH;
|
||||
vtkm::cont::ArrayHandle< vtkm::Vec<vtkm::Int32, 4> > LeafNodes;
|
||||
@ -151,7 +151,7 @@ public:
|
||||
zmax = vtkm::Max(zmax,point[2]);
|
||||
}
|
||||
}; //class FindAABBs
|
||||
|
||||
|
||||
|
||||
class GatherFloat32 : public vtkm::worklet::WorkletMapField
|
||||
{
|
||||
@ -167,7 +167,7 @@ public:
|
||||
GatherFloat32(const FloatArrayHandle &inputPortal,
|
||||
FloatArrayHandle &outputPortal,
|
||||
const vtkm::Id &size)
|
||||
: InputPortal(inputPortal.PrepareForInput( DeviceAdapter() ))
|
||||
: InputPortal(inputPortal.PrepareForInput( DeviceAdapter() ))
|
||||
{
|
||||
this->OutputPortal = outputPortal.PrepareForOutput(size, DeviceAdapter() );
|
||||
}
|
||||
@ -179,7 +179,7 @@ public:
|
||||
OutputPortal.Set(outIndex, InputPortal.Get(inIndex));
|
||||
}
|
||||
}; //class GatherFloat
|
||||
|
||||
|
||||
class GatherVecCast : public vtkm::worklet::WorkletMapField
|
||||
{
|
||||
private:
|
||||
@ -195,7 +195,7 @@ public:
|
||||
GatherVecCast(const Vec4IdArrayHandle &inputPortal,
|
||||
Vec4IntArrayHandle &outputPortal,
|
||||
const vtkm::Id &size)
|
||||
: InputPortal(inputPortal.PrepareForInput( DeviceAdapter() ))
|
||||
: InputPortal(inputPortal.PrepareForInput( DeviceAdapter() ))
|
||||
{
|
||||
this->OutputPortal = outputPortal.PrepareForOutput(size, DeviceAdapter() );
|
||||
}
|
||||
@ -210,8 +210,8 @@ public:
|
||||
|
||||
class BVHData
|
||||
{
|
||||
public:
|
||||
|
||||
public:
|
||||
|
||||
//TODO: make private
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> *xmins;
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> *ymins;
|
||||
@ -219,14 +219,14 @@ public:
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> *xmaxs;
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> *ymaxs;
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> *zmaxs;
|
||||
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::UInt32> mortonCodes;
|
||||
vtkm::cont::ArrayHandle<vtkm::Id> parent;
|
||||
vtkm::cont::ArrayHandle<vtkm::Id> leftChild;
|
||||
vtkm::cont::ArrayHandle<vtkm::Id> rightChild;
|
||||
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
BVHData(vtkm::Id numPrimitives)
|
||||
BVHData(vtkm::Id numPrimitives)
|
||||
: NumPrimitives(numPrimitives)
|
||||
{
|
||||
InnerNodeCount = NumPrimitives - 1;
|
||||
@ -242,9 +242,9 @@ public:
|
||||
leftChild.PrepareForOutput(InnerNodeCount, DeviceAdapter());
|
||||
rightChild.PrepareForOutput(InnerNodeCount, DeviceAdapter());
|
||||
mortonCodes.PrepareForOutput(NumPrimitives, DeviceAdapter());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
~BVHData()
|
||||
{
|
||||
@ -255,22 +255,22 @@ public:
|
||||
delete xmaxs;
|
||||
delete ymaxs;
|
||||
delete zmaxs;
|
||||
|
||||
|
||||
}
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::Id GetNumberOfPrimitives() const
|
||||
{
|
||||
return NumPrimitives;
|
||||
}
|
||||
}
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::Id GetNumberOfInnerNodes() const
|
||||
{
|
||||
return InnerNodeCount;
|
||||
}
|
||||
}
|
||||
private:
|
||||
vtkm::Id NumPrimitives;
|
||||
vtkm::Id InnerNodeCount;
|
||||
|
||||
|
||||
}; // class BVH
|
||||
|
||||
class PropagateAABBs : public vtkm::worklet::WorkletMapField
|
||||
@ -278,10 +278,10 @@ public:
|
||||
private:
|
||||
typedef typename vtkm::cont::ArrayHandle<vtkm::Id> IdArrayHandle;
|
||||
typedef typename vtkm::cont::ArrayHandle<vtkm::Int8> Int8Handle;
|
||||
typedef typename vtkm::cont::ArrayHandle<Vec<vtkm::Float32,2> > Float2ArrayHandle;
|
||||
typedef typename vtkm::cont::ArrayHandle<Vec<vtkm::Float32,2> > Float2ArrayHandle;
|
||||
typedef typename vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Int32,2> > VecInt2Handle;
|
||||
typedef typename vtkm::cont::ArrayHandle<Vec<vtkm::Float32,4> > Float4ArrayHandle;
|
||||
|
||||
typedef typename vtkm::cont::ArrayHandle<Vec<vtkm::Float32,4> > Float4ArrayHandle;
|
||||
|
||||
typedef typename IdArrayHandle::ExecutionTypes<DeviceAdapter>::PortalConst IdConstPortal;
|
||||
typedef typename Float2ArrayHandle::ExecutionTypes<DeviceAdapter>::Portal Float2ArrayPortal;
|
||||
typedef typename VecInt2Handle::ExecutionTypes<DeviceAdapter>::Portal Int2ArrayPortal;
|
||||
@ -309,7 +309,7 @@ public:
|
||||
RightChildren(rightChildren.PrepareForInput( DeviceAdapter() )),
|
||||
LeafCount(leafCount),
|
||||
Counters(counters)
|
||||
|
||||
|
||||
{
|
||||
this->FlatBVH = flatBVH.PrepareForOutput((LeafCount - 1) * 4, DeviceAdapter() );
|
||||
}
|
||||
@ -340,7 +340,7 @@ public:
|
||||
vtkm::Id currentNode = LeafCount - 1 + workIndex;
|
||||
vtkm::Vec<vtkm::Id,2> childVector;
|
||||
while(currentNode != 0)
|
||||
{
|
||||
{
|
||||
currentNode = Parents.Get(currentNode);
|
||||
|
||||
vtkm::Int32 oldCount = Counters.Add(currentNode,1);
|
||||
@ -355,7 +355,7 @@ public:
|
||||
vtkm::Vec<vtkm::Float32,4> first4Vec;// = FlatBVH.Get(currentNode); only this one needs effects this
|
||||
|
||||
first4Vec[0] = xmin.Get(childVector[0]);
|
||||
first4Vec[1] = ymin.Get(childVector[0]);
|
||||
first4Vec[1] = ymin.Get(childVector[0]);
|
||||
first4Vec[2] = zmin.Get(childVector[0]);
|
||||
first4Vec[3] = xmax.Get(childVector[0]);
|
||||
FlatBVH.Set(currentNodeOffset, first4Vec);
|
||||
@ -384,7 +384,7 @@ public:
|
||||
vtkm::Vec<vtkm::Float32,4> second4Vec = FlatBVH.Get(currentNodeOffset+1);
|
||||
second4Vec[0] = vtkm::Max(cSecond4Vec[0], cThird4Vec[2]);
|
||||
second4Vec[1] = vtkm::Max(cSecond4Vec[1], cThird4Vec[3]);
|
||||
|
||||
|
||||
FlatBVH.Set(currentNodeOffset+1, second4Vec);
|
||||
}
|
||||
|
||||
@ -412,7 +412,7 @@ public:
|
||||
|
||||
vtkm::Id child = childVector[1] * 4;
|
||||
|
||||
vtkm::Vec<vtkm::Float32,4> cFirst4Vec = FlatBVH.Get(child);
|
||||
vtkm::Vec<vtkm::Float32,4> cFirst4Vec = FlatBVH.Get(child);
|
||||
vtkm::Vec<vtkm::Float32,4> cSecond4Vec = FlatBVH.Get(child+1);
|
||||
vtkm::Vec<vtkm::Float32,4> cThird4Vec = FlatBVH.Get(child+2);
|
||||
|
||||
@ -426,12 +426,12 @@ public:
|
||||
cThird4Vec[2] = vtkm::Max(cSecond4Vec[0], cThird4Vec[2]);
|
||||
cThird4Vec[3] = vtkm::Max(cSecond4Vec[1], cThird4Vec[3]);
|
||||
FlatBVH.Set(currentNodeOffset+2,cThird4Vec);
|
||||
|
||||
|
||||
}
|
||||
vtkm::Vec<vtkm::Float32,4> fourth4Vec;
|
||||
vtkm::Int32 leftChild = (childVector[0] >= 0) ? childVector[0] * 4 : childVector[0];
|
||||
vtkm::Int32 leftChild = static_cast<vtkm::Int32>((childVector[0] >= 0) ? childVector[0] * 4 : childVector[0]);
|
||||
memcpy(&fourth4Vec[0],&leftChild,4);
|
||||
vtkm::Int32 rightChild = (childVector[1] >= 0) ? childVector[1] * 4 : childVector[1];
|
||||
vtkm::Int32 rightChild = static_cast<vtkm::Int32>((childVector[1] >= 0) ? childVector[1] * 4 : childVector[1]);
|
||||
memcpy(&fourth4Vec[1],&rightChild,4);
|
||||
FlatBVH.Set(currentNodeOffset+3,fourth4Vec);
|
||||
}
|
||||
@ -444,7 +444,7 @@ public:
|
||||
// (1.f / dx),(1.f / dy), (1.f, / dz)
|
||||
vtkm::Vec<vtkm::Float32,3> InverseExtent;
|
||||
vtkm::Vec<vtkm::Float32,3> MinCoordinate;
|
||||
|
||||
|
||||
//expands 10-bit unsigned int into 30 bits
|
||||
VTKM_EXEC_EXPORT
|
||||
vtkm::UInt32 ExpandBits(vtkm::UInt32 x) const
|
||||
@ -458,8 +458,8 @@ public:
|
||||
//Returns 30 bit morton code for coordinates for
|
||||
//coordinates in the unit cude
|
||||
VTKM_EXEC_EXPORT
|
||||
vtkm::UInt32 Morton3D(vtkm::Float32 &x,
|
||||
vtkm::Float32 &y,
|
||||
vtkm::UInt32 Morton3D(vtkm::Float32 &x,
|
||||
vtkm::Float32 &y,
|
||||
vtkm::Float32 &z) const
|
||||
{
|
||||
//take the first 10 bits
|
||||
@ -473,14 +473,14 @@ public:
|
||||
//interleave coordinates
|
||||
return xx * 4 + yy * 2 + zz;
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
VTKM_CONT_EXPORT
|
||||
MortonCodeAABB(const vtkm::Vec<vtkm::Float32,3> &inverseExtent,
|
||||
const vtkm::Vec<vtkm::Float32,3> &minCoordinate)
|
||||
const vtkm::Vec<vtkm::Float32,3> &minCoordinate)
|
||||
: InverseExtent(inverseExtent),
|
||||
MinCoordinate( minCoordinate) {}
|
||||
|
||||
|
||||
typedef void ControlSignature(FieldIn<>,
|
||||
FieldIn<>,
|
||||
FieldIn<>,
|
||||
@ -488,7 +488,7 @@ public:
|
||||
FieldIn<>,
|
||||
FieldIn<>,
|
||||
FieldOut<>);
|
||||
typedef void ExecutionSignature(_1,
|
||||
typedef void ExecutionSignature(_1,
|
||||
_2,
|
||||
_3,
|
||||
_4,
|
||||
@ -518,7 +518,7 @@ public:
|
||||
centroidx *= InverseExtent[0];
|
||||
centroidy *= InverseExtent[1];
|
||||
centroidz *= InverseExtent[2];
|
||||
mortonCode = Morton3D(centroidx, centroidy, centroidz);
|
||||
mortonCode = Morton3D(centroidx, centroidy, centroidz);
|
||||
}
|
||||
}; // class MortonCodeAABB
|
||||
|
||||
@ -535,7 +535,7 @@ public:
|
||||
vtkm::Id LeafCount;
|
||||
vtkm::Id InnerCount;
|
||||
//TODO: get instrinsic support
|
||||
VTKM_EXEC_EXPORT
|
||||
VTKM_EXEC_EXPORT
|
||||
vtkm::Int32 CountLeadingZeros(vtkm::UInt32 &x) const
|
||||
{
|
||||
vtkm::UInt32 y;
|
||||
@ -547,30 +547,30 @@ public:
|
||||
y = x >> 1; if (y != 0) return vtkm::Int32(n - 2);
|
||||
return vtkm::Int32(n - x);
|
||||
}
|
||||
|
||||
|
||||
// returns the count of largest shared prefix between
|
||||
// two morton codes. Ties are broken by the indexes
|
||||
// a and b.
|
||||
//
|
||||
// returns count of the largest binary prefix
|
||||
|
||||
VTKM_EXEC_EXPORT
|
||||
vtkm::Int32 delta(const vtkm::Int32 &a,
|
||||
// returns count of the largest binary prefix
|
||||
|
||||
VTKM_EXEC_EXPORT
|
||||
vtkm::Int32 delta(const vtkm::Int32 &a,
|
||||
const vtkm::Int32 &b) const
|
||||
{
|
||||
bool tie = false;
|
||||
bool outOfRange = (b < 0 || b > LeafCount -1);
|
||||
//still make the call but with a valid adderss
|
||||
vtkm::Int32 bb = (outOfRange) ? 0 : b;
|
||||
vtkm::Int32 bb = (outOfRange) ? 0 : b;
|
||||
vtkm::UInt32 aCode = MortonCodePortal.Get(a);
|
||||
vtkm::UInt32 bCode = MortonCodePortal.Get(bb);
|
||||
//use xor to find where they differ
|
||||
vtkm::UInt32 exOr = aCode ^ bCode;
|
||||
vtkm::UInt32 exOr = aCode ^ bCode;
|
||||
tie = (exOr == 0);
|
||||
//break the tie, a and b must always differ
|
||||
exOr = tie ? vtkm::UInt32(a) ^ vtkm::UInt32(bb) : exOr;
|
||||
//break the tie, a and b must always differ
|
||||
exOr = tie ? vtkm::UInt32(a) ^ vtkm::UInt32(bb) : exOr;
|
||||
vtkm::Int32 count = CountLeadingZeros(exOr);
|
||||
if(tie) count += 32;
|
||||
if(tie) count += 32;
|
||||
count = (outOfRange) ? -1 : count;
|
||||
return count;
|
||||
}
|
||||
@ -587,27 +587,27 @@ public:
|
||||
}
|
||||
typedef void ControlSignature(FieldOut<>,
|
||||
FieldOut<>);
|
||||
typedef void ExecutionSignature(WorkIndex,
|
||||
_1,
|
||||
typedef void ExecutionSignature(WorkIndex,
|
||||
_1,
|
||||
_2);
|
||||
VTKM_EXEC_EXPORT
|
||||
void operator()(const vtkm::Id &index,
|
||||
void operator()(const vtkm::Id &index,
|
||||
vtkm::Id &leftChild,
|
||||
vtkm::Id &rightChild) const
|
||||
{
|
||||
vtkm::Int32 idx = vtkm::Int32(index);
|
||||
//something = MortonCodePortal.Get(index) + 1;
|
||||
//something = MortonCodePortal.Get(index) + 1;
|
||||
//determine range direction
|
||||
vtkm::Int32 d = 0 > (delta(idx, idx + 1) - delta(idx, idx - 1)) ? -1 : 1;
|
||||
|
||||
//find upper bound for the length of the range
|
||||
vtkm::Int32 minDelta = delta(idx, idx - d);
|
||||
vtkm::Int32 lMax = 2;
|
||||
while( delta(idx, idx + lMax * d) > minDelta ) lMax *= 2;
|
||||
while( delta(idx, idx + lMax * d) > minDelta ) lMax *= 2;
|
||||
|
||||
//binary search to find the lower bound
|
||||
vtkm::Int32 l = 0;
|
||||
for(int t = lMax / 2; t >= 1; t/=2)
|
||||
for(int t = lMax / 2; t >= 1; t/=2)
|
||||
{
|
||||
if(delta(idx, idx + (l + t)*d ) > minDelta) l += t;
|
||||
}
|
||||
@ -615,14 +615,14 @@ public:
|
||||
vtkm::Int32 j = idx + l * d;
|
||||
vtkm::Int32 deltaNode = delta(idx,j);
|
||||
vtkm::Int32 s = 0;
|
||||
vtkm::Float32 divFactor = 2.f;
|
||||
vtkm::Float32 divFactor = 2.f;
|
||||
//find the split postition using a binary search
|
||||
for(vtkm::Int32 t = (vtkm::Int32) ceil(vtkm::Float32(l) / divFactor);; divFactor*=2, t = (vtkm::Int32) ceil(vtkm::Float32(l) / divFactor) )
|
||||
{
|
||||
{
|
||||
if(delta(idx, idx + (s + t) * d) > deltaNode)
|
||||
{
|
||||
s += t;
|
||||
}
|
||||
}
|
||||
|
||||
if(t == 1) break;
|
||||
}
|
||||
@ -634,12 +634,12 @@ public:
|
||||
//leaf
|
||||
ParentPortal.Set(split + InnerCount,idx);
|
||||
leftChild = split + InnerCount;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//inner node
|
||||
//inner node
|
||||
ParentPortal.Set(split, idx);
|
||||
leftChild = split;
|
||||
leftChild = split;
|
||||
}
|
||||
|
||||
|
||||
@ -647,32 +647,32 @@ public:
|
||||
{
|
||||
//leaf
|
||||
ParentPortal.Set(split + InnerCount + 1, idx);
|
||||
rightChild = split + InnerCount + 1;
|
||||
}
|
||||
rightChild = split + InnerCount + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ParentPortal.Set(split + 1, idx);
|
||||
rightChild = split + 1;
|
||||
rightChild = split + 1;
|
||||
}
|
||||
}
|
||||
}; // class TreeBuilder
|
||||
|
||||
|
||||
|
||||
public:
|
||||
VTKM_CONT_EXPORT
|
||||
LinearBVHBuilder() {}
|
||||
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
void SortAABBS(BVHData &bvh,
|
||||
vtkm::cont::ArrayHandle< vtkm::Vec<vtkm::Id,4> > &triangleIndices,
|
||||
vtkm::cont::ArrayHandle< vtkm::Vec<vtkm::Int32,4> > &outputTriangleIndices)
|
||||
vtkm::cont::ArrayHandle< vtkm::Vec<vtkm::Int32,4> > &outputTriangleIndices)
|
||||
{
|
||||
//create array of indexes to be sorted with morton codes
|
||||
vtkm::cont::ArrayHandle<vtkm::Id> iterator;
|
||||
iterator.PrepareForOutput( bvh.GetNumberOfPrimitives(), DeviceAdapter() );
|
||||
vtkm::worklet::DispatcherMapField<CountingIterator> iteratorDispatcher;
|
||||
iteratorDispatcher.Invoke(iterator);
|
||||
|
||||
|
||||
/*
|
||||
for(int i = 0; i < bvh.GetNumberOfPrimitives(); i++)
|
||||
{
|
||||
@ -686,21 +686,21 @@ public:
|
||||
<<" "<<bvh.zmaxs->GetPortalControl().Get(i)
|
||||
<<" "<<triangleIndices->GetPortalControl().Get(i)
|
||||
<<" \n";
|
||||
}
|
||||
*/
|
||||
}
|
||||
*/
|
||||
//std::cout<<"\n\n\n";
|
||||
//sort the morton codes
|
||||
|
||||
|
||||
vtkm::cont::DeviceAdapterAlgorithm<DeviceAdapter>::SortByKey(bvh.mortonCodes,
|
||||
iterator);
|
||||
|
||||
|
||||
vtkm::Id arraySize = bvh.GetNumberOfPrimitives();
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> *tempStorage;
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> *tempPtr;
|
||||
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> *tempPtr;
|
||||
|
||||
|
||||
//outputTriangleIndices.Allocate( bvh.GetNumberOfPrimitives() );
|
||||
|
||||
|
||||
tempStorage = new vtkm::cont::ArrayHandle<vtkm::Float32>();
|
||||
//tempStorage->Allocate( arraySize );
|
||||
// for (int i = 0; i < 12; ++i)
|
||||
@ -708,14 +708,14 @@ public:
|
||||
// //std::cout<<bvh.xmins->GetPortalControl().Get(i)<<" ";
|
||||
// }//std::cout<<"\n";
|
||||
//xmins
|
||||
vtkm::worklet::DispatcherMapField<GatherFloat32>( GatherFloat32(*bvh.xmins,
|
||||
vtkm::worklet::DispatcherMapField<GatherFloat32>( GatherFloat32(*bvh.xmins,
|
||||
*tempStorage,
|
||||
arraySize) )
|
||||
.Invoke(iterator);
|
||||
tempPtr = bvh.xmins;
|
||||
bvh.xmins = tempStorage;
|
||||
tempStorage = tempPtr;
|
||||
vtkm::worklet::DispatcherMapField<GatherFloat32>( GatherFloat32(*bvh.ymins,
|
||||
vtkm::worklet::DispatcherMapField<GatherFloat32>( GatherFloat32(*bvh.ymins,
|
||||
*tempStorage,
|
||||
arraySize) )
|
||||
.Invoke(iterator);
|
||||
@ -723,7 +723,7 @@ public:
|
||||
bvh.ymins = tempStorage;
|
||||
tempStorage = tempPtr;
|
||||
//zmins
|
||||
vtkm::worklet::DispatcherMapField<GatherFloat32>( GatherFloat32(*bvh.zmins,
|
||||
vtkm::worklet::DispatcherMapField<GatherFloat32>( GatherFloat32(*bvh.zmins,
|
||||
*tempStorage,
|
||||
arraySize) )
|
||||
.Invoke(iterator);
|
||||
@ -731,7 +731,7 @@ public:
|
||||
bvh.zmins = tempStorage;
|
||||
tempStorage = tempPtr;
|
||||
//xmaxs
|
||||
vtkm::worklet::DispatcherMapField<GatherFloat32>( GatherFloat32(*bvh.xmaxs,
|
||||
vtkm::worklet::DispatcherMapField<GatherFloat32>( GatherFloat32(*bvh.xmaxs,
|
||||
*tempStorage,
|
||||
arraySize) )
|
||||
.Invoke(iterator);
|
||||
@ -739,7 +739,7 @@ public:
|
||||
bvh.xmaxs = tempStorage;
|
||||
tempStorage = tempPtr;
|
||||
//ymaxs
|
||||
vtkm::worklet::DispatcherMapField<GatherFloat32>( GatherFloat32(*bvh.ymaxs,
|
||||
vtkm::worklet::DispatcherMapField<GatherFloat32>( GatherFloat32(*bvh.ymaxs,
|
||||
*tempStorage,
|
||||
arraySize) )
|
||||
.Invoke(iterator);
|
||||
@ -747,7 +747,7 @@ public:
|
||||
bvh.ymaxs = tempStorage;
|
||||
tempStorage = tempPtr;
|
||||
//zmaxs
|
||||
vtkm::worklet::DispatcherMapField<GatherFloat32>( GatherFloat32(*bvh.zmaxs,
|
||||
vtkm::worklet::DispatcherMapField<GatherFloat32>( GatherFloat32(*bvh.zmaxs,
|
||||
*tempStorage,
|
||||
arraySize) )
|
||||
.Invoke(iterator);
|
||||
@ -755,17 +755,17 @@ public:
|
||||
tempPtr = bvh.zmaxs;
|
||||
bvh.zmaxs = tempStorage;
|
||||
tempStorage = tempPtr;
|
||||
vtkm::worklet::DispatcherMapField<GatherVecCast>( GatherVecCast(triangleIndices,
|
||||
vtkm::worklet::DispatcherMapField<GatherVecCast>( GatherVecCast(triangleIndices,
|
||||
outputTriangleIndices,
|
||||
arraySize) )
|
||||
.Invoke(iterator);
|
||||
delete tempStorage;
|
||||
|
||||
|
||||
} // method SortAABBs
|
||||
|
||||
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
void run(vtkm::cont::DynamicArrayHandleCoordinateSystem &coordsHandle,
|
||||
void run(vtkm::cont::DynamicArrayHandleCoordinateSystem &coordsHandle,
|
||||
vtkm::cont::ArrayHandle< vtkm::Vec<vtkm::Id, 4> > &triangleIndices,
|
||||
const vtkm::Id &numberOfTriangles,
|
||||
LinearBVH &linearBVH)
|
||||
@ -783,8 +783,8 @@ public:
|
||||
*bvh.zmaxs,
|
||||
coordsHandle);
|
||||
// Find the extent of all bounding boxes to generate normalization for morton codes
|
||||
vtkm::Vec<vtkm::Float32,3> minExtent(std::numeric_limits<vtkm::Float32>::max(),
|
||||
std::numeric_limits<vtkm::Float32>::max(),
|
||||
vtkm::Vec<vtkm::Float32,3> minExtent(std::numeric_limits<vtkm::Float32>::max(),
|
||||
std::numeric_limits<vtkm::Float32>::max(),
|
||||
std::numeric_limits<vtkm::Float32>::max());
|
||||
vtkm::Vec<vtkm::Float32,3> maxExtent(std::numeric_limits<vtkm::Float32>::min(),
|
||||
std::numeric_limits<vtkm::Float32>::min(),
|
||||
@ -794,7 +794,7 @@ public:
|
||||
MaxValue());
|
||||
maxExtent[1] = vtkm::cont::DeviceAdapterAlgorithm<DeviceAdapter>::Reduce(*bvh.ymaxs,
|
||||
maxExtent[1],
|
||||
MaxValue());
|
||||
MaxValue());
|
||||
maxExtent[2] = vtkm::cont::DeviceAdapterAlgorithm<DeviceAdapter>::Reduce(*bvh.zmaxs,
|
||||
maxExtent[2],
|
||||
MaxValue());
|
||||
@ -803,11 +803,11 @@ public:
|
||||
MinValue());
|
||||
minExtent[1] = vtkm::cont::DeviceAdapterAlgorithm<DeviceAdapter>::Reduce(*bvh.ymins,
|
||||
minExtent[1],
|
||||
MinValue());
|
||||
MinValue());
|
||||
minExtent[2] = vtkm::cont::DeviceAdapterAlgorithm<DeviceAdapter>::Reduce(*bvh.zmins,
|
||||
minExtent[2],
|
||||
MinValue());
|
||||
|
||||
|
||||
vtkm::Vec<vtkm::Float32,3> deltaExtent = maxExtent - minExtent;
|
||||
vtkm::Vec<vtkm::Float32,3> inverseExtent;
|
||||
for (int i = 0; i < 3; ++i)
|
||||
@ -825,28 +825,28 @@ public:
|
||||
*bvh.zmaxs,
|
||||
bvh.mortonCodes);
|
||||
linearBVH.Allocate( bvh.GetNumberOfPrimitives(), DeviceAdapter() );
|
||||
SortAABBS(bvh, triangleIndices, linearBVH.LeafNodes);
|
||||
|
||||
|
||||
SortAABBS(bvh, triangleIndices, linearBVH.LeafNodes);
|
||||
|
||||
|
||||
vtkm::worklet::DispatcherMapField<TreeBuilder>( TreeBuilder(bvh.mortonCodes,
|
||||
bvh.parent,
|
||||
bvh.GetNumberOfPrimitives()) )
|
||||
.Invoke(bvh.leftChild,
|
||||
bvh.rightChild);
|
||||
|
||||
|
||||
const vtkm::Int32 primitiveCount = vtkm::Int32(bvh.GetNumberOfPrimitives());
|
||||
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Int32> counters;
|
||||
counters.PrepareForOutput(bvh.GetNumberOfPrimitives() - 1, DeviceAdapter());
|
||||
vtkm::Int32 zero= 0;
|
||||
vtkm::worklet::DispatcherMapField< MemSet<vtkm::Int32> >( MemSet<vtkm::Int32>(zero) )
|
||||
.Invoke(counters);
|
||||
.Invoke(counters);
|
||||
vtkm::exec::AtomicArray<vtkm::Int32, DeviceAdapter> atomicCounters(counters);
|
||||
|
||||
vtkm::worklet::DispatcherMapField<PropagateAABBs>( PropagateAABBs(bvh.parent,
|
||||
bvh.leftChild,
|
||||
bvh.rightChild,
|
||||
bvh.GetNumberOfPrimitives(),
|
||||
primitiveCount,
|
||||
linearBVH.FlatBVH,
|
||||
atomicCounters ))
|
||||
.Invoke(vtkm::exec::ExecutionWholeArrayConst<vtkm::Float32>(*bvh.xmins),
|
||||
@ -854,8 +854,8 @@ public:
|
||||
vtkm::exec::ExecutionWholeArrayConst<vtkm::Float32>(*bvh.zmins),
|
||||
vtkm::exec::ExecutionWholeArrayConst<vtkm::Float32>(*bvh.xmaxs),
|
||||
vtkm::exec::ExecutionWholeArrayConst<vtkm::Float32>(*bvh.ymaxs),
|
||||
vtkm::exec::ExecutionWholeArrayConst<vtkm::Float32>(*bvh.zmaxs));
|
||||
|
||||
vtkm::exec::ExecutionWholeArrayConst<vtkm::Float32>(*bvh.zmaxs));
|
||||
|
||||
}
|
||||
};// class LinearBVHBuilder
|
||||
}}}// namespace vtkm::rendering::raytracing
|
||||
|
@ -88,8 +88,8 @@ public:
|
||||
if(index >= NumPixels) return;
|
||||
vtkm::Float32 depth = (Proj22 + Proj23 / (-inDepth)) / Proj32;
|
||||
depth = 0.5f * depth + 0.5f;
|
||||
vtkm::Int32 x = index % SubsetWidth;
|
||||
vtkm::Int32 y = index / SubsetWidth;
|
||||
vtkm::Int32 x = static_cast<vtkm::Int32>(index % SubsetWidth);
|
||||
vtkm::Int32 y = static_cast<vtkm::Int32>(index / SubsetWidth);
|
||||
x += Xmin;
|
||||
y += Ymin;
|
||||
vtkm::Id outIdx = vtkm::Id(y * Width + x);
|
||||
@ -586,10 +586,10 @@ private:
|
||||
xmax += .001f;
|
||||
ymin -= .001f;
|
||||
ymax += .001f;
|
||||
xmin = floor(vtkm::Min(vtkm::Max(0.f, xmin),vtkm::Float32(this->Width) ));
|
||||
xmax = ceil(vtkm::Min(vtkm::Max(0.f, xmax),vtkm::Float32(this->Width) ));
|
||||
ymin = floor(vtkm::Min(vtkm::Max(0.f, ymin),vtkm::Float32(this->Height) ));
|
||||
ymax = ceil(vtkm::Min(vtkm::Max(0.f, ymax),vtkm::Float32(this->Height) ));
|
||||
xmin = vtkm::Floor(vtkm::Min(vtkm::Max(0.f, xmin),vtkm::Float32(this->Width) ));
|
||||
xmax = vtkm::Ceil(vtkm::Min(vtkm::Max(0.f, xmax),vtkm::Float32(this->Width) ));
|
||||
ymin = vtkm::Floor(vtkm::Min(vtkm::Max(0.f, ymin),vtkm::Float32(this->Height) ));
|
||||
ymax = vtkm::Ceil(vtkm::Min(vtkm::Max(0.f, ymax),vtkm::Float32(this->Height) ));
|
||||
//printf("Pixel range = (%f,%f,%f), (%f,%f,%f)\n", xmin, ymin,zmin, xmax,ymax,zmax);
|
||||
vtkm::Int32 dx = vtkm::Int32(xmax) - vtkm::Int32(xmin);
|
||||
vtkm::Int32 dy = vtkm::Int32(ymax) - vtkm::Int32(ymin);
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
VTKM_CONT_EXPORT
|
||||
virtual ~RayBase(){}
|
||||
VTKM_CONT_EXPORT
|
||||
virtual void resize(const vtkm::Int32 newSize){}
|
||||
virtual void resize(const vtkm::Int32 vtkmNotUsed(newSize)){}
|
||||
};
|
||||
template<typename DeviceAdapter>
|
||||
class Ray : public RayBase
|
||||
@ -52,11 +52,11 @@ public:
|
||||
vtkm::cont::ArrayHandleCompositeVectorType<vtkm::cont::ArrayHandle<vtkm::Float32>,
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32>,
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> >::type Normal;
|
||||
|
||||
|
||||
vtkm::cont::ArrayHandleCompositeVectorType<vtkm::cont::ArrayHandle<vtkm::Float32>,
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32>,
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> >::type Origin;
|
||||
|
||||
|
||||
vtkm::cont::ArrayHandleCompositeVectorType<vtkm::cont::ArrayHandle<vtkm::Float32>,
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32>,
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> >::type Dir;
|
||||
@ -89,15 +89,15 @@ public:
|
||||
vtkm::Int32 NumRays;
|
||||
VTKM_CONT_EXPORT
|
||||
Ray()
|
||||
{
|
||||
{
|
||||
NumRays = 0;
|
||||
vtkm::IdComponent inComp[3];
|
||||
inComp[0] = 0;
|
||||
inComp[1] = 1;
|
||||
inComp[0] = 0;
|
||||
inComp[1] = 1;
|
||||
inComp[2] = 2;
|
||||
Intersection = vtkm::cont::make_ArrayHandleCompositeVector( IntersectionX, inComp[0],
|
||||
IntersectionY, inComp[1],
|
||||
IntersectionZ, inComp[2]);
|
||||
IntersectionZ, inComp[2]);
|
||||
|
||||
Normal = vtkm::cont::make_ArrayHandleCompositeVector( NormalX, inComp[0],
|
||||
NormalY, inComp[1],
|
||||
@ -140,22 +140,22 @@ public:
|
||||
HitIdx.PrepareForOutput( NumRays , DeviceAdapter() );
|
||||
|
||||
vtkm::IdComponent inComp[3];
|
||||
inComp[0] = 0;
|
||||
inComp[1] = 1;
|
||||
inComp[0] = 0;
|
||||
inComp[1] = 1;
|
||||
inComp[2] = 2;
|
||||
|
||||
Intersection = vtkm::cont::make_ArrayHandleCompositeVector( IntersectionX, inComp[0],
|
||||
IntersectionY, inComp[1],
|
||||
IntersectionZ, inComp[2]);
|
||||
|
||||
IntersectionZ, inComp[2]);
|
||||
|
||||
Normal = vtkm::cont::make_ArrayHandleCompositeVector( NormalX, inComp[0],
|
||||
NormalY, inComp[1],
|
||||
NormalZ, inComp[2]);
|
||||
|
||||
|
||||
Origin = vtkm::cont::make_ArrayHandleCompositeVector( OriginX, inComp[0],
|
||||
OriginY, inComp[1],
|
||||
OriginZ, inComp[2]);
|
||||
|
||||
|
||||
Dir = vtkm::cont::make_ArrayHandleCompositeVector( DirX, inComp[0],
|
||||
DirY, inComp[1],
|
||||
DirZ, inComp[2]);
|
||||
@ -196,7 +196,7 @@ template<typename DeviceAdapter>
|
||||
class VolumeRay : public RayBase
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
vtkm::cont::ArrayHandleCompositeVectorType<vtkm::cont::ArrayHandle<vtkm::Float32>,
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32>,
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> >::type Dir;
|
||||
@ -211,11 +211,11 @@ public:
|
||||
vtkm::Int32 NumRays;
|
||||
VTKM_CONT_EXPORT
|
||||
VolumeRay()
|
||||
{
|
||||
{
|
||||
NumRays = 0;
|
||||
vtkm::IdComponent inComp[3];
|
||||
inComp[0] = 0;
|
||||
inComp[1] = 1;
|
||||
inComp[0] = 0;
|
||||
inComp[1] = 1;
|
||||
inComp[2] = 2;
|
||||
|
||||
Dir = vtkm::cont::make_ArrayHandleCompositeVector( DirX, inComp[0],
|
||||
@ -236,11 +236,11 @@ public:
|
||||
HitIndex.PrepareForOutput( NumRays , DeviceAdapter() );
|
||||
|
||||
vtkm::IdComponent inComp[3];
|
||||
inComp[0] = 0;
|
||||
inComp[1] = 1;
|
||||
inComp[0] = 0;
|
||||
inComp[1] = 1;
|
||||
inComp[2] = 2;
|
||||
|
||||
|
||||
|
||||
Dir = vtkm::cont::make_ArrayHandleCompositeVector( DirX, inComp[0],
|
||||
DirY, inComp[1],
|
||||
DirZ, inComp[2]);
|
||||
|
@ -37,14 +37,14 @@
|
||||
namespace vtkm {
|
||||
namespace rendering{
|
||||
namespace raytracing{
|
||||
|
||||
|
||||
template< typename DeviceAdapter>
|
||||
class VolumeRendererStructured
|
||||
{
|
||||
public:
|
||||
typedef vtkm::cont::ArrayHandle<vtkm::FloatDefault> DefaultHandle;
|
||||
typedef typename vtkm::cont::ArrayHandleCartesianProduct<DefaultHandle,DefaultHandle,DefaultHandle> CartesianArrayHandle;
|
||||
|
||||
|
||||
class Sampler : public vtkm::worklet::WorkletMapField
|
||||
{
|
||||
private:
|
||||
@ -65,7 +65,7 @@ public:
|
||||
UniformConstPortal Coordinates;
|
||||
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint,vtkm::TopologyElementTagCell,3> Conn;
|
||||
public:
|
||||
VTKM_CONT_EXPORT
|
||||
VTKM_CONT_EXPORT
|
||||
Sampler(vtkm::Vec<vtkm::Float32,3> cameraPosition,
|
||||
const ColorArrayHandle &colorMap,
|
||||
const UniformArrayHandle &coordinates,
|
||||
@ -145,7 +145,7 @@ public:
|
||||
//get the initial sample position;
|
||||
vtkm::Float32 currentDistance = minDistance + SampleDistance; //Move the ray forward some epsilon
|
||||
vtkm::Float32 lastSample = maxDistance - SampleDistance;
|
||||
vtkm::Vec<vtkm::Float32,3> sampleLocation = CameraPosition + currentDistance * rayDir;
|
||||
vtkm::Vec<vtkm::Float32,3> sampleLocation = CameraPosition + currentDistance * rayDir;
|
||||
/*
|
||||
7----------6
|
||||
/| /|
|
||||
@ -171,7 +171,7 @@ public:
|
||||
vtkm::Float32 scalar7 = 0.f;
|
||||
|
||||
while(currentDistance < lastSample)
|
||||
{
|
||||
{
|
||||
|
||||
if(sampleLocation[0] < Origin[0] || sampleLocation[0] >= vtkm::Float32(PointDimensions[0] - 1)) return;
|
||||
if(sampleLocation[1] < Origin[1] || sampleLocation[1] >= vtkm::Float32(PointDimensions[1] - 1)) return;
|
||||
@ -179,7 +179,7 @@ public:
|
||||
if( tx > 1.f || tx < 0.f) newCell = true;
|
||||
if( ty > 1.f || ty < 0.f) newCell = true;
|
||||
if( tz > 1.f || tz < 0.f) newCell = true;
|
||||
|
||||
|
||||
if(newCell)
|
||||
{
|
||||
vtkm::Vec<vtkm::Id,8> cellIndices;
|
||||
@ -207,7 +207,7 @@ public:
|
||||
tz = (sampleLocation[2] - bottomLeft[2]) * InvSpacing[2];
|
||||
|
||||
newCell = false;
|
||||
}
|
||||
}
|
||||
|
||||
vtkm::Float32 lerped76 = scalar7 + tx * scalar6minus7;
|
||||
vtkm::Float32 lerped45 = scalar4 + tx * scalar5minus4;
|
||||
@ -225,9 +225,9 @@ public:
|
||||
//colorIndex = vtkm::Min(ColorMapSize, vtkm::Max(0,colorIndex));
|
||||
vtkm::Vec<vtkm::Float32,4> sampleColor = ColorMap.Get(colorIndex);
|
||||
//sampleColor[3] = .05f;
|
||||
|
||||
|
||||
//composite
|
||||
sampleColor[3] *= (1.f - color[3]);
|
||||
sampleColor[3] *= (1.f - color[3]);
|
||||
color[0] = color[0] + sampleColor[0] * sampleColor[3];
|
||||
color[1] = color[1] + sampleColor[1] * sampleColor[3];
|
||||
color[2] = color[2] + sampleColor[2] * sampleColor[3];
|
||||
@ -272,7 +272,7 @@ public:
|
||||
UniformConstPortal Coordinates;
|
||||
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint,vtkm::TopologyElementTagCell,3> Conn;
|
||||
public:
|
||||
VTKM_CONT_EXPORT
|
||||
VTKM_CONT_EXPORT
|
||||
SamplerCellAssoc(vtkm::Vec<vtkm::Float32,3> cameraPosition,
|
||||
const ColorArrayHandle &colorMap,
|
||||
const UniformArrayHandle &coordinates,
|
||||
@ -344,8 +344,8 @@ public:
|
||||
//get the initial sample position;
|
||||
vtkm::Float32 currentDistance = minDistance + 0.001f; //Move the ray forward some epsilon
|
||||
vtkm::Float32 lastSample = maxDistance - 0.001f;
|
||||
vtkm::Vec<vtkm::Float32,3> sampleLocation = CameraPosition + currentDistance * rayDir;
|
||||
|
||||
vtkm::Vec<vtkm::Float32,3> sampleLocation = CameraPosition + currentDistance * rayDir;
|
||||
|
||||
/*
|
||||
7----------6
|
||||
/| /|
|
||||
@ -357,15 +357,15 @@ public:
|
||||
*/
|
||||
bool newCell = true;
|
||||
//check to see if we left the cell
|
||||
vtkm::Float32 deltaTx = SampleDistance * rayDir[0] * InvSpacing[0];
|
||||
vtkm::Float32 deltaTy = SampleDistance * rayDir[1] * InvSpacing[1];
|
||||
vtkm::Float32 deltaTz = SampleDistance * rayDir[2] * InvSpacing[2];
|
||||
// vtkm::Float32 deltaTx = SampleDistance * rayDir[0] * InvSpacing[0];
|
||||
// vtkm::Float32 deltaTy = SampleDistance * rayDir[1] * InvSpacing[1];
|
||||
// vtkm::Float32 deltaTz = SampleDistance * rayDir[2] * InvSpacing[2];
|
||||
vtkm::Float32 tx = 2.f;
|
||||
vtkm::Float32 ty = 2.f;
|
||||
vtkm::Float32 tz = 2.f;
|
||||
vtkm::Float32 scalar0 = 0.f;
|
||||
vtkm::Vec<vtkm::Float32,4> sampleColor;
|
||||
vtkm::Vec<vtkm::Float32,3> bottomLeft;
|
||||
vtkm::Vec<vtkm::Float32,3> bottomLeft;
|
||||
while(currentDistance < lastSample)
|
||||
{
|
||||
if( tx > 1.f ) newCell = true;
|
||||
@ -375,7 +375,7 @@ public:
|
||||
if(newCell)
|
||||
{
|
||||
vtkm::Id cellId;
|
||||
|
||||
|
||||
LocateCellId(sampleLocation, cellId);
|
||||
scalar0 = vtkm::Float32(scalars.Get(cellId));
|
||||
vtkm::Float32 normalScalar = (scalar0 - MinScalar) * InverseDeltaScalar;
|
||||
@ -385,17 +385,17 @@ public:
|
||||
ty = (sampleLocation[1] - bottomLeft[1]) * InvSpacing[1];
|
||||
tz = (sampleLocation[2] - bottomLeft[2]) * InvSpacing[2];
|
||||
newCell = false;
|
||||
}
|
||||
}
|
||||
|
||||
// just repeatably composite
|
||||
vtkm::Float32 alpha = sampleColor[3] * (1.f - color[3]);
|
||||
vtkm::Float32 alpha = sampleColor[3] * (1.f - color[3]);
|
||||
color[0] = color[0] + sampleColor[0] * alpha;
|
||||
color[1] = color[1] + sampleColor[1] * alpha;
|
||||
color[2] = color[2] + sampleColor[2] * alpha;
|
||||
color[3] = alpha + color[3];
|
||||
//advance
|
||||
currentDistance += SampleDistance;
|
||||
|
||||
|
||||
if(color[3] >= 1.f) break;
|
||||
tx = (sampleLocation[0] - bottomLeft[0]) * InvSpacing[0];
|
||||
ty = (sampleLocation[1] - bottomLeft[1]) * InvSpacing[1];
|
||||
@ -423,9 +423,9 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
CartesianConstPortal Coordinates;
|
||||
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint,vtkm::TopologyElementTagCell,3> Conn;
|
||||
DefaultConstHandle CoordPortals[3];
|
||||
|
||||
|
||||
public:
|
||||
VTKM_CONT_EXPORT
|
||||
VTKM_CONT_EXPORT
|
||||
SamplerCellAssocRect(vtkm::Vec<vtkm::Float32,3> cameraPosition,
|
||||
const ColorArrayHandle &colorMap,
|
||||
const CartesianArrayHandle &coordinates,
|
||||
@ -469,7 +469,7 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
LocateCell(vtkm::Vec<vtkm::Id,3> &cell,
|
||||
const vtkm::Vec<vtkm::Float32,3> &point,
|
||||
const vtkm::Vec<vtkm::Float32,3> &rayDir,
|
||||
vtkm::FloatDefault *invSpacing) const
|
||||
vtkm::FloatDefault *invSpacing) const
|
||||
{
|
||||
for(vtkm::Int32 dim = 0; dim < 3; ++dim)
|
||||
{
|
||||
@ -477,8 +477,8 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
vtkm::FloatDefault searchDir = (rayDir[dim] > 0.f) ? vtkm::FloatDefault(1.0) : vtkm::FloatDefault(-1.0);
|
||||
bool notFound = true;
|
||||
while(notFound)
|
||||
{
|
||||
vtkm::Id nextPoint = cell[dim] + searchDir;
|
||||
{
|
||||
vtkm::Id nextPoint = cell[dim] + static_cast<vtkm::Id>(searchDir);
|
||||
bool validPoint = true;
|
||||
if(nextPoint < 0 || nextPoint > PointDimensions[dim]) validPoint = false;
|
||||
if( validPoint && (CoordPortals[dim].Get( nextPoint ) * searchDir < point[dim] * searchDir))
|
||||
@ -513,9 +513,9 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
vtkm::Float32 currentDistance = minDistance + SampleDistance; //Move the ray forward some epsilon
|
||||
vtkm::Float32 lastSample = maxDistance - SampleDistance;
|
||||
vtkm::Vec<vtkm::Float32,3> sampleLocation = CameraPosition + currentDistance * rayDir;
|
||||
vtkm::FloatDefault invSpacing[3];
|
||||
vtkm::FloatDefault invSpacing[3];
|
||||
vtkm::Vec<vtkm::Id,8> cellIndices;
|
||||
/*LocateCell(currentCell,
|
||||
/*LocateCell(currentCell,
|
||||
sampleLocation,
|
||||
rayDir,
|
||||
invSpacing);
|
||||
@ -539,12 +539,12 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
vtkm::Float32 scalar0 = 0.f;
|
||||
|
||||
while(currentDistance < lastSample)
|
||||
{
|
||||
{
|
||||
|
||||
if( tx > 1.f || tx < 0.f) newCell = true;
|
||||
if( ty > 1.f || ty < 0.f) newCell = true;
|
||||
if( tz > 1.f || tz < 0.f) newCell = true;
|
||||
|
||||
|
||||
if(newCell)
|
||||
{
|
||||
|
||||
@ -553,17 +553,17 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
sampleLocation,
|
||||
rayDir,
|
||||
invSpacing);
|
||||
|
||||
|
||||
vtkm::Id cellIdx = (currentCell[2] * (PointDimensions[1]-1) + currentCell[1]) * (PointDimensions[0]-1) + currentCell[0];
|
||||
bottomLeft = Coordinates.Get(cellIdx);
|
||||
scalar0 = vtkm::Float32(scalars.Get(cellIdx));
|
||||
|
||||
|
||||
tx = (sampleLocation[0] - bottomLeft[0]) * invSpacing[0];
|
||||
ty = (sampleLocation[1] - bottomLeft[1]) * invSpacing[1];
|
||||
tz = (sampleLocation[2] - bottomLeft[2]) * invSpacing[2];
|
||||
|
||||
newCell = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//normalize scalar
|
||||
@ -573,9 +573,9 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
colorIndex = vtkm::Min(ColorMapSize, vtkm::Max(vtkm::Id(0),colorIndex));
|
||||
vtkm::Vec<vtkm::Float32,4> sampleColor = ColorMap.Get(colorIndex);
|
||||
//sampleColor[3] = .05f;
|
||||
|
||||
|
||||
//composite
|
||||
sampleColor[3] *= (1.f - color[3]);
|
||||
sampleColor[3] *= (1.f - color[3]);
|
||||
color[0] = color[0] + sampleColor[0] * sampleColor[3];
|
||||
color[1] = color[1] + sampleColor[1] * sampleColor[3];
|
||||
color[2] = color[2] + sampleColor[2] * sampleColor[3];
|
||||
@ -596,7 +596,7 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
}
|
||||
}
|
||||
}; //SamplerCellRect
|
||||
|
||||
|
||||
class SamplerRect : public vtkm::worklet::WorkletMapField
|
||||
{
|
||||
private:
|
||||
@ -614,9 +614,9 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
CartesianConstPortal Coordinates;
|
||||
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint,vtkm::TopologyElementTagCell,3> Conn;
|
||||
DefaultConstHandle CoordPortals[3];
|
||||
|
||||
|
||||
public:
|
||||
VTKM_CONT_EXPORT
|
||||
VTKM_CONT_EXPORT
|
||||
SamplerRect(vtkm::Vec<vtkm::Float32,3> cameraPosition,
|
||||
const ColorArrayHandle &colorMap,
|
||||
const CartesianArrayHandle &coordinates,
|
||||
@ -677,7 +677,7 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
LocateCell(vtkm::Vec<vtkm::Id,3> &cell,
|
||||
const vtkm::Vec<vtkm::Float32,3> &point,
|
||||
const vtkm::Vec<vtkm::Float32,3> &rayDir,
|
||||
vtkm::FloatDefault *invSpacing) const
|
||||
vtkm::FloatDefault *invSpacing) const
|
||||
{
|
||||
for(vtkm::Int32 dim = 0; dim < 3; ++dim)
|
||||
{
|
||||
@ -685,8 +685,8 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
vtkm::FloatDefault searchDir = (rayDir[dim] > 0.f) ? vtkm::FloatDefault(1.0) : vtkm::FloatDefault(-1.0);
|
||||
bool notFound = true;
|
||||
while(notFound)
|
||||
{
|
||||
vtkm::Id nextPoint = cell[dim] + searchDir;
|
||||
{
|
||||
vtkm::Id nextPoint = cell[dim] + static_cast<vtkm::Id>(searchDir);
|
||||
bool validPoint = true;
|
||||
if(nextPoint < 0 || nextPoint > PointDimensions[dim]) validPoint = false;
|
||||
if( validPoint && (CoordPortals[dim].Get( nextPoint ) * searchDir < point[dim] * searchDir))
|
||||
@ -706,7 +706,7 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
const vtkm::Float32 &maxDistance,
|
||||
vtkm::Vec<vtkm::Float32,4> &color,
|
||||
ScalarPortalType &scalars) const
|
||||
{
|
||||
{
|
||||
color[0] = 0.f;
|
||||
color[1] = 0.f;
|
||||
color[2] = 0.f;
|
||||
@ -722,9 +722,9 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
vtkm::Float32 currentDistance = minDistance + SampleDistance; //Move the ray forward some epsilon
|
||||
vtkm::Float32 lastSample = maxDistance - SampleDistance;
|
||||
vtkm::Vec<vtkm::Float32,3> sampleLocation = CameraPosition + currentDistance * rayDir;
|
||||
vtkm::FloatDefault invSpacing[3];
|
||||
vtkm::FloatDefault invSpacing[3];
|
||||
vtkm::Vec<vtkm::Id,8> cellIndices;
|
||||
|
||||
|
||||
/*
|
||||
7----------6
|
||||
/| /|
|
||||
@ -750,11 +750,11 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
vtkm::Float32 scalar7 = 0.f;
|
||||
|
||||
while(currentDistance < lastSample)
|
||||
{
|
||||
{
|
||||
if( tx > 1.f || tx < 0.f) newCell = true;
|
||||
if( ty > 1.f || ty < 0.f) newCell = true;
|
||||
if( tz > 1.f || tz < 0.f) newCell = true;
|
||||
|
||||
|
||||
if(newCell)
|
||||
{
|
||||
|
||||
@ -766,7 +766,7 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
|
||||
GetCellIndices(currentCell, cellIndices);
|
||||
bottomLeft = Coordinates.Get(cellIndices[0]);
|
||||
|
||||
|
||||
scalar0 = vtkm::Float32(scalars.Get(cellIndices[0]));
|
||||
vtkm::Float32 scalar1 = vtkm::Float32(scalars.Get(cellIndices[1]));
|
||||
vtkm::Float32 scalar2 = vtkm::Float32(scalars.Get(cellIndices[2]));
|
||||
@ -787,7 +787,7 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
tz = (sampleLocation[2] - bottomLeft[2]) * invSpacing[2];
|
||||
|
||||
newCell = false;
|
||||
}
|
||||
}
|
||||
|
||||
vtkm::Float32 lerped76 = scalar7 + tx * scalar6minus7;
|
||||
vtkm::Float32 lerped45 = scalar4 + tx * scalar5minus4;
|
||||
@ -804,9 +804,9 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
vtkm::Id colorIndex = vtkm::Id(finalScalar * ColorMapSize);
|
||||
//colorIndex = vtkm::Min(ColorMapSize, vtkm::Max(0,colorIndex));
|
||||
vtkm::Vec<vtkm::Float32,4> sampleColor = ColorMap.Get(colorIndex);
|
||||
|
||||
|
||||
//composite
|
||||
sampleColor[3] *= (1.f - color[3]);
|
||||
sampleColor[3] *= (1.f - color[3]);
|
||||
color[0] = color[0] + sampleColor[0] * sampleColor[3];
|
||||
color[1] = color[1] + sampleColor[1] * sampleColor[3];
|
||||
color[2] = color[2] + sampleColor[2] * sampleColor[3];
|
||||
@ -827,7 +827,7 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
}
|
||||
}
|
||||
}; //SamplerRect
|
||||
|
||||
|
||||
class CalcRayStart : public vtkm::worklet::WorkletMapField
|
||||
{
|
||||
vtkm::Float32 Xmin;
|
||||
@ -851,12 +851,12 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
Zmax = boundingBox[5];
|
||||
}
|
||||
|
||||
VTKM_EXEC_EXPORT
|
||||
VTKM_EXEC_EXPORT
|
||||
vtkm::Float32 rcp(vtkm::Float32 f) const { return 1.0f/f;}
|
||||
|
||||
VTKM_EXEC_EXPORT
|
||||
|
||||
VTKM_EXEC_EXPORT
|
||||
vtkm::Float32 rcp_safe(vtkm::Float32 f) const { return rcp((fabs(f) < 1e-8f) ? 1e-8f : f); }
|
||||
|
||||
|
||||
typedef void ControlSignature(FieldIn<>,
|
||||
FieldOut<>,
|
||||
FieldOut<>);
|
||||
@ -880,8 +880,8 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
vtkm::Float32 odiry = CameraPosition[1] * invDiry;
|
||||
vtkm::Float32 odirz = CameraPosition[2] * invDirz;
|
||||
|
||||
vtkm::Float32 xmin = Xmin * invDirx - odirx;
|
||||
vtkm::Float32 ymin = Ymin * invDiry - odiry;
|
||||
vtkm::Float32 xmin = Xmin * invDirx - odirx;
|
||||
vtkm::Float32 ymin = Ymin * invDiry - odiry;
|
||||
vtkm::Float32 zmin = Zmin * invDirz - odirz;
|
||||
vtkm::Float32 xmax = Xmax * invDirx - odirx;
|
||||
vtkm::Float32 ymax = Ymax * invDiry - odiry;
|
||||
@ -890,11 +890,11 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
|
||||
minDistance = vtkm::Max(vtkm::Max(vtkm::Max(vtkm::Min(ymin,ymax),vtkm::Min(xmin,xmax)),vtkm::Min(zmin,zmax)), 0.f);
|
||||
maxDistance = vtkm::Min(vtkm::Min(vtkm::Max(ymin,ymax),vtkm::Max(xmin,xmax)),vtkm::Max(zmin,zmax));
|
||||
if(maxDistance < minDistance)
|
||||
if(maxDistance < minDistance)
|
||||
{
|
||||
minDistance = -1.f; //flag for miss
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}; //class CalcRayStart
|
||||
@ -907,15 +907,15 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
CompositeBackground(const vtkm::Vec<vtkm::Float32,4> &backgroundColor)
|
||||
: BackgroundColor(backgroundColor)
|
||||
{}
|
||||
|
||||
|
||||
typedef void ControlSignature(FieldInOut<>);
|
||||
typedef void ExecutionSignature(_1);
|
||||
VTKM_EXEC_EXPORT
|
||||
void operator()(vtkm::Vec<vtkm::Float32,4> &color) const
|
||||
{
|
||||
|
||||
|
||||
if(color[3] >= 1.f) return;
|
||||
vtkm::Float32 alpha = BackgroundColor[3] * (1.f - color[3]);
|
||||
vtkm::Float32 alpha = BackgroundColor[3] * (1.f - color[3]);
|
||||
color[0] = color[0] + BackgroundColor[0] * alpha;
|
||||
color[1] = color[1] + BackgroundColor[1] * alpha;
|
||||
color[2] = color[2] + BackgroundColor[2] * alpha;
|
||||
@ -973,7 +973,7 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
void Render(RenderSurfaceRayTracer *surface)
|
||||
{
|
||||
{
|
||||
if(IsSceneDirty)
|
||||
{
|
||||
Init();
|
||||
@ -991,7 +991,7 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
.Invoke( Rays.Dir,
|
||||
Rays.MinDistance,
|
||||
Rays.MaxDistance);
|
||||
bool isSupportedField = (ScalarField->GetAssociation() == vtkm::cont::Field::ASSOC_POINTS ||
|
||||
bool isSupportedField = (ScalarField->GetAssociation() == vtkm::cont::Field::ASSOC_POINTS ||
|
||||
ScalarField->GetAssociation() == vtkm::cont::Field::ASSOC_CELL_SET );
|
||||
if(!isSupportedField) throw vtkm::cont::ErrorControlBadValue("Feild not accociated with cell set or points");
|
||||
bool isAssocPoints = ScalarField->GetAssociation() == vtkm::cont::Field::ASSOC_POINTS;
|
||||
@ -1002,8 +1002,8 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
vertices = Coordinates.Cast<vtkm::cont::ArrayHandleUniformPointCoordinates>();
|
||||
if(isAssocPoints)
|
||||
{
|
||||
vtkm::worklet::DispatcherMapField< Sampler >( Sampler( camera.GetPosition(),
|
||||
ColorMap,
|
||||
vtkm::worklet::DispatcherMapField< Sampler >( Sampler( camera.GetPosition(),
|
||||
ColorMap,
|
||||
vertices,
|
||||
Cellset,
|
||||
vtkm::Float32(ScalarBounds[0]),
|
||||
@ -1017,8 +1017,8 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
}
|
||||
else
|
||||
{
|
||||
vtkm::worklet::DispatcherMapField< SamplerCellAssoc >( SamplerCellAssoc( camera.GetPosition(),
|
||||
ColorMap,
|
||||
vtkm::worklet::DispatcherMapField< SamplerCellAssoc >( SamplerCellAssoc( camera.GetPosition(),
|
||||
ColorMap,
|
||||
vertices,
|
||||
Cellset,
|
||||
vtkm::Float32(ScalarBounds[0]),
|
||||
@ -1038,8 +1038,8 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
vertices = Coordinates.Cast<CartesianArrayHandle>();
|
||||
if(isAssocPoints)
|
||||
{
|
||||
vtkm::worklet::DispatcherMapField< SamplerRect >( SamplerRect( camera.GetPosition(),
|
||||
ColorMap,
|
||||
vtkm::worklet::DispatcherMapField< SamplerRect >( SamplerRect( camera.GetPosition(),
|
||||
ColorMap,
|
||||
vertices,
|
||||
Cellset,
|
||||
vtkm::Float32(ScalarBounds[0]),
|
||||
@ -1053,8 +1053,8 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
}
|
||||
else
|
||||
{
|
||||
vtkm::worklet::DispatcherMapField< SamplerCellAssocRect >( SamplerCellAssocRect( camera.GetPosition(),
|
||||
ColorMap,
|
||||
vtkm::worklet::DispatcherMapField< SamplerCellAssocRect >( SamplerCellAssocRect( camera.GetPosition(),
|
||||
ColorMap,
|
||||
vertices,
|
||||
Cellset,
|
||||
vtkm::Float32(ScalarBounds[0]),
|
||||
@ -1067,18 +1067,18 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
ScalarField->GetData());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
vtkm::worklet::DispatcherMapField< CompositeBackground >( CompositeBackground( BackgroundColor ) )
|
||||
.Invoke( camera.FrameBuffer );
|
||||
|
||||
|
||||
camera.WriteToSurface(surface, Rays.MinDistance);
|
||||
} //Render
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
void SetSampleDistance(const vtkm::Float32 & distance)
|
||||
{
|
||||
if(distance <= 0.f)
|
||||
if(distance <= 0.f)
|
||||
throw vtkm::cont::ErrorControlBadValue("Sample distance must be positive.");
|
||||
SampleDistance = distance;
|
||||
}
|
||||
|
@ -68,12 +68,13 @@ void Set2DView(vtkm::rendering::View &view,
|
||||
vtkm::Float64 coordsBounds[6]; // Xmin,Xmax,Ymin..
|
||||
coords.GetBounds(coordsBounds,VTKM_DEFAULT_DEVICE_ADAPTER_TAG());
|
||||
//set up a default view
|
||||
vtkm::Vec<vtkm::Float32,3> totalExtent;
|
||||
totalExtent[0] = vtkm::Float32(coordsBounds[1] - coordsBounds[0]);
|
||||
totalExtent[1] = vtkm::Float32(coordsBounds[3] - coordsBounds[2]);
|
||||
totalExtent[2] = vtkm::Float32(coordsBounds[5] - coordsBounds[4]);
|
||||
vtkm::Float32 mag = vtkm::Magnitude(totalExtent);
|
||||
vtkm::Normalize(totalExtent);
|
||||
// totalExtent does not seem to be used
|
||||
// vtkm::Vec<vtkm::Float32,3> totalExtent;
|
||||
// totalExtent[0] = vtkm::Float32(coordsBounds[1] - coordsBounds[0]);
|
||||
// totalExtent[1] = vtkm::Float32(coordsBounds[3] - coordsBounds[2]);
|
||||
// totalExtent[2] = vtkm::Float32(coordsBounds[5] - coordsBounds[4]);
|
||||
// vtkm::Float32 mag = vtkm::Magnitude(totalExtent);
|
||||
// vtkm::Normalize(totalExtent);
|
||||
|
||||
view = vtkm::rendering::View(vtkm::rendering::View::VIEW_2D);
|
||||
view.View2d.Left = static_cast<vtkm::Float32>(coordsBounds[0]);
|
||||
|
Loading…
Reference in New Issue
Block a user