S3D_PUSH_POLYGONS(3)
β¨ s3d_push_polygons β bestie's guide to yeeting a whole bunch of polygons at once β¨
okay so welcome to the s3d_push_polygons(3) page from the s3d Manual π
this one's short and sweet and honestly? iconic. it's giving "bulk upload but make it polygons" π¦
π NAME π
s3d_push_polygons β push many polygons π«Ά
no literally that's it. push. many. polygons. slay.
πΈ SYNOPSIS πΈ
#include <s3d.h>
int s3d_push_polygons(int object, const uint32_t *pbuf, uint16_t n);
so you got your #include <s3d.h> (mandatory bestie, don't skip it π), and then one lil function call that takes an int object, a const uint32_t *pbuf, and a uint16_t n. that's the whole vibe check.
π DESCRIPTION π
okay so here's the tea β β same energy as vertices, but for polygons. if you push arrays instead of one-at-a-time, you get greater performance. it's the glow-up your render loop has been waiting for β¨
so the pbuf should contain n polygons, and each polygon is made of 4 uint32_t values: 3 vertex indices plus 1 material index. that's the recipe, no cap π§
and here's the example, verbatim, because I would never mess with your code π
uint32_t pbuf[] = { 0, 1, 2, 0};
int oid = s3d_new_object(); // create a new object
s3d_push_vertex(oid, 0.0, 0.0, 0.0);
s3d_push_vertex(oid, 0.0, 1.0, 0.0);
s3d_push_vertex(oid, 1.0, 0.0, 0.0);
s3d_push_material(oid, 0.3, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0);
s3d_push_polygons(oid, pbuf, 1);
// push one polygon with the pbuf data
see how it all comes together?? new object, three vertices, one material, and then s3d_push_polygons(oid, pbuf, 1) drops that one polygon in with the pbuf data. main character energy fr fr π
π AUTHOR π
- Simon Wunderlich
- Author of s3d π
lowkey a legend for writing this whole thing ngl π
and that's the whole page!! from the s3d Manual, source/version s3d β thanks for reading bestie, go push some polygons, you're gonna eat π β¨π
π¦ where this page comes from
- debian bookworm: s3d-doc 0.2.2.1-5 Β· GPL-2.0-or-later
- debian trixie: s3d-doc 0.2.2.1-7 Β· GPL-2.0-or-later
- ubuntu jammy: s3d-doc 0.2.2.1-3build1 Β· GPL-2.0-or-later
- ubuntu noble: s3d-doc 0.2.2.1-6build3 Β· GPL-2.0-or-later
- ubuntu questing: s3d-doc 0.2.2.1-7build1
- ubuntu resolute: s3d-doc 0.2.2.1-7build3 Β· GPL-2.0-or-later
- ubuntu stonking: s3d-doc 0.2.3-1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms