Files
CydandClaude Fable 5 db7745fcd0 sda4: commit the Glaze developer hard-drive dump
Un-ignored: the dev drive is the ground truth the restoration and
emulator work constantly reference (DPL3/LIBDPL + VRENDER i860 renderer
source, BT/RP live+dev game trees, VGL_LABS pod boot, scene/audio
content). Kept in-repo for the pod-owner community.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-04 19:41:15 -05:00

162 lines
3.4 KiB
C++

/* *************************************
i think the right way to draw triangles on pxpl5 is exactly the
way i havent been doing it. firstly, i need to traverse entire
geometries at once, avoiding the triangle entry and exit code on each
primitive. also, i need to just have the one piece of code which
caters for all triangles, which is parameterized according to what
variables need drawing, probably using the same bit-packings we use
use for the geometry in b2z files.
Also, i strongly believe i should make no attempt to call procedures
inside the triangle function - all planarize and edgize stuff should
be done in-line, now that there is just 1 function doing the whole
triangle.
There is a usefulness in zuv and rgb coming in threes, which
is that a very optimal and brainlessly easy planarize is possible on 3
variables at once. This will yield results in 12 ticks per variable,
bringing in the possibility of a z-buffered, textured, gouraud triangle
taking just 3uS of i860 time.
The flavors of triangle are -
zbuf_f
zbuf_f_t
zbuf_rgb
zbuf_rgb_t
zbuf_rgba
zbuf_rgba_t
And the drawing order for the flavors of triangle are -
zbuf_f
------
edges
z
flat rgb
sca
zbuf_f_t
--------
edges
zuv
flat rgb
sca
zbuf_rgb
--------
edges
z
rgb
sca
zbuf_rgb_t
----------
edges
zuv
rgb
sca
zbuf_rgba
---------
edges
alpha
z
rgb
sca
zbuf_rgba_t
-----------
edges
alpha
zuv
rgb
sca
So the algorithm is
icoeff_p = vpx ( icoeff_p, codeword, opcode0, conn, backwards );
void draw_geom ( int *icoeff_pp,
int *icoeff_basep,
dpl_CONNECTION *connection,
float scalar,
int draw_mode,
int backwards )
{
int icoeff_p =*icoeff_pp;
int icoeff_base=*icoeff_basep;
while (connection) {
int nextplane=z;
int triangle_coeffstart=icoeff_p;
if (connection->touched) {
if (icoeff_p > icoeff_base) {
icoeff_p=(int) next_coeffchunk ();
icoeff_base=icoeff_p + COEFF_FULL;
}
--{{{ do edges, pre-load opcode and variables
if (alpha_per_vertex) {
setenabs();
nextvert=alpha;
}
else {
surface_opacity();
nextvert=z;
}
edgize_all_edges(nextvert);
--}}}
--{{{ do vertex opacity if needed
if (alpha_per_vertex) {
nextvert=z;
planarize();
}
--}}}
--{{{ do z (and uv if needed)
if (texture) {
nextvert=r;
texturize();
}
else {
nextvert=r;
planarize();
}
--}}}
--{{{ do rgb
if (smooth) {
nextvert=g;
planarize();
nextvert=b;
planarize();
planarize();
}
else {
flat_colour();
}
--}}}
--{{{ do scalar
store_scalar();
--}}}
}
connection=connection->next;
}
*icoeff_pp=icoeff_p;
*icoeff_basep=icoeff_base;
}
code needs to
a) pre-planarize and edgize the triangle