vtk-m/vtkm/rendering/Scene.cxx

67 lines
1.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.
//============================================================================
#include <vtkm/rendering/Scene.h>
#include <vector>
2017-05-18 14:29:41 +00:00
namespace vtkm
{
namespace rendering
{
struct Scene::InternalsType
{
std::vector<vtkm::rendering::Actor> Actors;
};
Scene::Scene()
: Internals(new InternalsType)
2017-05-18 14:29:41 +00:00
{
}
2023-06-02 16:36:39 +00:00
void Scene::AddActor(vtkm::rendering::Actor actor)
{
2023-06-01 17:28:49 +00:00
this->Internals->Actors.push_back(std::move(actor));
}
2017-05-18 14:29:41 +00:00
const vtkm::rendering::Actor& Scene::GetActor(vtkm::IdComponent index) const
{
return this->Internals->Actors[static_cast<std::size_t>(index)];
}
vtkm::IdComponent Scene::GetNumberOfActors() const
{
return static_cast<vtkm::IdComponent>(this->Internals->Actors.size());
}
void Scene::Render(vtkm::rendering::Mapper& mapper,
vtkm::rendering::Canvas& canvas,
2017-05-18 14:29:41 +00:00
const vtkm::rendering::Camera& camera) const
{
2023-06-02 16:36:39 +00:00
for (const auto& actor : this->Internals->Actors)
{
actor.Render(mapper, canvas, camera);
}
}
vtkm::Bounds Scene::GetSpatialBounds() const
{
vtkm::Bounds bounds;
2023-06-02 16:36:39 +00:00
for (const auto& actor : this->Internals->Actors)
{
2023-06-02 16:36:39 +00:00
bounds.Include(actor.GetSpatialBounds());
}
return bounds;
}
}
} // namespace vtkm::rendering