Skip to content

Feature/add top clipping - #3887

Draft
phobos2390 wants to merge 10 commits into
OpenLoco:masterfrom
phobos2390:feature/Add_Top_Clipping
Draft

Feature/add top clipping#3887
phobos2390 wants to merge 10 commits into
OpenLoco:masterfrom
phobos2390:feature/Add_Top_Clipping

Conversation

@phobos2390

Copy link
Copy Markdown
Contributor

Added shortcut that increments and decrements the clip height. Anything above the max clip height is not rendered and ignored for collision detection.

Additional features in this vein could include clip height presets and also ghost placement at the clip height itself.

@phobos2390
phobos2390 marked this pull request as draft August 1, 2026 15:20
@AaronVanGeffen

AaronVanGeffen commented Aug 1, 2026

Copy link
Copy Markdown
Member

Sounds like a nice feature. Could you add a video of this in action?

@phobos2390

Copy link
Copy Markdown
Contributor Author

Sounds like a nice feature. Could you add a video of this in action?

https://youtu.be/J2s2Q2lhEso?is=0IAKWI3UaFOzWvXz

Comment thread src/OpenLoco/src/Viewport.cpp Outdated
@AaronVanGeffen

Copy link
Copy Markdown
Member

Rather than just making this a shortcut-only function, I think we should add a GUI for this. This could be a fairly simple window. Here's a screenshot of what the equivalent window looks like in OpenRCT2, and how to access it:

Forest Frontiers 2026-08-02 14-47-13

Would you like to work on this? Let us know if you need any help.

@phobos2390

Copy link
Copy Markdown
Contributor Author

Rather than just making this a shortcut-only function, I think we should add a GUI for this. This could be a fairly simple window. Here's a screenshot of what the equivalent window looks like in OpenRCT2, and how to access it:
Forest Frontiers 2026-08-02 14-47-13

Would you like to work on this? Let us know if you need any help.

Since this is basically the OpenRCT2 implementation that was the inspiration I think that'd be the goal. I'm not certain if I can be the developer to implement that view at this time however

@AaronVanGeffen

Copy link
Copy Markdown
Member

Understandable. Would you like me to take over to implement the window, then?

@phobos2390

Copy link
Copy Markdown
Contributor Author

Yes

@AaronVanGeffen
AaronVanGeffen force-pushed the feature/Add_Top_Clipping branch from 862e0f9 to 5ee0e9a Compare August 27, 2026 17:57
@AaronVanGeffen

Copy link
Copy Markdown
Member

I've rebased the PR on top of current master. Will work on adding a GUI/window soon.

@AaronVanGeffen
AaronVanGeffen force-pushed the feature/Add_Top_Clipping branch from 5ee0e9a to 0174125 Compare August 27, 2026 18:11
@AaronVanGeffen

AaronVanGeffen commented Sep 3, 2026

Copy link
Copy Markdown
Member

Added a basic UI with a scrollbar that allows setting the max height. Aiming to add a label with human-readable units next.

Screenshot 2026-09-03 at 19 10 46

NB: I've cherry-picked #4001 here to have a slider widget to work with. That is intended for separate review.

@AaronVanGeffen
AaronVanGeffen force-pushed the feature/Add_Top_Clipping branch from 0174125 to 13a6f6a Compare September 3, 2026 17:12
@phobos2390

Copy link
Copy Markdown
Contributor Author

One thing I was also looking at was mouse position to tile as my understanding is mouse interaction is done by rendering the scene then seeing if the mouse is on a rendered pixel. In a cut away view that's harder to pull off

@AaronVanGeffen
AaronVanGeffen force-pushed the feature/Add_Top_Clipping branch from fd18f83 to cdf465a Compare September 3, 2026 19:05
@AaronVanGeffen
AaronVanGeffen force-pushed the feature/Add_Top_Clipping branch from 90521ed to 614cbc2 Compare September 4, 2026 12:16
@AaronVanGeffen
AaronVanGeffen force-pushed the feature/Add_Top_Clipping branch from f9418ea to 2449fa9 Compare September 5, 2026 09:19
@AaronVanGeffen

Copy link
Copy Markdown
Member

Here's what I have now:

Screenshot 2026-09-05 at 11 19 48

I think this is good to go for a first version, UI-wise.

Comment on lines +786 to +787
ShortcutManager::add(Shortcut::viewClippingIncrement, StringIds::shortcut_max_clip_height_increment, maxClipIncrement, "maxClipIncrement", "");
ShortcutManager::add(Shortcut::viewClippingDecrement, StringIds::shortcut_max_clip_height_decrement, maxClipDecrement, "maxClipDecrement", "");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we should keep these. My preference would be to stick the window.

Comment on lines +283 to +284
static constexpr int16_t kDefaultMaxClipHeight = World::kMaxTileHeightSmallZ * World::kSmallZStep;
static int16_t maxClipHeight = kDefaultMaxClipHeight;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if we only use this for the main window, for now, I think we should move this into the viewport struct.

void init()
{
_viewports.clear();
Ui::resetMaxClipHeight();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should maybe do this when the 'view clipping' window is closed as well.

@AaronVanGeffen AaronVanGeffen added this to the v26.09+ milestone Sep 5, 2026
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.

2 participants