Move all rendering logic to a single RenderingState.
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "LayerInfo.hpp"
|
||||
#include "LayerData.hpp"
|
||||
#include "LayerVisualisation.hpp"
|
||||
#include "Animation.hpp"
|
||||
|
||||
namespace fmri
|
||||
{
|
||||
@@ -15,7 +19,6 @@ namespace fmri
|
||||
* Reset the rendering state
|
||||
*/
|
||||
void reset();
|
||||
void configureRenderingContext();
|
||||
void registerControls();
|
||||
/**
|
||||
* GLUT mouse handler function
|
||||
@@ -28,16 +31,35 @@ namespace fmri
|
||||
* @param x
|
||||
*/
|
||||
void handleKey(unsigned char x);
|
||||
std::string infoLine();
|
||||
/**
|
||||
* GLUT special keyboard handler.
|
||||
* @param key
|
||||
*/
|
||||
void handleSpecialKey(int key);
|
||||
void render(float time) const;
|
||||
|
||||
void loadSimulationData(const std::map<string, LayerInfo> &info, std::vector<std::vector<LayerData>> &&data);
|
||||
|
||||
static RenderingState& instance();
|
||||
|
||||
private:
|
||||
float pos[3];
|
||||
float angle[2];
|
||||
std::array<float, 3> pos;
|
||||
std::array<float, 2> angle;
|
||||
std::map<std::string, LayerInfo> layerInfo;
|
||||
std::vector<std::vector<LayerData>> layerData;
|
||||
std::vector<std::vector<LayerData>>::iterator currentData;
|
||||
std::vector<std::unique_ptr<LayerVisualisation>> layerVisualisations;
|
||||
std::vector<std::unique_ptr<Animation>> interactionAnimations;
|
||||
|
||||
RenderingState() noexcept = default;
|
||||
|
||||
void configureRenderingContext() const;
|
||||
|
||||
void move(unsigned char key);
|
||||
void updateVisualisers();
|
||||
|
||||
std::string infoLine()const;
|
||||
void renderDebugInfo() const;
|
||||
void renderLayerName(const std::string& name) const;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user