Restore layer names.
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
#include <GL/gl.h>
|
||||
#include "LayerVisualisation.hpp"
|
||||
#include "Range.hpp"
|
||||
#include "utils.hpp"
|
||||
#include "RenderingState.hpp"
|
||||
#include "glutils.hpp"
|
||||
|
||||
const std::vector<float> &fmri::LayerVisualisation::nodePositions() const
|
||||
{
|
||||
@@ -31,6 +33,21 @@ float fmri::LayerVisualisation::getAlpha()
|
||||
return RenderingState::instance().layerAlpha();
|
||||
}
|
||||
|
||||
void fmri::LayerVisualisation::setupLayerName(std::string_view name, fmri::LayerInfo::Type type)
|
||||
{
|
||||
displayName = name;
|
||||
displayName += ": ";
|
||||
displayName += LayerInfo::nameByType(type);
|
||||
}
|
||||
|
||||
void fmri::LayerVisualisation::drawLayerName() const
|
||||
{
|
||||
glColor3f(0.5, 0.5, 0.5);
|
||||
renderText(displayName);
|
||||
|
||||
glTranslatef(0, 0, -10);
|
||||
}
|
||||
|
||||
template<>
|
||||
void fmri::LayerVisualisation::initNodePositions<fmri::LayerVisualisation::Ordering::SQUARE>(size_t n, float spacing)
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <vector>
|
||||
#include "utils.hpp"
|
||||
#include "Drawable.hpp"
|
||||
#include "LayerInfo.hpp"
|
||||
|
||||
namespace fmri
|
||||
{
|
||||
@@ -20,14 +21,15 @@ namespace fmri
|
||||
virtual ~LayerVisualisation() = default;
|
||||
|
||||
virtual const std::vector<float>& nodePositions() const;
|
||||
|
||||
protected:
|
||||
float getAlpha() override;
|
||||
void drawLayerName() const;
|
||||
void setupLayerName(std::string_view name, LayerInfo::Type type);
|
||||
|
||||
protected:
|
||||
std::vector<float> nodePositions_;
|
||||
std::string displayName;
|
||||
|
||||
template<Ordering Order>
|
||||
void initNodePositions(size_t n, float spacing);
|
||||
float getAlpha() override;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -322,8 +322,7 @@ void RenderingState::drawLayer(float time, unsigned long i) const
|
||||
|
||||
auto& layer = currentData->at(i);
|
||||
|
||||
// TODO: make names available again.
|
||||
// renderLayerName(currentData->at(i).name());
|
||||
layer.first->drawLayerName();
|
||||
if (options.renderLayers) {
|
||||
layer.first->draw(time);
|
||||
}
|
||||
@@ -362,17 +361,6 @@ void RenderingState::renderOverlayText() const
|
||||
restorePerspectiveProjection();
|
||||
}
|
||||
|
||||
void RenderingState::renderLayerName(const std::string &name) const
|
||||
{
|
||||
glColor3f(0.5, 0.5, 0.5);
|
||||
auto layerName = name;
|
||||
layerName += ": ";
|
||||
//layerName += LayerInfo::nameByType(layerInfo.at(name).type());
|
||||
renderText(layerName);
|
||||
|
||||
glTranslatef(0, 0, -10);
|
||||
}
|
||||
|
||||
void RenderingState::handleSpecialKey(int key)
|
||||
{
|
||||
if (isLoading()) {
|
||||
|
||||
@@ -89,7 +89,6 @@ namespace fmri
|
||||
|
||||
std::string debugInfo() const;
|
||||
void renderOverlayText() const;
|
||||
void renderLayerName(const std::string& name) const;
|
||||
|
||||
void drawLayer(float time, unsigned long i) const;
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ static EntryList deduplicate(const EntryList& entries)
|
||||
return result;
|
||||
}
|
||||
|
||||
fmri::LayerVisualisation *fmri::getVisualisationForLayer(const fmri::LayerData &data, const fmri::LayerInfo &info)
|
||||
static fmri::LayerVisualisation *getAppropriateLayer(const fmri::LayerData &data, const fmri::LayerInfo &info)
|
||||
{
|
||||
switch (info.type()) {
|
||||
case LayerInfo::Type::Input:
|
||||
@@ -91,6 +91,14 @@ fmri::LayerVisualisation *fmri::getVisualisationForLayer(const fmri::LayerData &
|
||||
}
|
||||
}
|
||||
|
||||
fmri::LayerVisualisation *fmri::getVisualisationForLayer(const fmri::LayerData &data, const fmri::LayerInfo &info)
|
||||
{
|
||||
auto layer = getAppropriateLayer(data, info);
|
||||
layer->setupLayerName(data.name(), info.type());
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
static Animation *getFullyConnectedAnimation(const fmri::LayerData &prevState, const fmri::LayerInfo &layer,
|
||||
const vector<float> &prevPositions, const vector<float> &curPositions)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user