Skip to content
Snippets Groups Projects
Commit 85c98747 authored by Jaswant Panchumarti (Kitware)'s avatar Jaswant Panchumarti (Kitware) Committed by Jaswant Panchumarti (Kitware)
Browse files

Add resetCamera method in vtkWasmSceneManager

parent 3192cd9d
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,7 @@
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkRenderer.h"
VTK_ABI_NAMESPACE_BEGIN
//-------------------------------------------------------------------------------
......@@ -52,6 +53,18 @@ bool vtkWasmSceneManager::Render(vtkTypeUInt32 identifier)
return false;
}
//-------------------------------------------------------------------------------
bool vtkWasmSceneManager::ResetCamera(vtkTypeUInt32 identifier)
{
auto object = this->GetObjectAtId(identifier);
if (auto renderer = vtkRenderer::SafeDownCast(object))
{
renderer->ResetCamera();
return true;
}
return false;
}
//-------------------------------------------------------------------------------
bool vtkWasmSceneManager::StartEventLoop(vtkTypeUInt32 identifier)
{
......
......@@ -33,7 +33,7 @@ public:
* Set the size of the `vtkRenderWindow` object at `identifier` to
* the supplied dimesions.
*
* Returns `true` if the obejct at `identifier` is a `vtkRenderWindow`
* Returns `true` if the object at `identifier` is a `vtkRenderWindow`
* with a `vtkRenderWindowInteractor` attached to it,
* `false` otherwise.
*/
......@@ -42,15 +42,23 @@ public:
/**
* Render the `vtkRenderWindow` object at `identifier`.
*
* Returns `true` if the obejct at `identifier` is a `vtkRenderWindow`
* Returns `true` if the object at `identifier` is a `vtkRenderWindow`
* `false` otherwise.
*/
bool Render(vtkTypeUInt32 identifier);
/**
* Reset the active camera of the `vtkRenderer` object at `identifier`.
*
* Returns `true` if the object at `identifier` is a `vtkRenderer`
* `false` otherwise.
*/
bool ResetCamera(vtkTypeUInt32 identifier);
/**
* Start event loop of the `vtkRenderWindowInteractor` object at `identifier`.
*
* Returns `true` if the obejct at `identifier` is a `vtkRenderWindowInteractor`
* Returns `true` if the object at `identifier` is a `vtkRenderWindowInteractor`
* `false` otherwise.
*/
bool StartEventLoop(vtkTypeUInt32 identifier);
......@@ -58,7 +66,7 @@ public:
/**
* Stop event loop of the `vtkRenderWindowInteractor` object at `identifier`.
*
* Returns `true` if the obejct at `identifier` is a `vtkRenderWindowInteractor`
* Returns `true` if the object at `identifier` is a `vtkRenderWindowInteractor`
* `false` otherwise.
*/
bool StopEventLoop(vtkTypeUInt32 identifier);
......
......@@ -177,6 +177,13 @@ bool render(vtkTypeUInt32 identifier)
return Manager->Render(identifier);
}
//-------------------------------------------------------------------------------
bool resetCamera(vtkTypeUInt32 identifier)
{
CHECK_INIT;
return Manager->ResetCamera(identifier);
}
//-------------------------------------------------------------------------------
bool startEventLoop(vtkTypeUInt32 identifier)
{
......@@ -249,6 +256,7 @@ EMSCRIPTEN_BINDINGS(vtkWasmSceneManager)
function("setSize", ::setSize);
function("render", ::render);
function("resetCamera", ::resetCamera);
function("startEventLoop", ::startEventLoop);
function("stopEventLoop", ::stopEventLoop);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment