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