Commit ffdb33f7 authored by Larsen, Matthew's avatar Larsen, Matthew
Browse files

follow coding conventions

parent a778af8b
......@@ -185,13 +185,13 @@ public:
if (fieldLength == 0.f)
{
// constant color
InverseFieldDelta = 0.f;
this->InverseFieldDelta = 0.f;
}
else
{
InverseFieldDelta = 1.0f / fieldLength;
this->InverseFieldDelta = 1.0f / fieldLength;
}
Offset = vtkm::Max(0.03f / vtkm::Float32(clippingRange.Length()), 0.0001f);
this->Offset = vtkm::Max(0.03f / vtkm::Float32(clippingRange.Length()), 0.0001f);
}
template <typename CoordinatesPortalType, typename ScalarFieldPortalType>
......@@ -336,10 +336,11 @@ private:
VTKM_EXEC vtkm::Vec4f_32 GetColor(vtkm::Float64 fieldValue) const
{
vtkm::Int32 colorIdx =
vtkm::Int32((vtkm::Float32(fieldValue) - FieldMin) * ColorMapSize * InverseFieldDelta);
colorIdx = vtkm::Min(vtkm::Int32(ColorMap.GetNumberOfValues() - 1), vtkm::Max(0, colorIdx));
return ColorMap.Get(colorIdx);
vtkm::Int32 colorIdx = vtkm::Int32((vtkm::Float32(fieldValue) - FieldMin) * this->ColorMapSize *
this->InverseFieldDelta);
colorIdx =
vtkm::Min(vtkm::Int32(this->ColorMap.GetNumberOfValues() - 1), vtkm::Max(0, colorIdx));
return this->ColorMap.Get(colorIdx);
}
VTKM_EXEC
......
......@@ -370,7 +370,7 @@ class GetScalar : public vtkm::worklet::WorkletMapField
{
private:
Precision MinScalar;
Precision invDeltaScalar;
Precision InvDeltaScalar;
bool Normalize;
public:
......@@ -383,13 +383,13 @@ public:
{
// support the scalar renderer
Normalize = false;
invDeltaScalar = Precision(0.f);
this->InvDeltaScalar = Precision(0.f);
}
else
{
//Make sure the we don't divide by zero on
//something like an iso-surface
invDeltaScalar = 1.f / (maxScalar - MinScalar);
this->InvDeltaScalar = 1.f / (maxScalar - this->MinScalar);
}
}
typedef void ControlSignature(FieldIn, FieldInOut, WholeArrayIn, WholeArrayIn);
......@@ -409,7 +409,7 @@ public:
scalar = Precision(scalars.Get(pointId[0]));
if (Normalize)
{
scalar = (scalar - MinScalar) * invDeltaScalar;
scalar = (scalar - this->MinScalar) * this->InvDeltaScalar;
}
}
}; //class GetScalar
......
......@@ -357,7 +357,7 @@ class GetScalar : public vtkm::worklet::WorkletMapField
{
private:
Precision MinScalar;
Precision invDeltaScalar;
Precision InvDeltaScalar;
bool Normalize;
public:
......@@ -370,13 +370,13 @@ public:
{
// support the scalar renderer
Normalize = false;
invDeltaScalar = Precision(0.f);
this->InvDeltaScalar = Precision(0.f);
}
else
{
//Make sure the we don't divide by zero on
//something like an iso-surface
invDeltaScalar = 1.f / (maxScalar - MinScalar);
this->InvDeltaScalar = 1.f / (maxScalar - MinScalar);
}
}
typedef void ControlSignature(FieldIn, FieldOut, WholeArrayIn, WholeArrayIn);
......@@ -396,7 +396,7 @@ public:
scalar = Precision(scalars.Get(pointId[0]));
if (Normalize)
{
scalar = (scalar - MinScalar) * invDeltaScalar;
scalar = (scalar - MinScalar) * this->InvDeltaScalar;
}
}
}; //class GetScalar
......
......@@ -248,7 +248,7 @@ class GetScalar : public vtkm::worklet::WorkletMapField
{
private:
Precision MinScalar;
Precision invDeltaScalar;
Precision InvDeltaScalar;
bool Normalize;
public:
......@@ -261,13 +261,13 @@ public:
{
// support the scalar renderer
Normalize = false;
invDeltaScalar = Precision(0.f);
this->InvDeltaScalar = Precision(0.f);
}
else
{
//Make sure the we don't divide by zero on
//something like an iso-surface
invDeltaScalar = 1.f / (maxScalar - MinScalar);
this->InvDeltaScalar = 1.f / (maxScalar - this->MinScalar);
}
}
typedef void ControlSignature(FieldIn, FieldOut, WholeArrayIn, WholeArrayIn);
......@@ -286,7 +286,7 @@ public:
scalar = Precision(scalars.Get(pointId));
if (Normalize)
{
scalar = (scalar - MinScalar) * invDeltaScalar;
scalar = (scalar - this->MinScalar) * this->InvDeltaScalar;
}
}
}; //class GetScalar
......
......@@ -242,7 +242,7 @@ public:
{
private:
Precision MinScalar;
Precision invDeltaScalar;
Precision InvDeltaScalar;
bool Normalize;
public:
......@@ -254,18 +254,14 @@ public:
if (minScalar >= maxScalar)
{
// support the scalar renderer
Normalize = false;
MinScalar = 0;
invDeltaScalar = 1;
this->Normalize = false;
this->InvDeltaScalar = 1;
}
else
{
//Make sure the we don't divide by zero on
//something like an iso-surface
if (maxScalar - MinScalar != 0.f)
invDeltaScalar = 1.f / (maxScalar - MinScalar);
else
invDeltaScalar = 1.f / minScalar;
this->InvDeltaScalar = 1.f / (maxScalar - this->MinScalar);
}
}
typedef void ControlSignature(FieldIn,
......@@ -296,7 +292,7 @@ public:
//normalize
if (Normalize)
{
lerpedScalar = (lerpedScalar - MinScalar) * invDeltaScalar;
lerpedScalar = (lerpedScalar - this->MinScalar) * this->InvDeltaScalar;
}
}
}; //class LerpScalar
......@@ -306,7 +302,7 @@ public:
{
private:
Precision MinScalar;
Precision invDeltaScalar;
Precision InvDeltaScalar;
bool Normalize;
public:
......@@ -319,13 +315,13 @@ public:
{
// support the scalar renderer
Normalize = false;
invDeltaScalar = Precision(0.f);
this->InvDeltaScalar = Precision(0.f);
}
else
{
//Make sure the we don't divide by zero on
//something like an iso-surface
invDeltaScalar = 1.f / (maxScalar - MinScalar);
this->InvDeltaScalar = 1.f / (maxScalar - this->MinScalar);
}
}
......@@ -348,7 +344,7 @@ public:
if (Normalize)
{
scalar = (scalar - MinScalar) * invDeltaScalar;
scalar = (scalar - this->MinScalar) * this->InvDeltaScalar;
}
}
}; //class LerpScalar
......
Markdown is supported
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