Skip to content

Commit

Permalink
add automatic tracker toggle for SteamVR (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
ImUrX authored Mar 8, 2024
1 parent 0bcd19c commit a5fd6ae
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 14 deletions.
14 changes: 12 additions & 2 deletions protocol/cpp/include/solarxr_protocol/generated/all_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -5163,7 +5163,8 @@ struct SteamVRTrackersSetting FLATBUFFERS_FINAL_CLASS : private flatbuffers::Tab
VT_FEET = 8,
VT_KNEES = 10,
VT_ELBOWS = 12,
VT_HANDS = 14
VT_HANDS = 14,
VT_AUTOMATICTRACKERTOGGLE = 16
};
bool waist() const {
return GetField<uint8_t>(VT_WAIST, 0) != 0;
Expand All @@ -5183,6 +5184,9 @@ struct SteamVRTrackersSetting FLATBUFFERS_FINAL_CLASS : private flatbuffers::Tab
bool hands() const {
return GetField<uint8_t>(VT_HANDS, 0) != 0;
}
bool automaticTrackerToggle() const {
return GetField<uint8_t>(VT_AUTOMATICTRACKERTOGGLE, 0) != 0;
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<uint8_t>(verifier, VT_WAIST, 1) &&
Expand All @@ -5191,6 +5195,7 @@ struct SteamVRTrackersSetting FLATBUFFERS_FINAL_CLASS : private flatbuffers::Tab
VerifyField<uint8_t>(verifier, VT_KNEES, 1) &&
VerifyField<uint8_t>(verifier, VT_ELBOWS, 1) &&
VerifyField<uint8_t>(verifier, VT_HANDS, 1) &&
VerifyField<uint8_t>(verifier, VT_AUTOMATICTRACKERTOGGLE, 1) &&
verifier.EndTable();
}
};
Expand All @@ -5217,6 +5222,9 @@ struct SteamVRTrackersSettingBuilder {
void add_hands(bool hands) {
fbb_.AddElement<uint8_t>(SteamVRTrackersSetting::VT_HANDS, static_cast<uint8_t>(hands), 0);
}
void add_automaticTrackerToggle(bool automaticTrackerToggle) {
fbb_.AddElement<uint8_t>(SteamVRTrackersSetting::VT_AUTOMATICTRACKERTOGGLE, static_cast<uint8_t>(automaticTrackerToggle), 0);
}
explicit SteamVRTrackersSettingBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
Expand All @@ -5235,8 +5243,10 @@ inline flatbuffers::Offset<SteamVRTrackersSetting> CreateSteamVRTrackersSetting(
bool feet = false,
bool knees = false,
bool elbows = false,
bool hands = false) {
bool hands = false,
bool automaticTrackerToggle = false) {
SteamVRTrackersSettingBuilder builder_(_fbb);
builder_.add_automaticTrackerToggle(automaticTrackerToggle);
builder_.add_hands(hands);
builder_.add_elbows(elbows);
builder_.add_knees(knees);
Expand Down
15 changes: 11 additions & 4 deletions protocol/java/src/solarxr_protocol/rpc/SteamVRTrackersSetting.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,18 @@ public final class SteamVRTrackersSetting extends Table {
public boolean knees() { int o = __offset(10); return o != 0 ? 0!=bb.get(o + bb_pos) : false; }
public boolean elbows() { int o = __offset(12); return o != 0 ? 0!=bb.get(o + bb_pos) : false; }
public boolean hands() { int o = __offset(14); return o != 0 ? 0!=bb.get(o + bb_pos) : false; }
public boolean automaticTrackerToggle() { int o = __offset(16); return o != 0 ? 0!=bb.get(o + bb_pos) : false; }

public static int createSteamVRTrackersSetting(FlatBufferBuilder builder,
boolean waist,
boolean chest,
boolean feet,
boolean knees,
boolean elbows,
boolean hands) {
builder.startTable(6);
boolean hands,
boolean automaticTrackerToggle) {
builder.startTable(7);
SteamVRTrackersSetting.addAutomaticTrackerToggle(builder, automaticTrackerToggle);
SteamVRTrackersSetting.addHands(builder, hands);
SteamVRTrackersSetting.addElbows(builder, elbows);
SteamVRTrackersSetting.addKnees(builder, knees);
Expand All @@ -39,13 +42,14 @@ public static int createSteamVRTrackersSetting(FlatBufferBuilder builder,
return SteamVRTrackersSetting.endSteamVRTrackersSetting(builder);
}

public static void startSteamVRTrackersSetting(FlatBufferBuilder builder) { builder.startTable(6); }
public static void startSteamVRTrackersSetting(FlatBufferBuilder builder) { builder.startTable(7); }
public static void addWaist(FlatBufferBuilder builder, boolean waist) { builder.addBoolean(0, waist, false); }
public static void addChest(FlatBufferBuilder builder, boolean chest) { builder.addBoolean(1, chest, false); }
public static void addFeet(FlatBufferBuilder builder, boolean feet) { builder.addBoolean(2, feet, false); }
public static void addKnees(FlatBufferBuilder builder, boolean knees) { builder.addBoolean(3, knees, false); }
public static void addElbows(FlatBufferBuilder builder, boolean elbows) { builder.addBoolean(4, elbows, false); }
public static void addHands(FlatBufferBuilder builder, boolean hands) { builder.addBoolean(5, hands, false); }
public static void addAutomaticTrackerToggle(FlatBufferBuilder builder, boolean automaticTrackerToggle) { builder.addBoolean(6, automaticTrackerToggle, false); }
public static int endSteamVRTrackersSetting(FlatBufferBuilder builder) {
int o = builder.endTable();
return o;
Expand Down Expand Up @@ -75,6 +79,8 @@ public void unpackTo(SteamVRTrackersSettingT _o) {
_o.setElbows(_oElbows);
boolean _oHands = hands();
_o.setHands(_oHands);
boolean _oAutomaticTrackerToggle = automaticTrackerToggle();
_o.setAutomaticTrackerToggle(_oAutomaticTrackerToggle);
}
public static int pack(FlatBufferBuilder builder, SteamVRTrackersSettingT _o) {
if (_o == null) return 0;
Expand All @@ -85,7 +91,8 @@ public static int pack(FlatBufferBuilder builder, SteamVRTrackersSettingT _o) {
_o.getFeet(),
_o.getKnees(),
_o.getElbows(),
_o.getHands());
_o.getHands(),
_o.getAutomaticTrackerToggle());
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class SteamVRTrackersSettingT {
private boolean knees;
private boolean elbows;
private boolean hands;
private boolean automaticTrackerToggle;

public boolean getWaist() { return waist; }

Expand All @@ -39,6 +40,10 @@ public class SteamVRTrackersSettingT {

public void setHands(boolean hands) { this.hands = hands; }

public boolean getAutomaticTrackerToggle() { return automaticTrackerToggle; }

public void setAutomaticTrackerToggle(boolean automaticTrackerToggle) { this.automaticTrackerToggle = automaticTrackerToggle; }


public SteamVRTrackersSettingT() {
this.waist = false;
Expand All @@ -47,6 +52,7 @@ public SteamVRTrackersSettingT() {
this.knees = false;
this.elbows = false;
this.hands = false;
this.automaticTrackerToggle = false;
}
}

14 changes: 11 additions & 3 deletions protocol/kotlin/src/solarxr_protocol/rpc/SteamVRTrackersSetting.kt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ class SteamVRTrackersSetting : Table() {
val o = __offset(14)
return if(o != 0) 0.toByte() != bb.get(o + bb_pos) else false
}
val automaticTrackerToggle : Boolean
get() {
val o = __offset(16)
return if(o != 0) 0.toByte() != bb.get(o + bb_pos) else false
}
companion object {
@JvmStatic
fun validateVersion() = Constants.FLATBUFFERS_22_10_26()
Expand All @@ -57,8 +62,9 @@ class SteamVRTrackersSetting : Table() {
return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb))
}
@JvmStatic
fun createSteamVRTrackersSetting(builder: FlatBufferBuilder, waist: Boolean, chest: Boolean, feet: Boolean, knees: Boolean, elbows: Boolean, hands: Boolean) : Int {
builder.startTable(6)
fun createSteamVRTrackersSetting(builder: FlatBufferBuilder, waist: Boolean, chest: Boolean, feet: Boolean, knees: Boolean, elbows: Boolean, hands: Boolean, automaticTrackerToggle: Boolean) : Int {
builder.startTable(7)
addAutomaticTrackerToggle(builder, automaticTrackerToggle)
addHands(builder, hands)
addElbows(builder, elbows)
addKnees(builder, knees)
Expand All @@ -68,7 +74,7 @@ class SteamVRTrackersSetting : Table() {
return endSteamVRTrackersSetting(builder)
}
@JvmStatic
fun startSteamVRTrackersSetting(builder: FlatBufferBuilder) = builder.startTable(6)
fun startSteamVRTrackersSetting(builder: FlatBufferBuilder) = builder.startTable(7)
@JvmStatic
fun addWaist(builder: FlatBufferBuilder, waist: Boolean) = builder.addBoolean(0, waist, false)
@JvmStatic
Expand All @@ -82,6 +88,8 @@ class SteamVRTrackersSetting : Table() {
@JvmStatic
fun addHands(builder: FlatBufferBuilder, hands: Boolean) = builder.addBoolean(5, hands, false)
@JvmStatic
fun addAutomaticTrackerToggle(builder: FlatBufferBuilder, automaticTrackerToggle: Boolean) = builder.addBoolean(6, automaticTrackerToggle, false)
@JvmStatic
fun endSteamVRTrackersSetting(builder: FlatBufferBuilder) : Int {
val o = builder.endTable()
return o
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ impl<'a> SteamVRTrackersSetting<'a> {
pub const VT_KNEES: flatbuffers::VOffsetT = 10;
pub const VT_ELBOWS: flatbuffers::VOffsetT = 12;
pub const VT_HANDS: flatbuffers::VOffsetT = 14;
pub const VT_AUTOMATICTRACKERTOGGLE: flatbuffers::VOffsetT = 16;

#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
Expand All @@ -42,6 +43,7 @@ impl<'a> SteamVRTrackersSetting<'a> {
args: &'args SteamVRTrackersSettingArgs
) -> flatbuffers::WIPOffset<SteamVRTrackersSetting<'bldr>> {
let mut builder = SteamVRTrackersSettingBuilder::new(_fbb);
builder.add_automaticTrackerToggle(args.automaticTrackerToggle);
builder.add_hands(args.hands);
builder.add_elbows(args.elbows);
builder.add_knees(args.knees);
Expand Down Expand Up @@ -94,6 +96,13 @@ impl<'a> SteamVRTrackersSetting<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<bool>(SteamVRTrackersSetting::VT_HANDS, Some(false)).unwrap()}
}
#[inline]
pub fn automaticTrackerToggle(&self) -> bool {
// Safety:
// Created from valid Table for this object
// which contains a valid value in this slot
unsafe { self._tab.get::<bool>(SteamVRTrackersSetting::VT_AUTOMATICTRACKERTOGGLE, Some(false)).unwrap()}
}
}

impl flatbuffers::Verifiable for SteamVRTrackersSetting<'_> {
Expand All @@ -109,6 +118,7 @@ impl flatbuffers::Verifiable for SteamVRTrackersSetting<'_> {
.visit_field::<bool>("knees", Self::VT_KNEES, false)?
.visit_field::<bool>("elbows", Self::VT_ELBOWS, false)?
.visit_field::<bool>("hands", Self::VT_HANDS, false)?
.visit_field::<bool>("automaticTrackerToggle", Self::VT_AUTOMATICTRACKERTOGGLE, false)?
.finish();
Ok(())
}
Expand All @@ -120,6 +130,7 @@ pub struct SteamVRTrackersSettingArgs {
pub knees: bool,
pub elbows: bool,
pub hands: bool,
pub automaticTrackerToggle: bool,
}
impl<'a> Default for SteamVRTrackersSettingArgs {
#[inline]
Expand All @@ -131,6 +142,7 @@ impl<'a> Default for SteamVRTrackersSettingArgs {
knees: false,
elbows: false,
hands: false,
automaticTrackerToggle: false,
}
}
}
Expand Down Expand Up @@ -165,6 +177,10 @@ impl<'a: 'b, 'b> SteamVRTrackersSettingBuilder<'a, 'b> {
self.fbb_.push_slot::<bool>(SteamVRTrackersSetting::VT_HANDS, hands, false);
}
#[inline]
pub fn add_automaticTrackerToggle(&mut self, automaticTrackerToggle: bool) {
self.fbb_.push_slot::<bool>(SteamVRTrackersSetting::VT_AUTOMATICTRACKERTOGGLE, automaticTrackerToggle, false);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> SteamVRTrackersSettingBuilder<'a, 'b> {
let start = _fbb.start_table();
SteamVRTrackersSettingBuilder {
Expand All @@ -188,6 +204,7 @@ impl core::fmt::Debug for SteamVRTrackersSetting<'_> {
ds.field("knees", &self.knees());
ds.field("elbows", &self.elbows());
ds.field("hands", &self.hands());
ds.field("automaticTrackerToggle", &self.automaticTrackerToggle());
ds.finish()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,13 @@ hands():boolean {
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
}

automaticTrackerToggle():boolean {
const offset = this.bb!.__offset(this.bb_pos, 16);
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
}

static startSteamVRTrackersSetting(builder:flatbuffers.Builder) {
builder.startObject(6);
builder.startObject(7);
}

static addWaist(builder:flatbuffers.Builder, waist:boolean) {
Expand All @@ -80,19 +85,24 @@ static addHands(builder:flatbuffers.Builder, hands:boolean) {
builder.addFieldInt8(5, +hands, +false);
}

static addAutomaticTrackerToggle(builder:flatbuffers.Builder, automaticTrackerToggle:boolean) {
builder.addFieldInt8(6, +automaticTrackerToggle, +false);
}

static endSteamVRTrackersSetting(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
return offset;
}

static createSteamVRTrackersSetting(builder:flatbuffers.Builder, waist:boolean, chest:boolean, feet:boolean, knees:boolean, elbows:boolean, hands:boolean):flatbuffers.Offset {
static createSteamVRTrackersSetting(builder:flatbuffers.Builder, waist:boolean, chest:boolean, feet:boolean, knees:boolean, elbows:boolean, hands:boolean, automaticTrackerToggle:boolean):flatbuffers.Offset {
SteamVRTrackersSetting.startSteamVRTrackersSetting(builder);
SteamVRTrackersSetting.addWaist(builder, waist);
SteamVRTrackersSetting.addChest(builder, chest);
SteamVRTrackersSetting.addFeet(builder, feet);
SteamVRTrackersSetting.addKnees(builder, knees);
SteamVRTrackersSetting.addElbows(builder, elbows);
SteamVRTrackersSetting.addHands(builder, hands);
SteamVRTrackersSetting.addAutomaticTrackerToggle(builder, automaticTrackerToggle);
return SteamVRTrackersSetting.endSteamVRTrackersSetting(builder);
}

Expand All @@ -103,7 +113,8 @@ unpack(): SteamVRTrackersSettingT {
this.feet(),
this.knees(),
this.elbows(),
this.hands()
this.hands(),
this.automaticTrackerToggle()
);
}

Expand All @@ -115,6 +126,7 @@ unpackTo(_o: SteamVRTrackersSettingT): void {
_o.knees = this.knees();
_o.elbows = this.elbows();
_o.hands = this.hands();
_o.automaticTrackerToggle = this.automaticTrackerToggle();
}
}

Expand All @@ -125,7 +137,8 @@ constructor(
public feet: boolean = false,
public knees: boolean = false,
public elbows: boolean = false,
public hands: boolean = false
public hands: boolean = false,
public automaticTrackerToggle: boolean = false
){}


Expand All @@ -136,7 +149,8 @@ pack(builder:flatbuffers.Builder): flatbuffers.Offset {
this.feet,
this.knees,
this.elbows,
this.hands
this.hands,
this.automaticTrackerToggle
);
}
}
1 change: 1 addition & 0 deletions schema/rpc.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ table SteamVRTrackersSetting {
knees: bool;
elbows: bool;
hands: bool;
automaticTrackerToggle: bool;
}

table FilteringSettings {
Expand Down

0 comments on commit a5fd6ae

Please sign in to comment.