Use wireframe to give piramids a more 3D feel.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
using namespace std;
|
||||
using namespace fmri;
|
||||
|
||||
static inline void computeColor(float intensity, float limit, float* destination)
|
||||
static inline void computeColor(float intensity, float limit, float *destination)
|
||||
{
|
||||
const float saturation = min(-log(abs(intensity) / limit) / 10.0f, 1.0f);
|
||||
if (intensity > 0) {
|
||||
@@ -29,7 +29,7 @@ FlatLayerVisualisation::FlatLayerVisualisation(const LayerData &layer, Ordering
|
||||
colorBuffer(new float[faceCount * 3]),
|
||||
indexBuffer(new int[faceCount * 3])
|
||||
{
|
||||
auto& shape = layer.shape();
|
||||
auto &shape = layer.shape();
|
||||
CHECK_EQ(shape.size(), 2) << "layer should be flat!" << endl;
|
||||
CHECK_EQ(shape[0], 1) << "Only single images supported." << endl;
|
||||
|
||||
@@ -37,7 +37,8 @@ FlatLayerVisualisation::FlatLayerVisualisation(const LayerData &layer, Ordering
|
||||
|
||||
const auto limit = (int) layer.numEntries();
|
||||
auto data = layer.data();
|
||||
const auto [minElem, maxElem] = minmax_element(data, data + limit);
|
||||
const auto
|
||||
[minElem, maxElem] = minmax_element(data, data + limit);
|
||||
|
||||
auto scalingMax = max(abs(*minElem), abs(*maxElem));
|
||||
|
||||
@@ -67,9 +68,16 @@ void FlatLayerVisualisation::render()
|
||||
glVertexPointer(3, GL_FLOAT, 0, vertexBuffer.get());
|
||||
glColorPointer(3, GL_FLOAT, 0, colorBuffer.get());
|
||||
glDrawElements(GL_TRIANGLES, faceCount * 3, GL_UNSIGNED_INT, indexBuffer.get());
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
|
||||
// Now draw wireframe
|
||||
glColor4f(0, 0, 0, 1);
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
glDrawElements(GL_TRIANGLES, faceCount * 3, GL_UNSIGNED_INT, indexBuffer.get());
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
|
||||
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
}
|
||||
|
||||
void FlatLayerVisualisation::setVertexPositions(const int vertexNo, float *destination)
|
||||
|
||||
Reference in New Issue
Block a user