1 #ifndef VTESTBED_GRAPHICS_WAVYSURFACESLICE_HH 2 #define VTESTBED_GRAPHICS_WAVYSURFACESLICE_HH 6 #include <Magnum/GL/Buffer.h> 7 #include <Magnum/GL/Mesh.h> 8 #include <Magnum/GL/Texture.h> 10 #include <vtestbed/core/types.hh> 11 #include <vtestbed/graphics/SliceShader.hh> 12 #include <vtestbed/graphics/types.hh> 22 using array2 = vtb::core::Array<T,2>;
23 using array3 = vtb::core::Array<T,3>;
24 using vec3 = vtb::core::Vector<T,3>;
25 using vec2 = vtb::core::Vector<T,2>;
26 using int2 = vtb::core::int2;
36 GridVertex(vec3 p, vec2 t): position(p), text(t) {}
39 using vertex_matrix = vtb::core::Array<vec3,2>;
40 using vertex_field = vtb::core::Array<vec3,3>;
47 Buffer _indexBuffer, _vertexBuffer;
56 WavySurfaceSlice(
int axis): Drawable3D{*
this,
nullptr}, _axis(axis) {}
58 void step(
const testbed_type& testbed);
59 void step_regular(
const testbed_type& testbed);
60 void step_irregular(
const testbed_type& testbed);
62 inline void show(
bool b) { this->_show = b; }
63 inline void setSlice(
const vec2& rhs) { this->_slice = rhs; }
67 void draw(
const Matrix4& transformation, Camera3D& camera)
override;
71 grid2 slice_grid(
const grid3& gridZXY,
int numPoints);
73 void updateMesh(
const grid_vertex_array& data,
int numPoints);
74 void updateTexture(
const vertex_matrix& texture,
const int2& size);
85 const grid3& phi_grid,
89 static array3 to_scalar_field(
const vertex_field& field);
97 #endif // vim:filetype=cpp