Advertisement
9551

test

Oct 13th, 2021
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.20 KB | None | 0 0
  1. local pretty = require("cc.pretty")
  2. --RendererH3+
  3. local main = require("engine")
  4. local per = peripheral.wrap("top")
  5. local can = per.canvas()
  6. local width,height = can.getSize()
  7. --[[local win
  8. local ot = term
  9. term = peripheral.find("monitor")
  10. term.setTextScale(0.5)
  11. term.setCursorPos(10,10)
  12. width,height = term.getSize()
  13. term = window.create(term,1,1,width,height)]]
  14. local objList = { frame=main.objects.newCube() }
  15. objList.frame.color = main.createColor({0xFF0000FF})
  16. objList.frame.loc.z = -8
  17. objList.frame.scale.x = 1.8
  18. objList.frame.scale.y = 1.8
  19. objList.frame.scale.z = 1.8
  20. local frames = 100000
  21. local st = os.epoch("utc")/1000
  22. local args = main.getDrawArgs()
  23. args.drawTriangles = true
  24. args.drawWireFrame = false
  25. args.doCulling = true  
  26. for i=1,frames do
  27.     objList.frame.rot.y =  os.epoch()/2000
  28.     objList.frame.rot.x =  os.epoch()/3000
  29.     can.clear()
  30.     local pers = main.createPerspective(width,height,40)
  31.     local cam = main.createCamera(vector.new(0,0,0),vector.new(0,0,0))
  32.     local objectsInt = main.transform(objList,pers,cam)
  33.     main.drawTransformed(can,objectsInt,args)
  34.     sleep(0.05)
  35. end
  36. local et = os.epoch("utc")/1000
  37. local fps = frames/(et-st)
  38. print("FPS: "..fps)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement