Repository navigation
picogame3d: move the perspective and 3D functions out of picogame - #11961
Merged
Merged
Conversation
dhalbert
requested changes
Nov 25, 2026
dhalbert
left a comment
Collaborator
There was a problem hiding this comment.
This seems fine, and certainly 11.0.0 is the right time to make this change. Take out the autogen_board_info.toml changes. Updates to those files are triggered automatically by a separate CI task.
mode7, road, road_edges, raycast and project move to a new picogame3d module, enabled by default wherever picogame is. Canvas.mode7 and Canvas.road become functions that take the canvas as their first argument, and picogame.FPU becomes picogame3d.FLOAT.
project limited n only by out_sx and raycast limited ncols only by top, so a shorter out_sy, pts, bot, col, dist or map was written or read past its end. Both now limit the count by every buffer, and a cam or wcolors buffer that is too short raises ValueError.
lynt-smitka
force-pushed
the
picogame3d
branch
from
November 25, 2026 15:56
8427c03 to
986e24b
Compare
dhalbert
approved these changes
Nov 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
picogamehas turned out to be useful beyond games, as a fast general drawing engine, and I want to keep developing it without worry about flash for every new feature. The 3D/perspective functions are a different kind of code: they are mostly for demos, wow effects and finding out how far CircuitPython can go, so fewer people use them. Splitting them into their own module, as suggested in #11198, lets both parts grow independently: new 3D features don't make the 2D core bigger, and a board short on flash can keep the 2D engine and drop the 3D one.This moves
mode7,road,road_edges,raycastandprojectfrompicogameinto a newpicogame3dmodule.CIRCUITPY_PICOGAME3Ddefaults toCIRCUITPY_PICOGAME, so all seven boards that havepicogameget both modules;picogame3dwithoutpicogamestops the build with an#error. TheCIRCUITPY_PICOGAME_FPUmake variable is gone; no board set it, and a build can still force the float path with-DCIRCUITPY_PICOGAME3D_FLOAT=0/1.This is a breaking change for code written against 10.3 and 11.0.0-beta.0. Existing code migrates like this:
canvas.mode7(...)→picogame3d.mode7(canvas, ...)canvas.road(...)→picogame3d.road(canvas, ...)picogame.raycast,road_edges,project→picogame3d.raycast,road_edges,projectpicogame.FPU→picogame3d.FLOATThere are no aliases in
picogame, because they would cost flash on every board and keep the 3D code linked in. Thepicogame_mode7,picogame_roadandpicogame_rayhelper libraries get a matching release.roadnow clips each row itself and fills it withpicogame_fill565, so it no longer needsspan565fromCanvas.c; it is about 10 % faster than before (PicoPad, 160x120 canvas). The second commit makesprojectandraycastcheck every buffer length. Before, they checked only one output buffer, so a shorter buffer was read or written past its end.Size: +232 B on PicoPad, +216 B on Fruit Jam, +224 B on PyBadge; the buffer checks are 56-72 B of
that. Building with
CIRCUITPY_PICOGAME3D = 0saves 3.8 kB on PicoPad.Tested on PicoPad, Fruit Jam and PyBadge: the output of all five functions is identical to main for the same inputs.