Separate drawing interactions and interaction paths.
This commit is contained in:
@@ -60,10 +60,14 @@ void ActivityAnimation::draw(float timeScale)
|
|||||||
glVertexPointer(3, GL_FLOAT, 0, vertexBuffer.data());
|
glVertexPointer(3, GL_FLOAT, 0, vertexBuffer.data());
|
||||||
glDrawArrays(GL_POINTS, 0, bufferLength / 3);
|
glDrawArrays(GL_POINTS, 0, bufferLength / 3);
|
||||||
glDisableClientState(GL_COLOR_ARRAY);
|
glDisableClientState(GL_COLOR_ARRAY);
|
||||||
if (RenderingState::instance().renderInteractionPaths()) {
|
glDisableClientState(GL_VERTEX_ARRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ActivityAnimation::drawPaths()
|
||||||
|
{
|
||||||
|
glEnableClientState(GL_VERTEX_ARRAY);
|
||||||
setGlColor(RenderingState::instance().pathColor());
|
setGlColor(RenderingState::instance().pathColor());
|
||||||
glVertexPointer(3, GL_FLOAT, 0, startingPos.data());
|
glVertexPointer(3, GL_FLOAT, 0, startingPos.data());
|
||||||
glDrawElements(GL_LINES, lineIndices.size(), GL_UNSIGNED_INT, lineIndices.data());
|
glDrawElements(GL_LINES, lineIndices.size(), GL_UNSIGNED_INT, lineIndices.data());
|
||||||
}
|
|
||||||
glDisableClientState(GL_VERTEX_ARRAY);
|
glDisableClientState(GL_VERTEX_ARRAY);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,10 +18,9 @@ namespace fmri
|
|||||||
ActivityAnimation(
|
ActivityAnimation(
|
||||||
const std::vector<std::pair<DType, std::pair<std::size_t, std::size_t>>> &interactions,
|
const std::vector<std::pair<DType, std::pair<std::size_t, std::size_t>>> &interactions,
|
||||||
const float *aPositions, const float *bPositions);
|
const float *aPositions, const float *bPositions);
|
||||||
ActivityAnimation(
|
|
||||||
const std::vector<std::pair<DType, std::pair<std::size_t, std::size_t>>> &interactions,
|
|
||||||
const float *aPositions, const float *bPositions, ColoringFunction coloring);
|
|
||||||
void draw(float timeScale) override;
|
void draw(float timeScale) override;
|
||||||
|
void drawPaths() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::size_t bufferLength;
|
std::size_t bufferLength;
|
||||||
|
|||||||
@@ -5,3 +5,8 @@ float fmri::Animation::getAlpha()
|
|||||||
{
|
{
|
||||||
return fmri::RenderingState::instance().interactionAlpha();
|
return fmri::RenderingState::instance().interactionAlpha();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void fmri::Animation::drawPaths()
|
||||||
|
{
|
||||||
|
// Default implementation does nothing.
|
||||||
|
}
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ namespace fmri
|
|||||||
public:
|
public:
|
||||||
virtual ~Animation() = default;
|
virtual ~Animation() = default;
|
||||||
|
|
||||||
|
virtual void drawPaths();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
float getAlpha() override;
|
float getAlpha() override;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,14 +7,6 @@ using namespace fmri;
|
|||||||
|
|
||||||
void LabelVisualisation::draw(float)
|
void LabelVisualisation::draw(float)
|
||||||
{
|
{
|
||||||
if (RenderingState::instance().renderInteractionPaths()) {
|
|
||||||
setGlColor(RenderingState::instance().pathColor());
|
|
||||||
glEnableClientState(GL_VERTEX_ARRAY);
|
|
||||||
glVertexPointer(3, GL_FLOAT, 0, nodePositions_.data());
|
|
||||||
glDrawElements(GL_LINES, nodeIndices.size(), GL_UNSIGNED_INT, nodeIndices.data());
|
|
||||||
glDisableClientState(GL_VERTEX_ARRAY);
|
|
||||||
}
|
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(LAYER_X_OFFSET, 0, 0);
|
glTranslatef(LAYER_X_OFFSET, 0, 0);
|
||||||
|
|
||||||
@@ -64,3 +56,12 @@ LabelVisualisation::LabelVisualisation(const std::vector<float> &positions, cons
|
|||||||
|
|
||||||
patchTransparancy();
|
patchTransparancy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LabelVisualisation::drawPaths()
|
||||||
|
{
|
||||||
|
setGlColor(RenderingState::instance().pathColor());
|
||||||
|
glEnableClientState(GL_VERTEX_ARRAY);
|
||||||
|
glVertexPointer(3, GL_FLOAT, 0, nodePositions_.data());
|
||||||
|
glDrawElements(GL_LINES, nodeIndices.size(), GL_UNSIGNED_INT, nodeIndices.data());
|
||||||
|
glDisableClientState(GL_VERTEX_ARRAY);
|
||||||
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ namespace fmri
|
|||||||
public:
|
public:
|
||||||
LabelVisualisation(const std::vector<float>& positions, const LayerData& prevData, const std::vector<std::string>& labels);
|
LabelVisualisation(const std::vector<float>& positions, const LayerData& prevData, const std::vector<std::string>& labels);
|
||||||
void draw(float time) override;
|
void draw(float time) override;
|
||||||
|
void drawPaths() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr float DISPLAY_LIMIT = 0.01;
|
static constexpr float DISPLAY_LIMIT = 0.01;
|
||||||
|
|||||||
@@ -355,9 +355,14 @@ void RenderingState::drawLayer(float time, unsigned long i) const
|
|||||||
if (options.renderLayers) {
|
if (options.renderLayers) {
|
||||||
layer.first->draw(time);
|
layer.first->draw(time);
|
||||||
}
|
}
|
||||||
if (options.renderInteractions && layer.second) {
|
if (layer.second) {
|
||||||
|
if (options.renderInteractions) {
|
||||||
layer.second->draw(time);
|
layer.second->draw(time);
|
||||||
}
|
}
|
||||||
|
if (options.renderInteractionPaths) {
|
||||||
|
layer.second->drawPaths();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user