clip3d_f(3)
โจ clip3d_f โ the Allegro manual, but make it cute โจ
okay bestie, welcome to the clip3d_f(3) page from the Allegro manual ๐ this one's a real one, she clips polygons with floating point math and she does it flawlessly. Allegro game programming library, as always. let's get into it ๐
๐ธ NAME ๐ธ
clip3d_f โ clips the polygon given in vtx using floating point math. Allegro game programming library, periodt. ๐
๐ฆ SYNOPSIS ๐ฆ
#include <allegro.h>
int clip3d_f(int type, float min_z, float max_z, int vc, const V3D_f
*vtx[], V3D_f *vout[], V3D_f *vtmp[], int out[]);
look at her. iconic signature. no notes. โจ
๐ DESCRIPTION ๐
so what's the tea? clip3d_f clips the polygon you hand her in vtx. the number of vertices is vc, the result goes in vout, and vtmp and out are needed for internal purposes โ they're the backstage crew, don't worry about them, just give them a seat. ๐
important bestie: the pointers invtx,voutandvtmpmust point to validV3D_fstructures. no fake ones, no random memory, fr fr. ๐
now, here's the thing โ as additional vertices may appear in the process of clipping (she's growing the polygon, main character energy), the size of vout, vtmp and out should be at least vc * (1.5 ^ n), where n is the number of clipping planes (5 or 6), and ^ denotes "to the power of". so like, math. do the math. ๐งฎโจ
the frustum (that's the viewing volume, the little zone where things actually show up) is defined by -z<x<z, -z<y<z, 0<min_z<z<max_z. and if max_z<=min_z, the z<max_z clipping is not done. noted. ๐
as you can see, clipping is done in the camera space, with perspective in mind, so this routine should be called after you apply the camera matrix, but before the perspective projection. order matters, bestie, it's giving choreography. ๐
and she will correctly interpolate u, v, and c in the vertex structure. however โ and this is the one sad part ๐ญ โ no provision is made for high/truecolor GCOL. she simply does not do that. ๐
โญ RETURN VALUE โญ
returns the number of vertices after clipping is done. a little number, a big slay. ๐
๐ซถ SEE ALSO ๐ซถ
go read those too, they're all part of the friend group ๐
and that's the whole page, babe! ๐ฆ this was clip3d_f(3) from the Allegro manual, brought to you by Allegro version 4.4.3 โ mwah, ily, go clip some polygons responsibly ๐โจ๐
๐ฆ where this page comes from
- fedora 43: allegro-devel 4.4.3.1-18.fc43 ยท Giftware
- fedora 43: allegro-devel 4.4.3.1-18.fc43 ยท Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 ยท Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 ยท Giftware
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms