spawning points

This commit is contained in:
robin committed 2024-05-03 14:15:27 +02:00
1 parent b83f49b4ad
commit 63892ca363
9 files changed
+123 -5

No files matched your search

+9 -3
View File
@@ -1,8 +1,10 @@
#include <vtkRenderWindow.h>
#include <vtkNew.h>
#include <vtkCallbackCommand.h>
#include <vtkInteractorStyleUser.h>
#include "Program.h"
#include "SpawnPointCallback.h"
void Program::setWinProperties() {
@@ -13,6 +15,8 @@ void Program::setWinProperties() {
this->interact->SetRenderWindow(this->win);
this->interact->Initialize();
vtkNew<vtkInteractorStyleUser> style;
interact->SetInteractorStyle(style);
}
void Program::CallbackFunction(vtkObject* caller, long unsigned int eventId, void* clientData, void* callData) {
@@ -20,7 +24,6 @@ void Program::CallbackFunction(vtkObject* caller, long unsigned int eventId, voi
((Program *)clientData)->win->Render();
}
void Program::setupTimer() {
vtkNew<vtkCallbackCommand> callback;
callback->SetCallback(this->CallbackFunction);
@@ -29,7 +32,6 @@ void Program::setupTimer() {
this->interact->CreateRepeatingTimer(17); // 60 fps == 1000 / 60 == 16.7 ms per frame
}
Program::Program(Layer *bg, Layer *e, Layer *l) : background(bg), euler(e), lagrange(l), win(), interact() {
this->win = vtkSmartPointer<vtkRenderWindow>::New();
this->interact = vtkSmartPointer<vtkRenderWindowInteractor>::New();
@@ -64,7 +66,11 @@ void Program::setLagrange(Layer *l) {
this->win->AddRenderer(l->getLayer());
}
// void Program::addInteractionStyle(vtkInteractorStyle style);
void Program::setLagrangeInteractor(SpawnPointCallback *cb){
interact->AddObserver(vtkCommand::LeftButtonPressEvent, cb);
interact->AddObserver(vtkCommand::LeftButtonReleaseEvent, cb);
interact->AddObserver(vtkCommand::MouseMoveEvent, cb);
}
void Program::render() {
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.