2016-02-09 13:59:26 +00:00
|
|
|
//============================================================================
|
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.txt for details.
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
// Copyright 2015 Sandia Corporation.
|
|
|
|
// Copyright 2015 UT-Battelle, LLC.
|
|
|
|
// Copyright 2015 Los Alamos National Security.
|
|
|
|
//
|
|
|
|
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
|
|
|
// the U.S. Government retains certain rights in this software.
|
|
|
|
//
|
|
|
|
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
|
|
|
|
// Laboratory (LANL), the U.S. Government retains certain rights in
|
|
|
|
// this software.
|
|
|
|
//============================================================================
|
|
|
|
#ifndef vtk_m_rendering_Scene_h
|
|
|
|
#define vtk_m_rendering_Scene_h
|
|
|
|
|
2016-06-02 19:04:01 +00:00
|
|
|
#include <vtkm/rendering/Camera.h>
|
2016-02-09 13:59:26 +00:00
|
|
|
#include <vtkm/rendering/Plot.h>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace vtkm {
|
|
|
|
namespace rendering {
|
|
|
|
|
|
|
|
class Scene
|
|
|
|
{
|
|
|
|
public:
|
2016-05-24 20:46:12 +00:00
|
|
|
std::vector<vtkm::rendering::Plot> Plots;
|
2016-02-09 13:59:26 +00:00
|
|
|
|
2016-06-01 17:51:37 +00:00
|
|
|
Scene() {}
|
2016-04-07 23:40:04 +00:00
|
|
|
|
2016-06-02 19:41:14 +00:00
|
|
|
template<typename MapperType, typename SurfaceType>
|
2016-05-24 20:46:12 +00:00
|
|
|
VTKM_CONT_EXPORT
|
2016-06-02 19:41:14 +00:00
|
|
|
void Render(MapperType &mapper,
|
2016-05-24 20:46:12 +00:00
|
|
|
SurfaceType &surface,
|
2016-06-02 19:04:01 +00:00
|
|
|
vtkm::rendering::Camera &camera)
|
2016-05-24 20:46:12 +00:00
|
|
|
{
|
2016-05-26 23:04:35 +00:00
|
|
|
vtkm::Bounds bounds;
|
2016-04-15 19:24:23 +00:00
|
|
|
|
2016-06-02 19:41:14 +00:00
|
|
|
mapper.StartScene();
|
2016-05-24 20:46:12 +00:00
|
|
|
for (std::size_t i = 0; i < this->Plots.size(); i++)
|
|
|
|
{
|
2016-06-02 19:41:14 +00:00
|
|
|
this->Plots[i].Render(mapper, surface, camera);
|
2016-04-15 19:24:23 +00:00
|
|
|
|
2016-05-24 20:46:12 +00:00
|
|
|
// accumulate all Plots' spatial bounds into the scene spatial bounds
|
2016-05-26 23:04:35 +00:00
|
|
|
bounds.Include(this->Plots[i].SpatialBounds);
|
2016-02-09 13:59:26 +00:00
|
|
|
}
|
2016-06-02 19:41:14 +00:00
|
|
|
mapper.EndScene();
|
2016-05-26 23:04:35 +00:00
|
|
|
|
|
|
|
this->SpatialBounds = bounds;
|
2016-05-24 20:46:12 +00:00
|
|
|
}
|
2016-04-15 19:24:23 +00:00
|
|
|
|
2016-05-26 23:04:35 +00:00
|
|
|
const vtkm::Bounds &GetSpatialBounds()
|
2016-05-24 20:46:12 +00:00
|
|
|
{
|
|
|
|
return this->SpatialBounds;
|
|
|
|
}
|
2016-04-15 19:24:23 +00:00
|
|
|
|
|
|
|
protected:
|
2016-05-26 23:04:35 +00:00
|
|
|
vtkm::Bounds SpatialBounds;
|
2016-02-09 13:59:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}} //namespace vtkm::rendering
|
|
|
|
|
|
|
|
#endif //vtk_m_rendering_Scene_h
|