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 πŸ’…βœ¨πŸŽ€