Add $vpr/$vpt/$vpd viewport special variables (v3.5 deferred item)#74
Open
particlesector wants to merge 1 commit into
Open
Add $vpr/$vpt/$vpd viewport special variables (v3.5 deferred item)#74particlesector wants to merge 1 commit into
particlesector wants to merge 1 commit into
Conversation
Picks up the first of the two items deferred at the end of the v3.5 pass. Interpreter gains a setViewport() setter (mirroring the $preview/$t VarRef-fallback pattern) with OpenSCAD-matching defaults so headless evaluation still returns sane numbers instead of undef. MeshBuilder's requestBuild() now takes a ViewportState snapshot, threaded through a pre-populated Interpreter into CsgEvaluator's full evaluate() overload (the same pattern already used for fileTable). Application derives that snapshot from the render camera's pitch/yaw/target/distance at each requestBuild() call site. Verified via a standalone build of the full non-GPU test suite (glm/ spdlog/Catch2 from apt, no vcpkg/Vulkan SDK needed for that target) — 2877 assertions across 533 test cases pass, including new coverage for the defaults, setViewport(), and user-assignment shadowing. MeshBuilder.cpp was independently syntax-checked against a stubbed manifold/VMA — this caught a real GCC quirk (a nested aggregate used as a default argument of its own enclosing class hits "default member initializer required before the end of its enclosing class"), fixed by keeping ViewportState at namespace scope. Application.cpp's own diff is mechanical (7 call-site argument additions plus one small accessor) and could not be compiled in this sandbox (full GLFW/ImGui/Vulkan stack unavailable) but was reviewed by hand against Camera's verified public API. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MEXUhKnGAnmaLJ4R8PEg7r
Owner
Author
|
Reviewed. The wiring checks out: Generated by Claude Code |
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.
Summary
$vpr/$vpt/$vpdviewport special variables (the second — makingcube/sphere/translate/etc. ordinary identifiers instead of reserved keywords — is a genuine grammar/semantics refactor and stays deferred; seedocs/roadmap.md).Interpretergains asetViewport()setter and$vpr/$vpt/$vpdlookups, mirroring the existing$preview/$tVarRef-fallback pattern, with defaults matching OpenSCAD's own ($vpr=[55,0,25],$vpt=[0,0,0],$vpd=140) so headless/test evaluation returns real numbers instead ofundef.MeshBuilder::requestBuild()now takes aViewportStatesnapshot, threaded through a pre-populatedInterpreterintoCsgEvaluator's existingevaluate(result, interp)overload — the same wiring pattern already used forfileTable.Application::currentViewport()derives that snapshot from the render camera's pitch/yaw/target/distance at eachrequestBuild()call site (7 sites updated).Test plan
chiselcad_testsCMake target —Lexer/Parser/Interpreter/SourceLoader/CsgEvaluator/importers) using apt-installed glm/spdlog/Catch2 in place of vcpkg (no Vulkan SDK needed for this target). 2877 assertions across 533 test cases pass, including new tests for the$vpr/$vpt/$vpddefaults,setViewport(), and user-assignment shadowing.MeshBuilder.cppagainst stubbed manifold/VMA headers — caught and fixed a real GCC quirk (a nested aggregate used as a default argument of its own enclosing class's member function).Application.cpp's diff (7 mechanical call-site argument additions plus one small accessor) could not be compiled in this sandbox — the full GLFW/ImGui/Vulkan stack isn't available here — so it was reviewed by hand againstCamera's verified public API instead of compiled. CI's full Windows/Linux builds will cover it.🤖 Generated with Claude Code
https://claude.ai/code/session_01MEXUhKnGAnmaLJ4R8PEg7r
Generated by Claude Code