rozniak / Junkbot

An attempt at an open-source port of Lego Junkbot
GNU General Public License v2.0
31 stars 3 forks source link

Rendering order of picked up unplaced blocks is incorrect #27

Open TommytheJerk opened 3 years ago

TommytheJerk commented 3 years ago

Unplaced blocks should be rendered as though they were placed, in terms of ordering on the z-plane. Right now, they render on top of already placed blocks, which is not how they render in the original game.

rozniak commented 3 years ago

This is intentional, but wrong behaviour - I thought that the bricks in the hand are always rendered on top of everything else. In reality they are in the same z-order as the rest of the scene (but rendered over any bricks in the same spot).

Right now rendering the hand is done in BrickPicker.RenderFrame() which is called at the end of Scene.RenderFrame(). This will have to be changed so the hand is rendered by Scene.RenderFrame() entirely.

The method is slightly different between the two: Scene.RenderFrame() goes cell-by-cell bottom-to-top, left-to-right rendering the bricks - BrickPicker.RenderFrame() simply renders each brick from the hand which is already guaranteed to be in z-order.

Probably the easiest way to implement this is to: