Change drawing order depending on camera direction.
This commit is contained in:
@@ -253,20 +253,23 @@ void RenderingState::render(float time) const
|
|||||||
|
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(-LAYER_X_OFFSET / 2 * currentData->size(), 0, 0);
|
|
||||||
|
|
||||||
for (auto i : Range(currentData->size())) {
|
// Ensure we render back-to-front for transparency
|
||||||
glPushMatrix();
|
if (angle[0] <= 0) {
|
||||||
renderLayerName(currentData->at(i).name());
|
// Render from the first to the last layer.
|
||||||
if (options.renderLayers) {
|
glTranslatef(-LAYER_X_OFFSET / 2 * currentData->size(), 0, 0);
|
||||||
layerVisualisations[i]->draw(time);
|
for (auto i : Range(currentData->size())) {
|
||||||
}
|
drawLayer(time, i);
|
||||||
if (options.renderInteractions && i < interactionAnimations.size() && interactionAnimations[i]) {
|
glTranslatef(LAYER_X_OFFSET, 0, 0);
|
||||||
interactionAnimations[i]->draw(time);
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Render from the last layer to the first layer.
|
||||||
|
glTranslatef(LAYER_X_OFFSET / 2 * (currentData->size() - 2), 0, 0);
|
||||||
|
for (auto i = currentData->size(); i--;) {
|
||||||
|
drawLayer(time, i);
|
||||||
|
|
||||||
glPopMatrix();
|
glTranslatef(-LAYER_X_OFFSET, 0, 0);
|
||||||
glTranslatef(LAYER_X_OFFSET, 0, 0);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
@@ -276,6 +279,21 @@ void RenderingState::render(float time) const
|
|||||||
glutSwapBuffers();
|
glutSwapBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RenderingState::drawLayer(float time, unsigned long i) const
|
||||||
|
{
|
||||||
|
glPushMatrix();
|
||||||
|
|
||||||
|
renderLayerName(currentData->at(i).name());
|
||||||
|
if (options.renderLayers) {
|
||||||
|
layerVisualisations[i]->draw(time);
|
||||||
|
}
|
||||||
|
if (options.renderInteractions && i < interactionAnimations.size() && interactionAnimations[i]) {
|
||||||
|
interactionAnimations[i]->draw(time);
|
||||||
|
}
|
||||||
|
|
||||||
|
glPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
void RenderingState::renderOverlayText() const
|
void RenderingState::renderOverlayText() const
|
||||||
{
|
{
|
||||||
std::stringstream overlayText;
|
std::stringstream overlayText;
|
||||||
|
|||||||
@@ -90,5 +90,7 @@ namespace fmri
|
|||||||
std::string debugInfo() const;
|
std::string debugInfo() const;
|
||||||
void renderOverlayText() const;
|
void renderOverlayText() const;
|
||||||
void renderLayerName(const std::string& name) const;
|
void renderLayerName(const std::string& name) const;
|
||||||
|
|
||||||
|
void drawLayer(float time, unsigned long i) const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user