Extract animation base class.
Skips some complicated computations, so yay.
This commit is contained in:
@@ -33,7 +33,7 @@ ActivityAnimation::ActivityAnimation(std::size_t count, const float *aPos, const
|
||||
}
|
||||
}
|
||||
|
||||
void ActivityAnimation::draw(float timeScale) const
|
||||
void ActivityAnimation::draw(float timeScale)
|
||||
{
|
||||
std::unique_ptr<float[]> vertexBuffer(new float[bufferLength]);
|
||||
|
||||
|
||||
@@ -3,14 +3,16 @@
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "Animation.hpp"
|
||||
|
||||
namespace fmri
|
||||
{
|
||||
class ActivityAnimation
|
||||
: public Animation
|
||||
{
|
||||
public:
|
||||
ActivityAnimation(std::size_t count, const float* aPos, const float* bPos, const float xDist);
|
||||
void draw(float timeScale) const;
|
||||
void draw(float timeScale) override;
|
||||
|
||||
private:
|
||||
std::size_t bufferLength;
|
||||
|
||||
5
src/Animation.cpp
Normal file
5
src/Animation.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
//
|
||||
// Created by bert on 13/02/18.
|
||||
//
|
||||
|
||||
#include "Animation.hpp"
|
||||
14
src/Animation.hpp
Normal file
14
src/Animation.hpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
namespace fmri
|
||||
{
|
||||
class Animation
|
||||
{
|
||||
public:
|
||||
virtual ~Animation() = default;
|
||||
|
||||
virtual void draw(float step) = 0;
|
||||
|
||||
};
|
||||
}
|
||||
@@ -12,7 +12,6 @@
|
||||
#include "camera.hpp"
|
||||
#include "LayerVisualisation.hpp"
|
||||
#include "Range.hpp"
|
||||
#include "ActivityAnimation.hpp"
|
||||
#include "visualisations.hpp"
|
||||
|
||||
using namespace std;
|
||||
@@ -25,7 +24,7 @@ struct
|
||||
vector<vector<LayerData>> data;
|
||||
vector<vector<LayerData>>::iterator currentData;
|
||||
vector<unique_ptr<LayerVisualisation>> layerVisualisations;
|
||||
vector<unique_ptr<ActivityAnimation>> animations;
|
||||
vector<unique_ptr<Animation>> animations;
|
||||
float animationStep = 0;
|
||||
} rendererData;
|
||||
|
||||
|
||||
@@ -158,9 +158,10 @@ namespace fmri
|
||||
std::default_random_engine& rng();
|
||||
|
||||
/**
|
||||
* Get the current animation offset for a particular animation.
|
||||
*
|
||||
* @tparam Duration Duration type of length
|
||||
* @param length
|
||||
* @tparam Duration Duration type of length. Should be a specialisation of std::chrono::duration
|
||||
* @param length The length of the animation.
|
||||
* @return
|
||||
*/
|
||||
template<class Duration>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "MultiImageVisualisation.hpp"
|
||||
#include "FlatLayerVisualisation.hpp"
|
||||
#include "Range.hpp"
|
||||
#include "ActivityAnimation.hpp"
|
||||
|
||||
using namespace fmri;
|
||||
using namespace std;
|
||||
@@ -56,9 +57,9 @@ computeActivityStrengths(const LayerData &prevState, const LayerInfo &layer)
|
||||
return result;
|
||||
}
|
||||
|
||||
fmri::ActivityAnimation *fmri::getActivityAnimation(const fmri::LayerData &prevState, const fmri::LayerData &curState,
|
||||
const fmri::LayerInfo &layer, const vector<float> &prevPositions,
|
||||
const vector<float> &curPositions)
|
||||
Animation * fmri::getActivityAnimation(const fmri::LayerData &prevState, const fmri::LayerData &curState,
|
||||
const fmri::LayerInfo &layer, const vector<float> &prevPositions,
|
||||
const vector<float> &curPositions)
|
||||
{
|
||||
if (layer.type() != LayerInfo::Type::InnerProduct) {
|
||||
// Only supported type at this time
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "LayerVisualisation.hpp"
|
||||
#include "LayerData.hpp"
|
||||
#include "ActivityAnimation.hpp"
|
||||
#include "Animation.hpp"
|
||||
#include "LayerInfo.hpp"
|
||||
|
||||
namespace fmri {
|
||||
@@ -14,7 +14,7 @@ namespace fmri {
|
||||
*/
|
||||
LayerVisualisation* getVisualisationForLayer(const LayerData& layer);
|
||||
|
||||
ActivityAnimation *getActivityAnimation(const fmri::LayerData &prevState, const fmri::LayerData &curState,
|
||||
const fmri::LayerInfo &layer, const vector<float> &prevPositions,
|
||||
const vector<float> &curPositions);
|
||||
Animation * getActivityAnimation(const fmri::LayerData &prevState, const fmri::LayerData &curState,
|
||||
const fmri::LayerInfo &layer, const vector<float> &prevPositions,
|
||||
const vector<float> &curPositions);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user