MMD for esp32
Source code is available at github.
MMD for esp32, M5Stack, (WiFiBoy32 page)
RAM: about 300KB
Thread: 2 (barrier sync)
Memory usage (estimates):
|Memory usage||for each element [byte]||total [byte]||%|
|Triangle buffer||136(shape, count, UV, ...)||136*300=40800||13.6%|
|Z buffer||2(2 byte)*window_width*DRAW_NLINES=25600||25600||8.5%|
|Animation position, |
Others (stack, threads, or used in os) are excluded in the table.
DRAW_NLINES is const variable how many horizontal lines is send to the LCD at the same time. The Larger the number of horizontal lines, the faster and smooth animation, but It takes lot of RAM.
Double buffering method is used and CPU task which draw the 3D model and send to LCD is executed simultaneously.
Triangles which is spanning two DRAW_NLINES area is stored in the Triangle buffer.(Red triangle in the picture below)
Triangle which behinds the camera Z-clip.
Pattern 1, 2 vertexes are behind the camera. move two vertixes to the ZNEAR
Pattern2, 1 vertex is behind the camera. Then, split one triangle into two triangles.