Color nodes based on intensity.
This commit is contained in:
@@ -102,3 +102,9 @@ GLuint fmri::compileShader(GLenum type, char const *source)
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
void ::fmri::setColorFromIntensity(float i)
|
||||
{
|
||||
// TODO: something more expressive.
|
||||
glColor3f(i, i, i);
|
||||
}
|
||||
|
||||
@@ -33,4 +33,11 @@ namespace fmri {
|
||||
* @param h new Height.
|
||||
*/
|
||||
void changeWindowSize(int w, int h);
|
||||
|
||||
/**
|
||||
* Set the current drawing color based on some intensity value.
|
||||
*
|
||||
* @param i The intensity.
|
||||
*/
|
||||
void setColorFromIntensity(float i);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,9 @@ static void render()
|
||||
|
||||
glPushMatrix();
|
||||
for (auto& layer : *rendererData.currentData) {
|
||||
glPushMatrix();
|
||||
renderLayer(layer);
|
||||
glPopMatrix();
|
||||
glTranslatef(-5, 0, 0);
|
||||
}
|
||||
glPopMatrix();
|
||||
@@ -90,10 +92,10 @@ static void renderFlatLayer(const LayerData& data)
|
||||
// Color depends on current value.
|
||||
vector<float> intensities(data.data(), data.data() + data.numEntries());
|
||||
rescale(intensities.begin(), intensities.end(), 0, 1);
|
||||
glColor3f(1, 1, 1);
|
||||
|
||||
glPushMatrix();
|
||||
for (auto i : intensities) {
|
||||
setColorFromIntensity(i);
|
||||
drawOneParticle();
|
||||
glTranslatef(0, 0, -2);
|
||||
}
|
||||
@@ -118,6 +120,8 @@ static void renderLayer(const LayerData& data)
|
||||
// Draw the name of the layer for reference.
|
||||
glColor3f(0.5, 0.5, 0.5);
|
||||
renderText(data.name());
|
||||
|
||||
glTranslatef(0, 0, -2);
|
||||
switch (shape.size()) {
|
||||
case 4:
|
||||
// TODO: implement this.
|
||||
|
||||
Reference in New Issue
Block a user