mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 08:00:42 +00:00
Backports the modern Texture:SetMask, clipping a texture to a mask's alpha shape - round portraits, round minimap buttons, and other shaped art. Vanilla 1.12 has no general masking (only the special-cased minimap disc). Mirrors the engine's own masked-quad draw (the minimap blip mask FUN_004eae10): a co-hook on the vertex-stream primitive FUN_0058a2a0 recovers the owning CSimpleTexture from the batch positions pointer (region = positions - OFF_SIMPLETEXTURE_CORNERS), and for a region with a mask set binds the mask on texture unit 1 with a MODULATE combiner, then re-runs the engine's own submit with uv1 = uv0 so unit 1 samples the mask at the texture's own coordinates. The unit is enabled/disabled around the draw so the mask never leaks onto other textures. A cold co-hook on the region ctor clears a region's mask on pooled reuse; a kill switch and SEH latch guard the draw path. The recipe was pinned by an in-game probe on the live GL backend and matched against FUN_004eae10; the full RE is in the "Texture masking" block in Offsets.h and the Mask.cpp header. Masks must be BLP or uncompressed 32-bit TGA with the shape in the alpha channel; two round masks ship in the client, other shapes are addon-supplied content.