| 14 | import fieldbox.boxes.Boxes.window |
| 15 | import fieldbox.ui.GlfwCallbackDelegate |
| 16 | import fieldagent.Main.OS |
| 17 | import trace.graphics.remote.RemoteServer |
| 18 | |
| 19 | class SimpleOculusTarget { |
| 20 | |
| 21 | companion object { |
| 22 | |
| 23 | @JvmStatic |
| 24 | var disable = !Stage.VR |
| 25 | @JvmStatic |
| 26 | var openvr = true |
| 27 | |
| 28 | var window: Window? = null |
| 29 | var o: OculusDrawTarget2? = null |
| 30 | var o2: OpenVRDrawTarget? = null |
| 31 | // var fake: FakeOculusDrawTarget? = null |
| 32 | |
| 33 | val queue = mutableListOf<() -> Unit>() |
| 34 | |
| 35 | @JvmField |
| 36 | val camera: SimpleCamera? = null |
| 37 | |
| 38 | init { |
| 39 | |
| 40 | if (disable) |
| 41 | { |
| 42 | |
| 43 | } |
| 44 | else { |
| 45 | window = object : Window(0, 0, 1024, 512, "Field / VR preview") { |
| 46 | override fun makeCallback(): GlfwCallback { |
| 47 | |
| 48 | return object : GlfwCallbackDelegate(super.makeCallback()) { |
| 49 | override fun windowRefresh(l: Long) { |
| 50 | requestRepaint() |
| 51 | } |
| 52 | |
| 53 | override fun windowClose(l: Long): Boolean { |
| 54 | return true |
| 55 | } |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | window!!.setBounds(0, 0, 1024, 512) |
| 61 | } |
| 62 | |
| 63 | if (!disable and Main.OS.isWindows() and !openvr) { |
| 64 | o = OculusDrawTarget2() |
| 65 | o!!.debugBlit = true |
| 66 | // o.debugFBO = true |
| 67 | o!!.init(window!!.scene) |
| 68 | } else if (!disable and Main.OS.isWindows() and openvr) { |
| 69 | o2 = OpenVRDrawTarget() |
| 70 | o2!!.debug = true |
| 71 | o2!!.init(window!!.scene) |
| 72 | } else if (!disable) { |
| 73 | // fake = FakeOculusDrawTarget(1344, 1600) |
nothing calls this directly
no test coverage detected