openvr lines

This commit is contained in:
galister
2026-01-15 17:36:58 +09:00
parent 6ab1db9a76
commit ea62be8ad7
2 changed files with 198 additions and 4 deletions

View File

@@ -123,14 +123,13 @@ impl LinePool {
let center = (start + end) * 0.5;
let dir_norm = dir / len;
let xform = Affine3A::from_scale_rotation_translation(
Vec3::new(1., len / 0.002, 1.),
let xform = Affine3A::from_rotation_translation(
Quat::from_rotation_arc(Vec3::Z, dir_norm.into()),
center.into(),
);
let rotation = Affine3A::from_axis_angle(Vec3::X, PI * 1.5);
let mut transform = xform * rotation;
let rotation = Affine3A::from_axis_angle(Vec3::X, -PI * 0.5);
let mut transform = xform * rotation * Affine3A::from_scale(Vec3::new(1., len / 0.002, 1.));
let to_hmd = hmd.translation - center;
let sides = [Vec3A::Z, Vec3A::X, Vec3A::NEG_Z, Vec3A::NEG_X];

View File

@@ -0,0 +1,195 @@
// This code was autogenerated with `dbus-codegen-rust -g -m None -d org.kde.keyboard -p /Layouts`, see https://github.com/diwic/dbus-rs
use dbus;
#[allow(unused_imports)]
use dbus::arg;
use dbus::blocking;
pub trait OrgKdeKeyboardLayouts {
fn switch_to_next_layout(&self) -> Result<(), dbus::Error>;
fn switch_to_previous_layout(&self) -> Result<(), dbus::Error>;
fn set_layout(&self, index: u32) -> Result<bool, dbus::Error>;
fn get_layout(&self) -> Result<u32, dbus::Error>;
fn get_layouts_list(&self) -> Result<Vec<(String, String, String)>, dbus::Error>;
}
#[derive(Debug)]
pub struct OrgKdeKeyboardLayoutsLayoutChanged {
pub index: u32,
}
impl arg::AppendAll for OrgKdeKeyboardLayoutsLayoutChanged {
fn append(&self, i: &mut arg::IterAppend) {
arg::RefArg::append(&self.index, i);
}
}
impl arg::ReadAll for OrgKdeKeyboardLayoutsLayoutChanged {
fn read(i: &mut arg::Iter) -> Result<Self, arg::TypeMismatchError> {
Ok(OrgKdeKeyboardLayoutsLayoutChanged { index: i.read()? })
}
}
impl dbus::message::SignalArgs for OrgKdeKeyboardLayoutsLayoutChanged {
const NAME: &'static str = "layoutChanged";
const INTERFACE: &'static str = "org.kde.KeyboardLayouts";
}
#[derive(Debug)]
pub struct OrgKdeKeyboardLayoutsLayoutListChanged {}
impl arg::AppendAll for OrgKdeKeyboardLayoutsLayoutListChanged {
fn append(&self, _: &mut arg::IterAppend) {}
}
impl arg::ReadAll for OrgKdeKeyboardLayoutsLayoutListChanged {
fn read(_: &mut arg::Iter) -> Result<Self, arg::TypeMismatchError> {
Ok(OrgKdeKeyboardLayoutsLayoutListChanged {})
}
}
impl dbus::message::SignalArgs for OrgKdeKeyboardLayoutsLayoutListChanged {
const NAME: &'static str = "layoutListChanged";
const INTERFACE: &'static str = "org.kde.KeyboardLayouts";
}
impl<'a, T: blocking::BlockingSender, C: ::std::ops::Deref<Target = T>> OrgKdeKeyboardLayouts
for blocking::Proxy<'a, C>
{
fn switch_to_next_layout(&self) -> Result<(), dbus::Error> {
self.method_call("org.kde.KeyboardLayouts", "switchToNextLayout", ())
}
fn switch_to_previous_layout(&self) -> Result<(), dbus::Error> {
self.method_call("org.kde.KeyboardLayouts", "switchToPreviousLayout", ())
}
fn set_layout(&self, index: u32) -> Result<bool, dbus::Error> {
self.method_call("org.kde.KeyboardLayouts", "setLayout", (index,))
.and_then(|r: (bool,)| Ok(r.0))
}
fn get_layout(&self) -> Result<u32, dbus::Error> {
self.method_call("org.kde.KeyboardLayouts", "getLayout", ())
.and_then(|r: (u32,)| Ok(r.0))
}
fn get_layouts_list(&self) -> Result<Vec<(String, String, String)>, dbus::Error> {
self.method_call("org.kde.KeyboardLayouts", "getLayoutsList", ())
.and_then(|r: (Vec<(String, String, String)>,)| Ok(r.0))
}
}
pub trait OrgFreedesktopDBusProperties {
fn get<R0: for<'b> arg::Get<'b> + 'static>(
&self,
interface_name: &str,
property_name: &str,
) -> Result<R0, dbus::Error>;
fn set<I2: arg::Arg + arg::Append>(
&self,
interface_name: &str,
property_name: &str,
value: I2,
) -> Result<(), dbus::Error>;
fn get_all(&self, interface_name: &str) -> Result<arg::PropMap, dbus::Error>;
}
#[derive(Debug)]
pub struct OrgFreedesktopDBusPropertiesPropertiesChanged {
pub interface_name: String,
pub changed_properties: arg::PropMap,
pub invalidated_properties: Vec<String>,
}
impl arg::AppendAll for OrgFreedesktopDBusPropertiesPropertiesChanged {
fn append(&self, i: &mut arg::IterAppend) {
arg::RefArg::append(&self.interface_name, i);
arg::RefArg::append(&self.changed_properties, i);
arg::RefArg::append(&self.invalidated_properties, i);
}
}
impl arg::ReadAll for OrgFreedesktopDBusPropertiesPropertiesChanged {
fn read(i: &mut arg::Iter) -> Result<Self, arg::TypeMismatchError> {
Ok(OrgFreedesktopDBusPropertiesPropertiesChanged {
interface_name: i.read()?,
changed_properties: i.read()?,
invalidated_properties: i.read()?,
})
}
}
impl dbus::message::SignalArgs for OrgFreedesktopDBusPropertiesPropertiesChanged {
const NAME: &'static str = "PropertiesChanged";
const INTERFACE: &'static str = "org.freedesktop.DBus.Properties";
}
impl<'a, T: blocking::BlockingSender, C: ::std::ops::Deref<Target = T>> OrgFreedesktopDBusProperties
for blocking::Proxy<'a, C>
{
fn get<R0: for<'b> arg::Get<'b> + 'static>(
&self,
interface_name: &str,
property_name: &str,
) -> Result<R0, dbus::Error> {
self.method_call(
"org.freedesktop.DBus.Properties",
"Get",
(interface_name, property_name),
)
.and_then(|r: (arg::Variant<R0>,)| Ok((r.0).0))
}
fn set<I2: arg::Arg + arg::Append>(
&self,
interface_name: &str,
property_name: &str,
value: I2,
) -> Result<(), dbus::Error> {
self.method_call(
"org.freedesktop.DBus.Properties",
"Set",
(interface_name, property_name, arg::Variant(value)),
)
}
fn get_all(&self, interface_name: &str) -> Result<arg::PropMap, dbus::Error> {
self.method_call(
"org.freedesktop.DBus.Properties",
"GetAll",
(interface_name,),
)
.and_then(|r: (arg::PropMap,)| Ok(r.0))
}
}
pub trait OrgFreedesktopDBusIntrospectable {
fn introspect(&self) -> Result<String, dbus::Error>;
}
impl<'a, T: blocking::BlockingSender, C: ::std::ops::Deref<Target = T>>
OrgFreedesktopDBusIntrospectable for blocking::Proxy<'a, C>
{
fn introspect(&self) -> Result<String, dbus::Error> {
self.method_call("org.freedesktop.DBus.Introspectable", "Introspect", ())
.and_then(|r: (String,)| Ok(r.0))
}
}
pub trait OrgFreedesktopDBusPeer {
fn ping(&self) -> Result<(), dbus::Error>;
fn get_machine_id(&self) -> Result<String, dbus::Error>;
}
impl<'a, T: blocking::BlockingSender, C: ::std::ops::Deref<Target = T>> OrgFreedesktopDBusPeer
for blocking::Proxy<'a, C>
{
fn ping(&self) -> Result<(), dbus::Error> {
self.method_call("org.freedesktop.DBus.Peer", "Ping", ())
}
fn get_machine_id(&self) -> Result<String, dbus::Error> {
self.method_call("org.freedesktop.DBus.Peer", "GetMachineId", ())
.and_then(|r: (String,)| Ok(r.0))
}
}