1 # This file is part of NIT (http://www.nitlanguage.org).
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 # Services from the Google Cardboard SDK for virtual reality on Android
17 # Projects using this module should keep the `cardboard.jar` archive in the
18 # `libs` folder at the root of the project.
21 # * Download `cardboard.jar` from
22 # https://raw.githubusercontent.com/googlesamples/cardboard-java/master/CardboardSample/libs/cardboard.jar
23 # * Read about Cardboard at
24 # https://developers.google.com/cardboard/
25 # * Find the Cardboard SDK documentation at
26 # https://developers.google.com/cardboard/android/latest/reference/com/google/vrtoolkit/cardboard/package-summary
29 import java
::collections
30 import native_app_glue
33 import com.google.vrtoolkit.cardboard.CardboardActivity;
34 import com.google.vrtoolkit.cardboard.sensors.HeadTracker;
37 # Provides head tracking information from the device IMU
39 # The corresponding Java class is no longer documented, but it is still useful.
40 extern class NativeHeadTracker in "Java" `{ com.google.vrtoolkit.cardboard.sensors.HeadTracker `}
43 # Instantiate a new `NativeHeadTracker` for the given `context
`
44 new (context: NativeContext) in "Java" `{
45 return HeadTracker.createFromContext
(context
);
48 # Start tracking head movement
49 fun start_tracking in "Java" `{ self.startTracking(); `}
51 # Stop tracking head movement
52 fun stop_tracking
in "Java" `{ self.stopTracking(); `}
54 # Apply correction to the gyroscope values
55 fun gyro_bias=(matrix: JavaFloatArray) in "Java" `{
56 self.setGyroBias
(matrix
);
59 # Enable finer analysis using the neck as center of movement
60 fun neck_model_enabled=(value: Bool) in "Java" `{
61 self.setNeckModelEnabled
(value
);
64 # Fill `matrix
` with the last rotation matrix calculated from head movements
66 # Require: matrix.length >= offset + 16
67 fun last_head_view(matrix: JavaFloatArray, offset: Int) in "Java" `{
68 self.getLastHeadView
(matrix
, (int
)offset
);