mirror of
https://github.com/mii443/rust-openvr.git
synced 2025-08-22 16:25:36 +00:00
fixed project name, added travis to build docs
This commit is contained in:
17
.travis.yml
17
.travis.yml
@ -1,5 +1,16 @@
|
||||
language: rust
|
||||
rust:
|
||||
- stable
|
||||
- beta
|
||||
- nightly
|
||||
- stable
|
||||
- beta
|
||||
- nightly
|
||||
after_success: |
|
||||
[ $TRAVIS_BRANCH = master ] &&
|
||||
[ $TRAVIS_PULL_REQUEST = false ] &&
|
||||
cargo doc &&
|
||||
echo "<meta http-equiv=refresh content=0;url=`echo $TRAVIS_REPO_SLUG | cut -d '/' -f 2`/index.html>" > target/doc/index.html &&
|
||||
sudo pip install ghp-import &&
|
||||
ghp-import -n target/doc &&
|
||||
git push -fq https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages
|
||||
env:
|
||||
global:
|
||||
secure: EWhZMkAWuLzClX2ccFavodnxIlthv/Xc/n2oP9lmddvhqVlHC9MeVKZj/9rLYYhDA6AWNPv9m79aRZJ3PNf/iuIuf1jC1VNDIuD4teCbFMrX3C1QcUN37llEIu4n8YlPRFa2gLYRVqyh5rWS+zde/RM/3b8cw0i8/k/yux/ehqbFUSYcRVuZWNtBwUJw0Nmzii/nzzz6zTdPWqsOkoIjDbexQnceZ7TzrZbJBfJeU8xyiGLaZDTUSOsvQWw157uwX1nq9XOLutth0dbbCixFALa6ALU7n+x5XMDZGdo+F61ul3qHX8ZnPZ4Wl2DEzC9zVyB/ECG9TdUUiGHshEhLXa/FBKqTG6D9NSAsrEhcqlQ/ZIIuCS9PQEQCILJqaZbykx0AUi1W237AGUb2sKOCXHqPn7SiiYTtIMNPk8RumeNtxOGp+AAC/50epGocDOXglCEM6EcdwYtp6nSi9dqmRoBkNMJwWYjddx/OA/cU8tBMEVXpgRUe/vLj+gUqNcCGFvQ1Yd+wsBAklvwzn3fuVDgyWo/hIhJy8wpAEoiv+wJbzjnaseGoMRUDEwLHChzMUNbFmVdfve/oZlHyvpHlkwmuwy5B8BsppcJr6CoQ85DD1k4tM3dDGeZ3XSFAd33n5adsrLtx6nQlGfbzTaXZp9u0n7Hv6vBNz9DEreBifa0=
|
||||
|
11
Cargo.lock
generated
Normal file
11
Cargo.lock
generated
Normal file
@ -0,0 +1,11 @@
|
||||
[root]
|
||||
name = "openvr"
|
||||
version = "0.2.0"
|
||||
dependencies = [
|
||||
"openvr_sys 0.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "openvr_sys"
|
||||
version = "0.1.0"
|
||||
|
@ -1,9 +1,10 @@
|
||||
[package]
|
||||
name = "vr"
|
||||
version = "0.1.0"
|
||||
name = "openvr"
|
||||
version = "0.2.0"
|
||||
authors = [
|
||||
"Colin Sherratt",
|
||||
"Erick Tryzelaar"
|
||||
"Erick Tryzelaar",
|
||||
"Rene Eichhorn"
|
||||
]
|
||||
|
||||
[lib]
|
||||
@ -11,4 +12,4 @@ name = "vr"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies.openvr_sys]
|
||||
path = "src/sys/"
|
||||
path = "src/sys/"
|
||||
|
8
LICENSE.md
Normal file
8
LICENSE.md
Normal file
@ -0,0 +1,8 @@
|
||||
The MIT License (MIT)
|
||||
Copyright (c) 2016 Colin Sherratt, Erick Tryzelaar, Rene Eichhorn
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@ -29,14 +29,14 @@ Using rust-openvr
|
||||
|
||||
extern crate openvr;
|
||||
|
||||
use ovr::{SensorCapabilities, Ovr};
|
||||
use openvr::{SensorCapabilities, Ovr};
|
||||
|
||||
fn main() {
|
||||
// Initalize the Oculus VR library
|
||||
let ovr = match Ovr::init() {
|
||||
Some(ovr) => ovr,
|
||||
None => {
|
||||
println!("Could not initialize Oculus SDK");
|
||||
println!("Could not initialize OpenVR SDK");
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
14
src/lib.rs
14
src/lib.rs
@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
extern crate openvr_sys;
|
||||
|
||||
pub struct IVRSystem(*const ());
|
||||
@ -184,7 +182,7 @@ impl IVRSystem {
|
||||
}
|
||||
}
|
||||
|
||||
/// Computes the distortion caused by the optics
|
||||
/// Computes the distortion caused by the optics
|
||||
pub fn compute_distortion(&self, eye: Eye, u: f32, v: f32) -> DistortionCoordinates {
|
||||
unsafe {
|
||||
let coord = openvr_sys::VR_IVRSystem_ComputeDistortion(
|
||||
@ -197,10 +195,10 @@ impl IVRSystem {
|
||||
blue: coord.rfBlue,
|
||||
green: coord.rfGreen
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Computes the distortion caused by the optics
|
||||
/// Computes the distortion caused by the optics
|
||||
pub fn eye_to_head_transform(&self, eye: Eye) -> [[f32; 4]; 3] {
|
||||
unsafe {
|
||||
let mat = openvr_sys::VR_IVRSystem_GetEyeToHeadTransform(
|
||||
@ -208,10 +206,10 @@ impl IVRSystem {
|
||||
eye.to_raw(),
|
||||
);
|
||||
mat.m
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Computes the distortion caused by the optics
|
||||
/// Computes the distortion caused by the optics
|
||||
pub fn time_since_last_vsync(&self) -> Option<(f32, u64)> {
|
||||
unsafe {
|
||||
let mut frame = 0;
|
||||
@ -227,7 +225,7 @@ impl IVRSystem {
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Fetch the tracked results from the HMD
|
||||
|
Reference in New Issue
Block a user