Header only 3d metaballs generator in C99
This library computes 3d metaballs in pure C99.
There are optimizations yet to be done.
The example uses raylib as a render engine.
This library follows single-file C/C++ public domain libraries rules.
Include the header file and the definition to include the implementation code in just one of the includes.
#define METABALLS_IMPLEMENTATION
#include "metaballs.h"
Refer the examples to see the library usage.
Creates the metaballs workspace
Index3d count = {.x = 10, .y = 10, .z = 10};
Vector3d size = {.x = 2, .y = 2, .z = 2};
Vector3d pos = {.x = 0, .y = 0, .z = 0};
Grid grid = metaball_grid_create(count, size, pos);
Builds up the mesh to render the metaballs
metaball_generate_mesh(&grid, balls);
Destroys the metaballs workspace
metaball_grid_destroy(&grid);
- Iteration: Added a method to visit only valid neighbors.
- Optimization: A rudimentary cache system is included.
- Color: Added color per ball.
- Texture mapping: Generate and upload mesh to GPU, texture mapping is available.
- Control: Added mouse and keyboard control.
- Code clean: Add prefix to library methods and structures. (Avoid name collision)
- Known issue: The spheric texture mapping doesn't close correctly.
- Performance: Avoid repeat vertex on mesh generation.