Skip to content

Sprite sheets: Semi-transparent option; Lua UI.DrawTexturedTriangle support - #318

Open
rixnobis wants to merge 2 commits into
mainfrom
lua-textri
Open

rixnobis wants to merge 2 commits into
mainfrom
lua-textri

Conversation

@rixnobis

@rixnobis rixnobis commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Editor side of psxsplash/psxsplash#127 (UI.DrawTexturedTriangle). A sprite sheet gets a Semi-transparent option. It sets STP on every non-transparent texel or CLUT entry of its texture, since the GPU only blends textured pixels with that bit set. Opaque drawing does not change. The option is part of the VRAM packer's dedup key, so two sheets on one image with different settings stay two textures.

The Lua tables and psxsplash.d.lua list the new call. A script that names a sprite sheet the scene does not have, as a string literal in UI.DrawTexturedTriangle, Sprite.Create or Sprite.SheetIndex, gets a build warning (core/luascan.cpp). Do not merge before psxsplash/psxsplash#127.

The PS1 blends a textured texel only when its STP bit (15) is set, and the
export left it clear on every colour but pure black. A sheet's new
semiTransparent option (written only when on) sets STP on every drawn CLUT
colour (4/8 bpp) or texel (16 bpp), leaving the transparent 0x0000 alone, so
a blended Lua UI.DrawTexturedTriangle blends it; opaque drawing is unchanged
(psxsplash never sets the mask bit). The VRAM packer keys on the option, so
two sheets on one image, one semi-transparent, stay two textures.

Inspector: a Semi-transparent toggle with a tooltip. Tests: editor_tests
checks the exported CLUT/texel words at 4, 8 and 16 bpp and the dedup key;
spritesheetcheck drives the toggle and its undo.
…arning

lua_api.inc and psxsplash.d.lua get UI.DrawTexturedTriangle next to
UI.DrawTriangle (the row gen_lua_api.py writes from psxsplash's luaapi.hh,
with prose in the style of its neighbours).

The export warns when a script calls UI.DrawTexturedTriangle,
Sprite.Create or Sprite.SheetIndex with a string-literal sheet name the
scene has no sprite sheet for (luascan: spriteSheetRefs and
spriteSheetRefWarnings, one warning per call and name, with its line).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant