|
MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
|
| MAYAFLUX_API Kakshya::MeshData MayaFlux::Kinesis::generate_explicit_surface | ( | std::span< const float > | heights, |
| uint32_t | columns, | ||
| uint32_t | rows, | ||
| const glm::vec2 & | extent, | ||
| float | height_scale = 1.0F, |
||
| const glm::vec3 & | center = glm::vec3(0.0F) |
||
| ) |
Generate a mesh from the graph of a function sampled on a grid, y = f(x, z).
heights holds one value per grid point, row-major, columns values along X for each of rows steps along Z. The surface is centred on center and spans extent in X and Z. Normals and tangents come from central differences of the heights, so they follow the surface and are never degenerate. The raw height is stored in each vertex's weight. UV runs (0, 1) at the first row and first column.
Use it where the data is already a table of values: a sound's recent blocks, an image's brightness, a spectrogram, a column of a file. The triangle indices depend only on the grid size and are reused between calls, so regenerating every frame costs one pass over the heights; large grids are filled in parallel.
| heights | columns * rows values. |
| columns | Grid points along X. Minimum 2. |
| rows | Grid points along Z. Minimum 2. |
| extent | World size in X and Z. |
| height_scale | Multiplier from a height to a world Y offset. |
| center | World position of the middle of the grid at zero height. |
Definition at line 1042 of file GeometryPrimitives.cpp.
References columns, generate_explicit_surface(), h, MF_ERROR, MayaFlux::Kakshya::MeshVertex::normal, out, MayaFlux::Kakshya::MeshVertex::position, rows, MayaFlux::Kakshya::MeshVertex::tangent, MayaFlux::Kakshya::MeshVertex::uv, and MayaFlux::Kakshya::MeshVertex::weight.
Referenced by generate_explicit_surface().
Here is the call graph for this function:
Here is the caller graph for this function: