@@ -115,10 +115,6 @@ Viewer::Viewer(const std::string &ipAddress,
115115
116116 startServer ();
117117}
118- void
119- Viewer::setSceneName (const std::string &scene_name) {
120- mCurrentSceneName = scene_name;
121- }
122118
123119Viewer::~Viewer () {
124120 stopServer ();
@@ -134,6 +130,53 @@ Viewer::~Viewer() {
134130 pnanovdb_compiler_free (&mEditor .compiler );
135131}
136132
133+ void
134+ Viewer::reset () {
135+ mEditor .editor .reset (&mEditor .editor );
136+
137+ mCameraViews .clear ();
138+ mSplat3dViews .clear ();
139+ }
140+
141+ void
142+ Viewer::addScene (const std::string &scene_name) {
143+ pnanovdb_camera_init (&mEditor .camera );
144+ updateCamera (scene_name);
145+ }
146+
147+ void
148+ Viewer::removeScene (const std::string &scene_name) {
149+ pnanovdb_editor_token_t *sceneToken = mEditor .editor .get_token (scene_name.c_str ());
150+ mEditor .editor .remove (&mEditor .editor , sceneToken, nullptr );
151+
152+ // Erase all camera views belonging to the removed scene
153+ for (auto it = mCameraViews .begin (); it != mCameraViews .end ();) {
154+ if (it->second .mSceneToken == sceneToken) {
155+ it = mCameraViews .erase (it);
156+ } else {
157+ ++it;
158+ }
159+ }
160+ // Erase all splat 3d views belonging to the removed scene
161+ for (auto it = mSplat3dViews .begin (); it != mSplat3dViews .end ();) {
162+ if (it->second .mSceneToken == sceneToken) {
163+ it = mSplat3dViews .erase (it);
164+ } else {
165+ ++it;
166+ }
167+ }
168+ }
169+
170+ void
171+ Viewer::removeView (const std::string &scene_name, const std::string &name) {
172+ pnanovdb_editor_token_t *sceneToken = mEditor .editor .get_token (scene_name.c_str ());
173+ pnanovdb_editor_token_t *viewToken = mEditor .editor .get_token (name.c_str ());
174+ mEditor .editor .remove (&mEditor .editor , sceneToken, viewToken);
175+
176+ mCameraViews .erase (name);
177+ mSplat3dViews .erase (name);
178+ }
179+
137180fvdb::detail::viewer::GaussianSplat3dView &
138181Viewer::addGaussianSplat3dView (const std::string &scene_name,
139182 const std::string &name,
0 commit comments