Plethora Peripherals

Plethora Peripherals

3M Downloads

2d Frame on 3d Canvas difference between 1.12.2 and 1.19

Wojbie opened this issue ยท 0 comments

commented

2d Frame on 3d Canvas is anchored to different point and is wrong size:

1.12.2
obraz

1.19.3
obraz

Yellow box is coordinates screen is put on. red is 0,0 and green is on .getSize() location.

It seems 1.19.3 version has point 0,0 in center. getSize() point is somewhere off and it allows of drawing outside of 0,0 -> .getSize() range. This results in gigantically bigger frame then expected.

Additionally it seems to put screen up and to right of place where screen is put instead of down and to right.

Also there is change that makes default sized text unreadable on that big frame but that might be side effect of it ending up bigger then expected.

Rotation seems to work correctly accounting for different anchoring point

javaw_2023-01-02_12-05-12.mp4
javaw_2023-01-02_12-07-37.mp4

Code used in examples:

local ni = peripheral.wrap("back")
ni.canvas3d().clear()
local canvas = ni.canvas3d().create()

local el = {}

el[1] = canvas.addBox(0,0,0,0.1,0.1,0.1,0xffff00ff)
el[2] = canvas.addFrame({0,0,0})
print(el[2].getSize())

el[2].addRectangle(-100000, -100000, 200000, 200000, 0x0000fff0)

el[2].addRectangle(0, 0, 10, 10, 0xff0000ff)
local a,b = el[2].getSize()
el[2].addRectangle(a-10, b-10, 10, 10, 0x00ff00ff)

el[2].addText({0,0}, "debug long sentence that is unreadable", 0xffffffff, 1)

local state = true
while true do
  for _,e in ipairs(el) do
    e.setDepthTested(state)
  end  
  sleep(2)
  state = not state
end