Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fancy rendering of printouts #553

wants to merge 3 commits into
base: master


Copy link

@SquidDev SquidDev commented Jun 18, 2018

This renders the contents of printed pages directly when holding them in your hand or displaying them in an item frame. Please note that this implementation isn't currently super optimal as we end up constructing TextBuffers every frame. I would like to get some feedback on a couple of things before going there.

Some things to discuss

  • Item frame interaction is a little funky, as a lot of the behaviour is hard-coded for maps. The key problems are:

    • Rotating will use multiples of 45⁰ for angles (instead of map's 90), meaning it will stick out the side. We could invert the rotation and then apply our own in the event handler, but it's a little ugly.
    • We use the default item frame background instead of a solid one. I don't think this is too much of an issue as it's not normally visible (aside from on the edges), but is problematic when the map is rotated.

    While it would be possible to PR some extensions item frame rendering extensions into Forge for this, I'd rather discuss things here first.


Printout in hand Printout as map

Originally suggested in SquidDev-CC/CC-Tweaked#39.

SquidDev added 2 commits Jun 18, 2018
 - When held in first-person, single pages are displayed like a map.
 - When placed in an item frame, the page is drawn instead of the actual
 - The current page is always centred when rendering in a GUI, with
   the turned pages moving from the sides.
 - Pages are no longer evenly distributed from the centre - they follow
   an exponential decay curve, so ones further out are closer together
   (a bit like an open book).
 - Render pages and books in item frames/in-hand (rather than just
   single pages).

This currently does some very dirty things with z values in order to
prevent z-fighting. It would be nice to avoid that, though turning off
writing to the z buffer causes issues with the bounding box.
@SquidDev SquidDev force-pushed the SquidDev-CC:feature/fancy-printout branch from bff730d to 50797bb Jul 6, 2018
Closes #63
ccserver pushed a commit to ccserver/ComputerCraft that referenced this pull request Sep 16, 2019

Fancy rendering of printouts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant
You can’t perform that action at this time.