diff options
author | Adrian Kummerlaender | 2018-12-17 19:09:25 +0100 |
---|---|---|
committer | Adrian Kummerlaender | 2018-12-17 19:09:25 +0100 |
commit | ede5386d53a453cb56c9b1c80de0a80322ddc6f1 (patch) | |
tree | ab9b8b9e0659fa7c9da1bc35d9f943b072de843e /src/buffer | |
parent | 85ad73153d1193e51e77ca825416df3794443fa4 (diff) | |
download | compustream-ede5386d53a453cb56c9b1c80de0a80322ddc6f1.tar compustream-ede5386d53a453cb56c9b1c80de0a80322ddc6f1.tar.gz compustream-ede5386d53a453cb56c9b1c80de0a80322ddc6f1.tar.bz2 compustream-ede5386d53a453cb56c9b1c80de0a80322ddc6f1.tar.lz compustream-ede5386d53a453cb56c9b1c80de0a80322ddc6f1.tar.xz compustream-ede5386d53a453cb56c9b1c80de0a80322ddc6f1.tar.zst compustream-ede5386d53a453cb56c9b1c80de0a80322ddc6f1.zip |
Try out velocity norm color mapping
Diffstat (limited to 'src/buffer')
-rw-r--r-- | src/buffer/vertex/fluid_cell_buffer.h | 5 | ||||
-rw-r--r-- | src/buffer/vertex/lattice_cell_buffer.cc | 19 | ||||
-rw-r--r-- | src/buffer/vertex/lattice_cell_buffer.h | 4 |
3 files changed, 12 insertions, 16 deletions
diff --git a/src/buffer/vertex/fluid_cell_buffer.h b/src/buffer/vertex/fluid_cell_buffer.h index f71c2cb..9e535cb 100644 --- a/src/buffer/vertex/fluid_cell_buffer.h +++ b/src/buffer/vertex/fluid_cell_buffer.h @@ -1,12 +1,11 @@ #pragma once -#include <vector> - #include <GL/glew.h> class FluidCellBuffer { private: - std::vector<GLfloat> _data; + const GLuint _nX; + const GLuint _nY; GLuint _array; GLuint _buffer; diff --git a/src/buffer/vertex/lattice_cell_buffer.cc b/src/buffer/vertex/lattice_cell_buffer.cc index c2b877b..ea4e103 100644 --- a/src/buffer/vertex/lattice_cell_buffer.cc +++ b/src/buffer/vertex/lattice_cell_buffer.cc @@ -1,19 +1,20 @@ #include "lattice_cell_buffer.h" -#include <fstream> +#include <vector> -LatticeCellBuffer::LatticeCellBuffer(GLuint nX, GLuint nY): - _data(9*nX*nY, GLfloat{1./9.}) { +LatticeCellBuffer::LatticeCellBuffer(GLuint nX, GLuint nY) { glGenVertexArrays(1, &_array); glGenBuffers(1, &_buffer); - const int inset = 0.4*nX; + std::vector<GLfloat> data(9*nX*nY, GLfloat{1./9.}); + const int insetX = 0.45*nX; + const int insetY = 0.45*nY; - for (int x = inset; x < nX-inset; x++) { - for (int y = inset; y < nY-inset; y++) { + for (int x = insetX; x < nX-insetX; x++) { + for (int y = insetY; y < nY-insetY; y++) { for ( int i = -1; i <= 1; ++i ) { for ( int j = -1; j <= 1; ++j ) { - _data[9*nX*y + 9*x + (i+1)*3 + j+1] = 1./64.; + data[9*nX*y + 9*x + (i+1)*3 + j+1] = 0.5; } } } @@ -23,8 +24,8 @@ LatticeCellBuffer::LatticeCellBuffer(GLuint nX, GLuint nY): glBindBuffer(GL_ARRAY_BUFFER, _buffer); glBufferData( GL_ARRAY_BUFFER, - _data.size() * sizeof(GLfloat), - _data.data(), + data.size() * sizeof(GLfloat), + data.data(), GL_DYNAMIC_DRAW ); diff --git a/src/buffer/vertex/lattice_cell_buffer.h b/src/buffer/vertex/lattice_cell_buffer.h index f6638c8..e5e00a4 100644 --- a/src/buffer/vertex/lattice_cell_buffer.h +++ b/src/buffer/vertex/lattice_cell_buffer.h @@ -1,13 +1,9 @@ #pragma once -#include <vector> - #include <GL/glew.h> class LatticeCellBuffer { private: - std::vector<GLfloat> _data; - GLuint _array; GLuint _buffer; |