feat: technique overhaul

This commit is contained in:
djaidjai committed 2024-05-26 14:21:06 +02:00
1 parent 211a219431
commit 86ec78f831
16 files changed
+221 -143

No files matched your search

@@ -0,0 +1,50 @@
#include <vtkRenderWindow.h>
#include "Technique.h"
Technique::Technique(vtkSmartPointer<vtkCamera> cam) : cam(cam) {}
void Technique::addLayer(Layer *l) {
l->setCamera(this->cam);
this->layers.push_back(l);
}
void Technique::removeLayer(Layer *l) {
auto it = std::find(this->layers.begin(), this->layers.end(), l);
if (it != this->layers.end()) {
this->layers.erase(it);
}
}
void Technique::updateData(int t) {
for (Layer *l : this->layers) {
l->updateData(t);
}
}
int Technique::numberOfLayers() {
return this->layers.size();
}
void Technique::bind(vtkSmartPointer<vtkRenderWindow> win, vtkSmartPointer<vtkRenderWindowInteractor> intr) {
for (Layer *l : this->layers) {
l->addObservers(intr);
win->AddRenderer(l->getLayer());
}
win->SetNumberOfLayers(this->layers.size());
// win->Render();
}
void Technique::unbind(vtkSmartPointer<vtkRenderWindow> win, vtkSmartPointer<vtkRenderWindowInteractor> intr) {
for (Layer *l : this->layers) {
l->removeObservers(intr);
win->RemoveRenderer(l->getLayer());
}
win->SetNumberOfLayers(0);
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.