vtk-m/vtkm/rendering/Actor.h

128 lines
4.5 KiB
C
Raw Permalink Normal View History

//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
2019-04-15 23:24:21 +00:00
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#ifndef vtk_m_rendering_Actor_h
#define vtk_m_rendering_Actor_h
#include <vtkm/rendering/vtkm_rendering_export.h>
2016-06-02 19:04:01 +00:00
#include <vtkm/rendering/Camera.h>
#include <vtkm/rendering/Canvas.h>
#include <vtkm/rendering/Mapper.h>
#include <memory>
2017-05-18 14:29:41 +00:00
namespace vtkm
{
namespace rendering
{
/// @brief An item to be rendered.
///
/// The `Actor` holds the geometry from a `vtkm::cont::DataSet` as well as other visual
/// properties that define how the geometry should look when it is rendered.
class VTKM_RENDERING_EXPORT Actor
{
public:
2023-11-07 20:52:05 +00:00
Actor(const vtkm::cont::DataSet dataSet,
const std::string coordinateName,
const std::string fieldName);
Actor(const vtkm::cont::DataSet dataSet,
2023-11-07 20:52:05 +00:00
const std::string coordinateName,
const std::string fieldName,
const vtkm::cont::ColorTable& colorTable);
Actor(const vtkm::cont::DataSet dataSet,
2023-11-07 20:52:05 +00:00
const std::string coordinateName,
const std::string fieldName,
const vtkm::rendering::Color& color);
2023-11-07 20:52:05 +00:00
Actor(const vtkm::cont::PartitionedDataSet dataSet,
const std::string coordinateName,
const std::string fieldName);
Actor(const vtkm::cont::PartitionedDataSet dataSet,
2023-11-07 20:52:05 +00:00
const std::string coordinateName,
const std::string fieldName,
const vtkm::cont::ColorTable& colorTable);
Actor(const vtkm::cont::PartitionedDataSet dataSet,
2023-11-07 20:52:05 +00:00
const std::string coordinateName,
const std::string fieldName,
const vtkm::rendering::Color& color);
/// Create an `Actor` object that renders a set of cells positioned by a given coordiante
/// system. A field to apply psudocoloring is also provided. The default colormap is applied.
/// The cells, coordinates, and field are typically pulled from a `vtkm::cont::DataSet` object.
Actor(const vtkm::cont::UnknownCellSet& cells,
const vtkm::cont::CoordinateSystem& coordinates,
const vtkm::cont::Field& scalarField);
/// Create an `Actor` object that renders a set of cells positioned by a given coordiante
/// system. A field to apply psudocoloring is also provided. A color table providing the map
/// from scalar values to colors is also provided.
/// The cells, coordinates, and field are typically pulled from a `vtkm::cont::DataSet` object.
Actor(const vtkm::cont::UnknownCellSet& cells,
const vtkm::cont::CoordinateSystem& coordinates,
2017-05-18 14:29:41 +00:00
const vtkm::cont::Field& scalarField,
const vtkm::cont::ColorTable& colorTable);
/// Create an `Actor` object that renders a set of cells positioned by a given coordiante
/// system. A constant color to apply to the object is also provided.
/// The cells and coordinates are typically pulled from a `vtkm::cont::DataSet` object.
// Why do you have to provide a `Field` if a constant color is provided?
Actor(const vtkm::cont::UnknownCellSet& cells,
const vtkm::cont::CoordinateSystem& coordinates,
const vtkm::cont::Field& scalarField,
const vtkm::rendering::Color& color);
Actor(const Actor&);
Actor& operator=(const Actor&);
2023-06-01 17:28:49 +00:00
Actor(Actor&&) noexcept;
Actor& operator=(Actor&&) noexcept;
~Actor();
void Render(vtkm::rendering::Mapper& mapper,
vtkm::rendering::Canvas& canvas,
2017-05-18 14:29:41 +00:00
const vtkm::rendering::Camera& camera) const;
const vtkm::cont::UnknownCellSet& GetCells() const;
2023-11-08 00:31:57 +00:00
vtkm::cont::CoordinateSystem GetCoordinates() const;
2017-05-18 14:29:41 +00:00
const vtkm::cont::Field& GetScalarField() const;
const vtkm::cont::ColorTable& GetColorTable() const;
2017-05-18 14:29:41 +00:00
const vtkm::Range& GetScalarRange() const;
2017-05-18 14:29:41 +00:00
const vtkm::Bounds& GetSpatialBounds() const;
/// @brief Specifies the range for psudocoloring.
///
/// When coloring data by mapping a scalar field to colors, this is the range used for
/// the colors provided by the table. If a range is not provided, the range of data in the
/// field is used.
2017-05-18 14:29:41 +00:00
void SetScalarRange(const vtkm::Range& scalarRange);
private:
struct InternalsType;
2023-06-01 17:28:49 +00:00
std::unique_ptr<InternalsType> Internals;
void Init(const vtkm::cont::CoordinateSystem& coordinates, const vtkm::cont::Field& scalarField);
void Init();
};
2017-05-18 14:29:41 +00:00
}
} //namespace vtkm::rendering
#endif //vtk_m_rendering_Actor_h