line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OpenHMD::Backend::Inline; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
29562
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
83
|
|
7
|
1
|
|
|
1
|
|
746
|
use Const::Fast; |
|
1
|
|
|
|
|
2839
|
|
|
1
|
|
|
|
|
6
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
68
|
use Exporter qw(import); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use Inline ( |
12
|
1
|
|
|
|
|
9
|
C => 'DATA', |
13
|
|
|
|
|
|
|
libs => '-lopenhmd', |
14
|
1
|
|
|
1
|
|
1035
|
); |
|
1
|
|
|
|
|
25549
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $VERSION = '0.001'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
const our $OHMD_VENDOR => 0; |
19
|
|
|
|
|
|
|
const our $OHMD_PRODUCT => 1; |
20
|
|
|
|
|
|
|
const our $OHMD_PATH => 2; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
const our $OHMD_S_OK => 0; |
23
|
|
|
|
|
|
|
const our $OHMD_S_UNKNOWN_ERROR => -1; |
24
|
|
|
|
|
|
|
const our $OHMD_S_INVALID_PARAMETER => -2; |
25
|
|
|
|
|
|
|
const our $OHMD_S_USER_RESERVED => -16_384; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
const our $OHMD_SCREEN_HORIZONTAL_RESOLUTION => 0; |
28
|
|
|
|
|
|
|
const our $OHMD_SCREEN_VERTICAL_RESOLUTION => 1; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
const our $OHMD_ROTATION_QUAT => 1; |
31
|
|
|
|
|
|
|
const our $OHMD_LEFT_EYE_GL_MODELVIEW_MATRIX => 2; |
32
|
|
|
|
|
|
|
const our $OHMD_RIGHT_EYE_GL_MODELVIEW_MATRIX => 3; |
33
|
|
|
|
|
|
|
const our $OHMD_LEFT_EYE_GL_PROJECTION_MATRIX => 4; |
34
|
|
|
|
|
|
|
const our $OHMD_RIGHT_EYE_GL_PROJECTION_MATRIX => 5; |
35
|
|
|
|
|
|
|
const our $OHMD_POSITION_VECTOR => 6; |
36
|
|
|
|
|
|
|
const our $OHMD_SCREEN_HORIZONTAL_SIZE => 7; |
37
|
|
|
|
|
|
|
const our $OHMD_SCREEN_VERTICAL_SIZE => 8; |
38
|
|
|
|
|
|
|
const our $OHMD_LENS_HORIZONTAL_SEPARATION => 9; |
39
|
|
|
|
|
|
|
const our $OHMD_LENS_VERTICAL_POSITION => 10; |
40
|
|
|
|
|
|
|
const our $OHMD_LEFT_EYE_FOV => 11; |
41
|
|
|
|
|
|
|
const our $OHMD_LEFT_EYE_ASPECT_RATIO => 12; |
42
|
|
|
|
|
|
|
const our $OHMD_RIGHT_EYE_FOV => 13; |
43
|
|
|
|
|
|
|
const our $OHMD_RIGHT_EYE_ASPECT_RATIO => 14; |
44
|
|
|
|
|
|
|
const our $OHMD_EYE_IPD => 15; |
45
|
|
|
|
|
|
|
const our $OHMD_PROJECTION_ZFAR => 16; |
46
|
|
|
|
|
|
|
const our $OHMD_PROJECTION_ZNEAR => 17; |
47
|
|
|
|
|
|
|
const our $OHMD_DISTORTION_K => 18; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
50
|
|
|
|
|
|
|
constants => [qw( |
51
|
|
|
|
|
|
|
$OHMD_DISTORTION_K |
52
|
|
|
|
|
|
|
$OHMD_EYE_IPD |
53
|
|
|
|
|
|
|
$OHMD_LEFT_EYE_ASPECT_RATIO |
54
|
|
|
|
|
|
|
$OHMD_LEFT_EYE_FOV |
55
|
|
|
|
|
|
|
$OHMD_LEFT_EYE_GL_MODELVIEW_MATRIX |
56
|
|
|
|
|
|
|
$OHMD_LEFT_EYE_GL_PROJECTION_MATRIX |
57
|
|
|
|
|
|
|
$OHMD_LENS_HORIZONTAL_SEPARATION |
58
|
|
|
|
|
|
|
$OHMD_LENS_VERTICAL_POSITION |
59
|
|
|
|
|
|
|
$OHMD_PATH |
60
|
|
|
|
|
|
|
$OHMD_POSITION_VECTOR |
61
|
|
|
|
|
|
|
$OHMD_PRODUCT |
62
|
|
|
|
|
|
|
$OHMD_PROJECTION_ZFAR |
63
|
|
|
|
|
|
|
$OHMD_PROJECTION_ZNEAR |
64
|
|
|
|
|
|
|
$OHMD_RIGHT_EYE_ASPECT_RATIO |
65
|
|
|
|
|
|
|
$OHMD_RIGHT_EYE_FOV |
66
|
|
|
|
|
|
|
$OHMD_RIGHT_EYE_GL_MODELVIEW_MATRIX |
67
|
|
|
|
|
|
|
$OHMD_RIGHT_EYE_GL_PROJECTION_MATRIX |
68
|
|
|
|
|
|
|
$OHMD_ROTATION_QUAT |
69
|
|
|
|
|
|
|
$OHMD_SCREEN_HORIZONTAL_RESOLUTION |
70
|
|
|
|
|
|
|
$OHMD_SCREEN_HORIZONTAL_SIZE |
71
|
|
|
|
|
|
|
$OHMD_SCREEN_VERTICAL_RESOLUTION |
72
|
|
|
|
|
|
|
$OHMD_SCREEN_VERTICAL_SIZE |
73
|
|
|
|
|
|
|
$OHMD_S_INVALID_PARAMETER |
74
|
|
|
|
|
|
|
$OHMD_S_OK |
75
|
|
|
|
|
|
|
$OHMD_S_UNKNOWN_ERROR |
76
|
|
|
|
|
|
|
$OHMD_S_USER_RESERVED |
77
|
|
|
|
|
|
|
$OHMD_VENDOR |
78
|
|
|
|
|
|
|
)], |
79
|
|
|
|
|
|
|
functions => [qw( |
80
|
|
|
|
|
|
|
ohmd_close_device |
81
|
|
|
|
|
|
|
ohmd_ctx_create |
82
|
|
|
|
|
|
|
ohmd_ctx_destroy |
83
|
|
|
|
|
|
|
ohmd_ctx_get_error |
84
|
|
|
|
|
|
|
ohmd_ctx_probe |
85
|
|
|
|
|
|
|
ohmd_ctx_update |
86
|
|
|
|
|
|
|
ohmd_device_getf |
87
|
|
|
|
|
|
|
ohmd_device_geti |
88
|
|
|
|
|
|
|
ohmd_device_setf |
89
|
|
|
|
|
|
|
ohmd_list_gets |
90
|
|
|
|
|
|
|
ohmd_list_open_device |
91
|
|
|
|
|
|
|
)], |
92
|
|
|
|
|
|
|
); |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
do { |
95
|
|
|
|
|
|
|
my %seen; |
96
|
|
|
|
|
|
|
push @{ $EXPORT_TAGS{'all'} }, |
97
|
|
|
|
|
|
|
grep { !$seen{$_}++ } |
98
|
|
|
|
|
|
|
map { @{ $EXPORT_TAGS{$_} } } |
99
|
|
|
|
|
|
|
keys %EXPORT_TAGS; |
100
|
|
|
|
|
|
|
}; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Exporter::export_ok_tags('all'); |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub ohmd_close_device { |
105
|
0
|
0
|
|
0
|
1
|
|
croak 'Too few arguments' if scalar @_ < 1; |
106
|
0
|
0
|
|
|
|
|
croak 'Too many arguments' if scalar @_ > 1; |
107
|
|
|
|
|
|
|
|
108
|
0
|
|
|
|
|
|
return _inline_ohmd_close_device(@_); |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub ohmd_ctx_create { |
112
|
0
|
0
|
|
0
|
1
|
|
croak 'Too many arguments' if scalar @_ > 0; |
113
|
|
|
|
|
|
|
|
114
|
0
|
|
|
|
|
|
return _inline_ohmd_ctx_create(); |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub ohmd_ctx_destroy { |
118
|
0
|
0
|
|
0
|
1
|
|
croak 'Too few arguments' if scalar @_ < 1; |
119
|
0
|
0
|
|
|
|
|
croak 'Too many arguments' if scalar @_ > 1; |
120
|
|
|
|
|
|
|
|
121
|
0
|
|
|
|
|
|
_inline_ohmd_ctx_destroy(@_); |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub ohmd_ctx_get_error { |
125
|
0
|
0
|
|
0
|
1
|
|
croak 'Too few arguments' if scalar @_ < 1; |
126
|
0
|
0
|
|
|
|
|
croak 'Too many arguments' if scalar @_ > 1; |
127
|
|
|
|
|
|
|
|
128
|
0
|
|
|
|
|
|
return _inline_ohmd_ctx_get_error(@_); |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub ohmd_ctx_probe { |
132
|
0
|
0
|
|
0
|
1
|
|
croak 'Too few arguments' if scalar @_ < 1; |
133
|
0
|
0
|
|
|
|
|
croak 'Too many arguments' if scalar @_ > 1; |
134
|
|
|
|
|
|
|
|
135
|
0
|
|
|
|
|
|
return _inline_ohmd_ctx_probe(@_); |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
sub ohmd_ctx_update { |
139
|
0
|
0
|
|
0
|
1
|
|
croak 'Too few arguments' if scalar @_ < 1; |
140
|
0
|
0
|
|
|
|
|
croak 'Too many arguments' if scalar @_ > 1; |
141
|
|
|
|
|
|
|
|
142
|
0
|
|
|
|
|
|
_inline_ohmd_ctx_update(@_); |
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
sub ohmd_device_getf { |
146
|
0
|
0
|
|
0
|
1
|
|
croak 'Too few arguments' if scalar @_ < 3; |
147
|
0
|
0
|
|
|
|
|
croak 'Too many arguments' if scalar @_ > 3; |
148
|
|
|
|
|
|
|
|
149
|
0
|
|
|
|
|
|
return _inline_ohmd_device_getf(@_); |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
sub ohmd_device_geti { |
153
|
0
|
0
|
|
0
|
1
|
|
croak 'Too few arguments' if scalar @_ < 3; |
154
|
0
|
0
|
|
|
|
|
croak 'Too many arguments' if scalar @_ > 3; |
155
|
|
|
|
|
|
|
|
156
|
0
|
|
|
|
|
|
return _inline_ohmd_device_geti(@_); |
157
|
|
|
|
|
|
|
} |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
sub ohmd_device_setf { |
160
|
0
|
0
|
|
0
|
1
|
|
croak 'Too few arguments' if scalar @_ < 3; |
161
|
0
|
0
|
|
|
|
|
croak 'Too many arguments' if scalar @_ > 3; |
162
|
|
|
|
|
|
|
|
163
|
0
|
|
|
|
|
|
return _inline_ohmd_device_setf(@_); |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
sub ohmd_list_gets { |
167
|
0
|
0
|
|
0
|
1
|
|
croak 'Too few arguments' if scalar @_ < 3; |
168
|
0
|
0
|
|
|
|
|
croak 'Too many arguments' if scalar @_ > 3; |
169
|
|
|
|
|
|
|
|
170
|
0
|
|
|
|
|
|
return _inline_ohmd_list_gets(@_); |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
sub ohmd_list_open_device { |
174
|
0
|
0
|
|
0
|
1
|
|
croak 'Too few arguments' if scalar @_ < 2; |
175
|
0
|
0
|
|
|
|
|
croak 'Too many arguments' if scalar @_ > 2; |
176
|
|
|
|
|
|
|
|
177
|
0
|
|
|
|
|
|
return _inline_ohmd_list_open_device(@_); |
178
|
|
|
|
|
|
|
} |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
1; |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
__DATA__ |