mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-20 16:14:58 +01:00
fix(editor): the points of the terrain tools put on the ground along the ray through the cursor in this frame
The terrain tools (the outlines of Fill, water and chunks, the target height, the brushes) and the area fill took their point from the depth read back under the cursor. That depth is a frame late, so the point was off while the camera or the cursor moved, and it stops at whatever is drawn over the ground (models, the 3D grass), at a grazing angle metres away from where the ground is. Now the ray through the cursor as it is in this frame is followed to the terrain (terrain_streamer::raycast); the depth read back is used only where the ray meets no terrain. The brush circle is drawn where the stroke will land. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DDcMn1Q7wdYkbxDUWscNHZ
This commit is contained in:
@@ -676,6 +676,13 @@ class editor_mode : public application_mode, private editor_track::observer, pri
|
||||
return m_terrain_tool == terrain_tool::sculpt || m_terrain_tool == terrain_tool::smooth || m_terrain_tool == terrain_tool::level || m_terrain_tool == terrain_tool::paint ||
|
||||
m_terrain_tool == terrain_tool::restore;
|
||||
}
|
||||
// the point of the ground of the terrain under the cursor, found along the ray through the cursor, so it's found also over
|
||||
// a hole and behind the grass. returns: false if the ray meets no terrain
|
||||
bool terrain_cursor(glm::dvec3 &World) const;
|
||||
// the point of the ground under the cursor in this frame, for the points put on the ground (outlines, areas, brushes): along the ray
|
||||
// through the cursor to the terrain; the depth read back (a frame late, and stopped by the models over the ground) only where
|
||||
// there's none. false: nothing under the cursor
|
||||
bool cursor_on_ground(glm::dvec3 &World);
|
||||
// converts the point spacing of the selected chunks to m_terrain_convert_spacing
|
||||
void convert_selected_chunks();
|
||||
// the chunks selected with the spacing tool taken out of the terrain, in one step of the history
|
||||
|
||||
Reference in New Issue
Block a user