Commit 1d819fa6 authored by Alexis Girault's avatar Alexis Girault
Browse files

BUG: add asserts in Renderer constructor

Check that visual geometry exists and that a delegate
has be created.
parent 5d975f59
......@@ -26,6 +26,9 @@
#include "imstkPlane.h"
#include "imstkSphere.h"
#include "imstkCube.h"
#include "imstkSurfaceMesh.h"
#include "imstkVolumetricMesh.h"
#include "imstkCube.h"
#include "imstkPlaneRenderDelegate.h"
#include "imstkSphereRenderDelegate.h"
#include "imstkCubeRenderDelegate.h"
......@@ -43,32 +46,36 @@ RenderDelegate::make_delegate(std::shared_ptr<Geometry>geom)
{
auto plane = std::dynamic_pointer_cast<Plane>(geom);
return std::make_shared<PlaneRenderDelegate>(plane);
break;
}
case GeometryType::Sphere:
{
auto sphere = std::dynamic_pointer_cast<Sphere>(geom);
return std::make_shared<SphereRenderDelegate>(sphere);
break;
}
case GeometryType::Cube:
{
auto cube = std::dynamic_pointer_cast<Cube>(geom);
return std::make_shared<CubeRenderDelegate>(cube);
break;
}
case GeometryType::SurfaceMesh:
{
auto surface = std::dynamic_pointer_cast<SurfaceMesh>(geom);
LOG(WARNING) << "RenderDelegate::make_delegate error: SurfaceMeshRenderDelegate not implemented yet.";
return nullptr;
//return std::make_shared<SurfaceMeshRenderDelegate>(surface);
}
case GeometryType::TetrahedralMesh:
case GeometryType::HexahedralMesh:
{
auto mesh = std::dynamic_pointer_cast<VolumetricMesh>(geom);
LOG(WARNING) << "RenderDelegate::make_delegate error: VolumetricMeshRenderDelegate not implemented yet.";
return nullptr;
//return std::make_shared<VolumetricMeshRenderDelegate>(mesh);
}
default:
{
LOG(WARNING) << "Unknown geometry type.";
LOG(WARNING) << "RenderDelegate::make_delegate error: Geometry type incorrect.";
return nullptr;
break;
}
}
}
......
......@@ -38,7 +38,21 @@ Renderer::Renderer(std::shared_ptr<Scene> scene)
for ( const auto& obj : scene->getSceneObjects() )
{
auto geom = obj->getVisualGeometry();
if (geom == nullptr)
{
LOG(WARNING) << "Renderer::Renderer error: Could not retrieve visual geometry for '"
<< obj->getName() << "'.";
continue;
}
auto delegate = RenderDelegate::make_delegate( geom );
if (delegate == nullptr)
{
LOG(WARNING) << "Renderer::Renderer error: Could not create render delegate for '"
<< obj->getName() << "'.";
continue;
}
m_objectVtkActors.push_back( delegate->getVtkActor() );
}
......
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