feat: technique overhaul
This commit is contained in:
1 parent
211a219431
commit
86ec78f831
16 files changed
+221
-143
No files matched your search
@@ -7,6 +7,7 @@
|
||||
#include <vtkRenderer.h>
|
||||
|
||||
#include "layers/Layer.h"
|
||||
#include "layers/Technique.h"
|
||||
|
||||
/** This class manages the upper levels of the vtk pipeline; it has attributes for the vtkrenderWindow and a vector of Layers to represent a variable number of vtkRenderers.
|
||||
* It can also set up a vtkTimer by connecting an instance of TimerCallbackCommand with its contained vtkRenderWindowInteractor.
|
||||
@@ -15,19 +16,19 @@ class Program : public QVTKOpenGLNativeWidget {
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
/** This attribute models a variable number of vtkRenderers, managed through the abstract Layer class.
|
||||
/** This attribute models a variable number of vtkRenderers, managed through the abstract Technique class.
|
||||
*/
|
||||
std::vector<Layer *> layers;
|
||||
std::vector<Technique *> techniques;
|
||||
int activeIdx;
|
||||
|
||||
|
||||
/** The window this program's layers render to.
|
||||
*/
|
||||
// vtkSmartPointer<vtkRenderWindow> win;
|
||||
vtkSmartPointer<vtkGenericOpenGLRenderWindow> win;
|
||||
|
||||
/** The interactor through which the layers can interact with the window.
|
||||
*/
|
||||
vtkSmartPointer<vtkRenderWindowInteractor> interact;
|
||||
// vtkSmartPointer<QVTKInteractor> interact;
|
||||
|
||||
|
||||
/** The camera used by all layers for this program.
|
||||
@@ -53,33 +54,30 @@ public:
|
||||
Program(QWidget *parent = nullptr);
|
||||
~Program() override;
|
||||
|
||||
/** This function adds a new layer (and thus vtkRenderer) to the program.
|
||||
* The layer is expected to set its own position in the vtkRenderWindow layer system.
|
||||
* @param layer : pointer to the layer to add.
|
||||
/** This function adds a new technique to the program.
|
||||
* The technique is expected to manage the layers itself in the vtkRenderWindow layer system.
|
||||
* @param technique : pointer to the technique to add.
|
||||
*/
|
||||
void addLayer(Layer *layer);
|
||||
void addTechnique(Technique *technique);
|
||||
|
||||
/** This function removes a given layer from the vtkRenderWindow and layers vector.
|
||||
* If the given layer is not actually in the program, nothing happens.
|
||||
* @param layer : the layer to removeLayer
|
||||
* @param layer : the layer to removeTechnique
|
||||
*/
|
||||
void removeLayer(Layer *layer);
|
||||
void removeTechnique(Technique *layer);
|
||||
|
||||
/** This function updates the data for the associated layers to the given timestamp.
|
||||
/** This function updates the data for the associated techniques to the given timestamp.
|
||||
* Also updates the renderWindow.
|
||||
* @param t : the timestamp to update the data to.
|
||||
*/
|
||||
void updateData(int t);
|
||||
|
||||
/** This function adds all interactors of each layer to the interactor/window
|
||||
*/
|
||||
void setupInteractions();
|
||||
|
||||
/**
|
||||
* This function renders the vtkRenderWindow for the first time.
|
||||
* Only call this function once!
|
||||
*/
|
||||
void render();
|
||||
// TODO: using an idx to indicate which technique to use is not ideal; use an enum instead? But then the question is where to put it...
|
||||
void setActiveTechnique(int idx);
|
||||
|
||||
|
||||
vtkSmartPointer<vtkCamera> getCamera();
|
||||
|
||||
};
|
||||
|
||||
|
||||