mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
use mutable instead of const_cast, remove virtual
This commit is contained in:
parent
86ba9ff31a
commit
0c9573e8d3
@ -22,8 +22,6 @@ WorldAnnotator::WorldAnnotator(const vtkm::rendering::Canvas* canvas)
|
||||
{
|
||||
}
|
||||
|
||||
WorldAnnotator::~WorldAnnotator() {}
|
||||
|
||||
void WorldAnnotator::AddLine(const vtkm::Vec3f_64& point0,
|
||||
const vtkm::Vec3f_64& point1,
|
||||
vtkm::Float32 lineWidth,
|
||||
@ -32,22 +30,18 @@ void WorldAnnotator::AddLine(const vtkm::Vec3f_64& point0,
|
||||
{
|
||||
vtkm::Matrix<vtkm::Float32, 4, 4> transform =
|
||||
vtkm::MatrixMultiply(Canvas->GetProjection(), Canvas->GetModelView());
|
||||
vtkm::rendering::WorldAnnotator* self = const_cast<vtkm::rendering::WorldAnnotator*>(this);
|
||||
LineRenderer renderer(Canvas, transform, &(self->LineBatcher));
|
||||
LineRenderer renderer(Canvas, transform, &(this->LineBatcher));
|
||||
renderer.RenderLine(point0, point1, lineWidth, color);
|
||||
}
|
||||
|
||||
void WorldAnnotator::BeginLineRenderingBatch() const
|
||||
{
|
||||
vtkm::rendering::WorldAnnotator* self = const_cast<vtkm::rendering::WorldAnnotator*>(this);
|
||||
self->LineBatcher = vtkm::rendering::LineRendererBatcher();
|
||||
this->LineBatcher = vtkm::rendering::LineRendererBatcher();
|
||||
}
|
||||
|
||||
void WorldAnnotator::EndLineRenderingBatch() const
|
||||
{
|
||||
vtkm::rendering::WorldAnnotator* self = const_cast<vtkm::rendering::WorldAnnotator*>(this);
|
||||
vtkm::rendering::Canvas* canvas = const_cast<vtkm::rendering::Canvas*>(this->Canvas);
|
||||
self->LineBatcher.Render(canvas);
|
||||
this->LineBatcher.Render(this->Canvas);
|
||||
}
|
||||
|
||||
void WorldAnnotator::AddText(const vtkm::Vec3f_32& origin,
|
||||
|
@ -29,13 +29,11 @@ class VTKM_RENDERING_EXPORT WorldAnnotator
|
||||
public:
|
||||
WorldAnnotator(const vtkm::rendering::Canvas* canvas);
|
||||
|
||||
virtual ~WorldAnnotator();
|
||||
|
||||
virtual void AddLine(const vtkm::Vec3f_64& point0,
|
||||
const vtkm::Vec3f_64& point1,
|
||||
vtkm::Float32 lineWidth,
|
||||
const vtkm::rendering::Color& color,
|
||||
bool inFront = false) const;
|
||||
void AddLine(const vtkm::Vec3f_64& point0,
|
||||
const vtkm::Vec3f_64& point1,
|
||||
vtkm::Float32 lineWidth,
|
||||
const vtkm::rendering::Color& color,
|
||||
bool inFront = false) const;
|
||||
|
||||
VTKM_CONT
|
||||
void AddLine(vtkm::Float64 x0,
|
||||
@ -58,14 +56,14 @@ public:
|
||||
VTKM_CONT
|
||||
void EndLineRenderingBatch() const;
|
||||
|
||||
virtual void AddText(const vtkm::Vec3f_32& origin,
|
||||
const vtkm::Vec3f_32& right,
|
||||
const vtkm::Vec3f_32& up,
|
||||
vtkm::Float32 scale,
|
||||
const vtkm::Vec2f_32& anchor,
|
||||
const vtkm::rendering::Color& color,
|
||||
const std::string& text,
|
||||
const vtkm::Float32 depth = 0.f) const;
|
||||
void AddText(const vtkm::Vec3f_32& origin,
|
||||
const vtkm::Vec3f_32& right,
|
||||
const vtkm::Vec3f_32& up,
|
||||
vtkm::Float32 scale,
|
||||
const vtkm::Vec2f_32& anchor,
|
||||
const vtkm::rendering::Color& color,
|
||||
const std::string& text,
|
||||
const vtkm::Float32 depth = 0.f) const;
|
||||
|
||||
VTKM_CONT
|
||||
void AddText(vtkm::Float32 originX,
|
||||
@ -94,7 +92,7 @@ public:
|
||||
|
||||
private:
|
||||
const vtkm::rendering::Canvas* Canvas;
|
||||
vtkm::rendering::LineRendererBatcher LineBatcher;
|
||||
mutable vtkm::rendering::LineRendererBatcher LineBatcher;
|
||||
};
|
||||
}
|
||||
} //namespace vtkm::rendering
|
||||
|
Loading…
Reference in New Issue
Block a user