Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
TODO = True
from mathutils import (
Matrix,
Vector,
)
class HMD_Data:
status = None
projection_matrix = Matrix()
modelview_matrix = Matrix()
interpupillary_distance = Vector((0.0, 0.0))
width = 0
height = 0
fbo = 0
texture = 0
class HMD:
__slots__ = {
"_device",
"_projection_matrix",
"_modelview_matrix",
"_interpupillary_distance",
"_width",
"_height",
"_fbo",
"_texture",
}
def __init__(self, display_backend):
self._device = None
self._projection_matrix = Matrix()
self._modelview_matrix = Matrix()
self._interpupillary_distance = Vector((0.0, 0.0))
self._width = 0
self._height = 0
self._fbo = 0
self._texture = 0
from .oculus import Oculus
from .debug import Debug
displays = {
'OCULUS':Oculus,
'DEBUG':Debug,
}
assert(display_backend in displays)
self._device = displays[display_backend]()
@property
def fbo(self):
return self._fbo
@property
def texture(self):
return self._texture
@property
def width(self):
return self._width
@property
def height(self):
return self._height
@property
def projection_matrix(self):
return self._projection_matrix
@property
def modelview_matrix(self):
return TODO
def isConnected(self):
"""
Check if device is connected
:return: return True if the device is connected
:rtype: bool
"""
return self._device.isConnected()
def init(self):
"""
Initialize device
:return: return True if the device was properly initialized
:rtype: bool
"""
return self._device.init()
def loop(self):
"""
Get fresh tracking data
"""
return self._device.loop()
def frameReady(self):
"""
The frame is ready to be send to the device
"""
return self._device.frameReady()
def quit(self):
"""
Garbage collection
"""
return self._device.quit()