mirror of
https://github.com/jkdansereau/goldeneye-pc-port.git
synced 2026-10-24 00:02:45 +02:00
The IsWater 32x32 CI8 image (drawn through an RGBA16 tile, D229) was imported with its mip chain as 32x43 and normalised as 16 wide, so the pattern ran at 2x and wrapped every 43 rows instead of the N64's 32: fold steps made it jump. Import the base level only and use CI8 geometry in the tri path. Sky/water fans now go through a port-only G_FLOATVTX_EXT (float clip positions + S/T) instead of s16 Vtx, removing the tc shift and wScale quantisation jitter. User-verified vs 1964; golden 3/3; Win + Linux build. A/B: GE_D245_OLDVTX / GE_D245_OLDTEX.
34 lines
1.6 KiB
C
34 lines
1.6 KiB
C
#ifndef PORT_FLOATVTX_H
|
|
#define PORT_FLOATVTX_H
|
|
|
|
/* D245 (M-201): port-only full-precision vertex load for the sky/water fans.
|
|
*
|
|
* On N64, sky.c builds these triangles directly as RDP edge/texture
|
|
* coefficients with 32-bit S/T, so a horizon-scale quad (the IsWater ocean
|
|
* spans ~300,000 S10.5 units, ~9,400 texels) is exact. Routed through an
|
|
* ordinary gSPVertex, both its texture coords (s16 tc: +-1,024 texels) and its
|
|
* positions (s16 ob, divided by a fan-wide wScale to fit camera-space w up to
|
|
* ~2e5) had to be quantised -- visible as water/sky jitter that slides with
|
|
* the view. G_FLOATVTX_EXT hands fast3d the clip-space position and S/T as
|
|
* floats instead; fast3d already stores every loaded vertex as floats.
|
|
*
|
|
* w0 = G_FLOATVTX_EXT << 24 | dest_index << 16 | count, w1 = PortFloatVtx *.
|
|
* s/t are in Vtx.tc units (S10.5, before gSPTexture scaling). */
|
|
#define G_FLOATVTX_EXT 0x47
|
|
|
|
typedef struct PortFloatVtx {
|
|
float x, y, z, w; /* clip space */
|
|
float s, t; /* tc units */
|
|
unsigned char r, g, b, a;
|
|
} PortFloatVtx;
|
|
|
|
#define gSPFloatVertexExt(pkt, ptr, n, v0) \
|
|
do { \
|
|
Gfx *_g = (Gfx *)(pkt); \
|
|
_g->words.w0 = ((uintptr_t)G_FLOATVTX_EXT << 24) | \
|
|
(((uintptr_t)(v0) & 0xff) << 16) | ((uintptr_t)(n) & 0xffff); \
|
|
_g->words.w1 = (uintptr_t)(ptr); \
|
|
} while (0)
|
|
|
|
#endif
|