Skip to content

Commit

Permalink
Add toggle for using position information
Browse files Browse the repository at this point in the history
  • Loading branch information
Stermere committed Jul 11, 2024
1 parent f17e716 commit c0f8644
Show file tree
Hide file tree
Showing 7 changed files with 79 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 @@ -3804,7 +3804,8 @@ struct ModelToggles FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
VT_VIVE_EMULATION = 16,
VT_TOE_SNAP = 18,
VT_FOOT_PLANT = 20,
VT_SELF_LOCALIZATION = 22
VT_SELF_LOCALIZATION = 22,
VT_USE_POSITION = 24
};
flatbuffers::Optional<bool> extended_spine() const {
return GetOptional<uint8_t, bool>(VT_EXTENDED_SPINE);
Expand Down Expand Up @@ -3836,6 +3837,9 @@ struct ModelToggles FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
flatbuffers::Optional<bool> self_localization() const {
return GetOptional<uint8_t, bool>(VT_SELF_LOCALIZATION);
}
flatbuffers::Optional<bool> use_position() const {
return GetOptional<uint8_t, bool>(VT_USE_POSITION);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<uint8_t>(verifier, VT_EXTENDED_SPINE, 1) &&
Expand All @@ -3848,6 +3852,7 @@ struct ModelToggles FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
VerifyField<uint8_t>(verifier, VT_TOE_SNAP, 1) &&
VerifyField<uint8_t>(verifier, VT_FOOT_PLANT, 1) &&
VerifyField<uint8_t>(verifier, VT_SELF_LOCALIZATION, 1) &&
VerifyField<uint8_t>(verifier, VT_USE_POSITION, 1) &&
verifier.EndTable();
}
};
Expand Down Expand Up @@ -3886,6 +3891,9 @@ struct ModelTogglesBuilder {
void add_self_localization(bool self_localization) {
fbb_.AddElement<uint8_t>(ModelToggles::VT_SELF_LOCALIZATION, static_cast<uint8_t>(self_localization));
}
void add_use_position(bool use_position) {
fbb_.AddElement<uint8_t>(ModelToggles::VT_USE_POSITION, static_cast<uint8_t>(use_position));
}
explicit ModelTogglesBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
Expand All @@ -3908,8 +3916,10 @@ inline flatbuffers::Offset<ModelToggles> CreateModelToggles(
flatbuffers::Optional<bool> vive_emulation = flatbuffers::nullopt,
flatbuffers::Optional<bool> toe_snap = flatbuffers::nullopt,
flatbuffers::Optional<bool> foot_plant = flatbuffers::nullopt,
flatbuffers::Optional<bool> self_localization = flatbuffers::nullopt) {
flatbuffers::Optional<bool> self_localization = flatbuffers::nullopt,
flatbuffers::Optional<bool> use_position = flatbuffers::nullopt) {
ModelTogglesBuilder builder_(_fbb);
if(use_position) { builder_.add_use_position(*use_position); }
if(self_localization) { builder_.add_self_localization(*self_localization); }
if(foot_plant) { builder_.add_foot_plant(*foot_plant); }
if(toe_snap) { builder_.add_toe_snap(*toe_snap); }
Expand Down
16 changes: 12 additions & 4 deletions protocol/java/src/solarxr_protocol/rpc/settings/ModelToggles.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public final class ModelToggles extends Table {
public boolean footPlant() { int o = __offset(20); return o != 0 ? 0!=bb.get(o + bb_pos) : false; }
public boolean hasSelfLocalization() { return 0 != __offset(22); }
public boolean selfLocalization() { int o = __offset(22); return o != 0 ? 0!=bb.get(o + bb_pos) : false; }
public boolean hasUsePosition() { return 0 != __offset(24); }
public boolean usePosition() { int o = __offset(24); return o != 0 ? 0!=bb.get(o + bb_pos) : false; }

public static int createModelToggles(FlatBufferBuilder builder,
boolean extendedSpine,
Expand All @@ -49,8 +51,10 @@ public static int createModelToggles(FlatBufferBuilder builder,
boolean viveEmulation,
boolean toeSnap,
boolean footPlant,
boolean selfLocalization) {
builder.startTable(10);
boolean selfLocalization,
boolean usePosition) {
builder.startTable(11);
ModelToggles.addUsePosition(builder, usePosition);
ModelToggles.addSelfLocalization(builder, selfLocalization);
ModelToggles.addFootPlant(builder, footPlant);
ModelToggles.addToeSnap(builder, toeSnap);
Expand All @@ -64,7 +68,7 @@ public static int createModelToggles(FlatBufferBuilder builder,
return ModelToggles.endModelToggles(builder);
}

public static void startModelToggles(FlatBufferBuilder builder) { builder.startTable(10); }
public static void startModelToggles(FlatBufferBuilder builder) { builder.startTable(11); }
public static void addExtendedSpine(FlatBufferBuilder builder, boolean extendedSpine) { builder.addBoolean(0, extendedSpine, false); }
public static void addExtendedPelvis(FlatBufferBuilder builder, boolean extendedPelvis) { builder.addBoolean(1, extendedPelvis, false); }
public static void addExtendedKnee(FlatBufferBuilder builder, boolean extendedKnee) { builder.addBoolean(2, extendedKnee, false); }
Expand All @@ -75,6 +79,7 @@ public static int createModelToggles(FlatBufferBuilder builder,
public static void addToeSnap(FlatBufferBuilder builder, boolean toeSnap) { builder.addBoolean(7, toeSnap, false); }
public static void addFootPlant(FlatBufferBuilder builder, boolean footPlant) { builder.addBoolean(8, footPlant, false); }
public static void addSelfLocalization(FlatBufferBuilder builder, boolean selfLocalization) { builder.addBoolean(9, selfLocalization, false); }
public static void addUsePosition(FlatBufferBuilder builder, boolean usePosition) { builder.addBoolean(10, usePosition, false); }
public static int endModelToggles(FlatBufferBuilder builder) {
int o = builder.endTable();
return o;
Expand Down Expand Up @@ -112,6 +117,8 @@ public void unpackTo(ModelTogglesT _o) {
_o.setFootPlant(_oFootPlant);
Boolean _oSelfLocalization = hasSelfLocalization() ? selfLocalization() : null;
_o.setSelfLocalization(_oSelfLocalization);
Boolean _oUsePosition = hasUsePosition() ? usePosition() : null;
_o.setUsePosition(_oUsePosition);
}
public static int pack(FlatBufferBuilder builder, ModelTogglesT _o) {
if (_o == null) return 0;
Expand All @@ -126,7 +133,8 @@ public static int pack(FlatBufferBuilder builder, ModelTogglesT _o) {
_o.getViveEmulation(),
_o.getToeSnap(),
_o.getFootPlant(),
_o.getSelfLocalization());
_o.getSelfLocalization(),
_o.getUsePosition());
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class ModelTogglesT {
private Boolean toeSnap;
private Boolean footPlant;
private Boolean selfLocalization;
private Boolean usePosition;

public Boolean getExtendedSpine() { return extendedSpine; }

Expand Down Expand Up @@ -59,6 +60,10 @@ public class ModelTogglesT {

public void setSelfLocalization(Boolean selfLocalization) { this.selfLocalization = selfLocalization; }

public Boolean getUsePosition() { return usePosition; }

public void setUsePosition(Boolean usePosition) { this.usePosition = usePosition; }


public ModelTogglesT() {
this.extendedSpine = null;
Expand All @@ -71,6 +76,7 @@ public ModelTogglesT() {
this.toeSnap = null;
this.footPlant = null;
this.selfLocalization = null;
this.usePosition = null;
}
}

14 changes: 11 additions & 3 deletions protocol/kotlin/src/solarxr_protocol/rpc/settings/ModelToggles.kt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ class ModelToggles : Table() {
val o = __offset(22)
return if(o != 0) 0.toByte() != bb.get(o + bb_pos) else null
}
val usePosition : Boolean?
get() {
val o = __offset(24)
return if(o != 0) 0.toByte() != bb.get(o + bb_pos) else null
}
companion object {
@JvmStatic
fun validateVersion() = Constants.FLATBUFFERS_22_10_26()
Expand All @@ -80,8 +85,9 @@ class ModelToggles : Table() {
return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb))
}
@JvmStatic
fun createModelToggles(builder: FlatBufferBuilder, extendedSpine: Boolean?, extendedPelvis: Boolean?, extendedKnee: Boolean?, forceArmsFromHmd: Boolean?, floorClip: Boolean?, skatingCorrection: Boolean?, viveEmulation: Boolean?, toeSnap: Boolean?, footPlant: Boolean?, selfLocalization: Boolean?) : Int {
builder.startTable(10)
fun createModelToggles(builder: FlatBufferBuilder, extendedSpine: Boolean?, extendedPelvis: Boolean?, extendedKnee: Boolean?, forceArmsFromHmd: Boolean?, floorClip: Boolean?, skatingCorrection: Boolean?, viveEmulation: Boolean?, toeSnap: Boolean?, footPlant: Boolean?, selfLocalization: Boolean?, usePosition: Boolean?) : Int {
builder.startTable(11)
usePosition?.run { addUsePosition(builder, usePosition) }
selfLocalization?.run { addSelfLocalization(builder, selfLocalization) }
footPlant?.run { addFootPlant(builder, footPlant) }
toeSnap?.run { addToeSnap(builder, toeSnap) }
Expand All @@ -95,7 +101,7 @@ class ModelToggles : Table() {
return endModelToggles(builder)
}
@JvmStatic
fun startModelToggles(builder: FlatBufferBuilder) = builder.startTable(10)
fun startModelToggles(builder: FlatBufferBuilder) = builder.startTable(11)
@JvmStatic
fun addExtendedSpine(builder: FlatBufferBuilder, extendedSpine: Boolean) = builder.addBoolean(0, extendedSpine, false)
@JvmStatic
Expand All @@ -117,6 +123,8 @@ class ModelToggles : Table() {
@JvmStatic
fun addSelfLocalization(builder: FlatBufferBuilder, selfLocalization: Boolean) = builder.addBoolean(9, selfLocalization, false)
@JvmStatic
fun addUsePosition(builder: FlatBufferBuilder, usePosition: Boolean) = builder.addBoolean(10, usePosition, false)
@JvmStatic
fun endModelToggles(builder: FlatBufferBuilder) : Int {
val o = builder.endTable()
return o
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ impl<'a> ModelToggles<'a> {
pub const VT_TOE_SNAP: flatbuffers::VOffsetT = 18;
pub const VT_FOOT_PLANT: flatbuffers::VOffsetT = 20;
pub const VT_SELF_LOCALIZATION: flatbuffers::VOffsetT = 22;
pub const VT_USE_POSITION: flatbuffers::VOffsetT = 24;

#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
Expand All @@ -47,6 +48,7 @@ impl<'a> ModelToggles<'a> {
args: &'args ModelTogglesArgs
) -> flatbuffers::WIPOffset<ModelToggles<'bldr>> {
let mut builder = ModelTogglesBuilder::new(_fbb);
if let Some(x) = args.use_position { builder.add_use_position(x); }
if let Some(x) = args.self_localization { builder.add_self_localization(x); }
if let Some(x) = args.foot_plant { builder.add_foot_plant(x); }
if let Some(x) = args.toe_snap { builder.add_toe_snap(x); }
Expand Down Expand Up @@ -131,6 +133,13 @@ impl<'a> ModelToggles<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<bool>(ModelToggles::VT_SELF_LOCALIZATION, None)}
}
#[inline]
pub fn use_position(&self) -> Option<bool> {
// Safety:
// Created from valid Table for this object
// which contains a valid value in this slot
unsafe { self._tab.get::<bool>(ModelToggles::VT_USE_POSITION, None)}
}
}

impl flatbuffers::Verifiable for ModelToggles<'_> {
Expand All @@ -150,6 +159,7 @@ impl flatbuffers::Verifiable for ModelToggles<'_> {
.visit_field::<bool>("toe_snap", Self::VT_TOE_SNAP, false)?
.visit_field::<bool>("foot_plant", Self::VT_FOOT_PLANT, false)?
.visit_field::<bool>("self_localization", Self::VT_SELF_LOCALIZATION, false)?
.visit_field::<bool>("use_position", Self::VT_USE_POSITION, false)?
.finish();
Ok(())
}
Expand All @@ -165,6 +175,7 @@ pub struct ModelTogglesArgs {
pub toe_snap: Option<bool>,
pub foot_plant: Option<bool>,
pub self_localization: Option<bool>,
pub use_position: Option<bool>,
}
impl<'a> Default for ModelTogglesArgs {
#[inline]
Expand All @@ -180,6 +191,7 @@ impl<'a> Default for ModelTogglesArgs {
toe_snap: None,
foot_plant: None,
self_localization: None,
use_position: None,
}
}
}
Expand Down Expand Up @@ -230,6 +242,10 @@ impl<'a: 'b, 'b> ModelTogglesBuilder<'a, 'b> {
self.fbb_.push_slot_always::<bool>(ModelToggles::VT_SELF_LOCALIZATION, self_localization);
}
#[inline]
pub fn add_use_position(&mut self, use_position: bool) {
self.fbb_.push_slot_always::<bool>(ModelToggles::VT_USE_POSITION, use_position);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> ModelTogglesBuilder<'a, 'b> {
let start = _fbb.start_table();
ModelTogglesBuilder {
Expand Down Expand Up @@ -257,6 +273,7 @@ impl core::fmt::Debug for ModelToggles<'_> {
ds.field("toe_snap", &self.toe_snap());
ds.field("foot_plant", &self.foot_plant());
ds.field("self_localization", &self.self_localization());
ds.field("use_position", &self.use_position());
ds.finish()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,13 @@ selfLocalization():boolean|null {
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : null;
}

usePosition():boolean|null {
const offset = this.bb!.__offset(this.bb_pos, 24);
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : null;
}

static startModelToggles(builder:flatbuffers.Builder) {
builder.startObject(10);
builder.startObject(11);
}

static addExtendedSpine(builder:flatbuffers.Builder, extendedSpine:boolean) {
Expand Down Expand Up @@ -119,12 +124,16 @@ static addSelfLocalization(builder:flatbuffers.Builder, selfLocalization:boolean
builder.addFieldInt8(9, +selfLocalization, 0);
}

static addUsePosition(builder:flatbuffers.Builder, usePosition:boolean) {
builder.addFieldInt8(10, +usePosition, 0);
}

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

static createModelToggles(builder:flatbuffers.Builder, extendedSpine:boolean|null, extendedPelvis:boolean|null, extendedKnee:boolean|null, forceArmsFromHmd:boolean|null, floorClip:boolean|null, skatingCorrection:boolean|null, viveEmulation:boolean|null, toeSnap:boolean|null, footPlant:boolean|null, selfLocalization:boolean|null):flatbuffers.Offset {
static createModelToggles(builder:flatbuffers.Builder, extendedSpine:boolean|null, extendedPelvis:boolean|null, extendedKnee:boolean|null, forceArmsFromHmd:boolean|null, floorClip:boolean|null, skatingCorrection:boolean|null, viveEmulation:boolean|null, toeSnap:boolean|null, footPlant:boolean|null, selfLocalization:boolean|null, usePosition:boolean|null):flatbuffers.Offset {
ModelToggles.startModelToggles(builder);
if (extendedSpine !== null)
ModelToggles.addExtendedSpine(builder, extendedSpine);
Expand All @@ -146,6 +155,8 @@ static createModelToggles(builder:flatbuffers.Builder, extendedSpine:boolean|nul
ModelToggles.addFootPlant(builder, footPlant);
if (selfLocalization !== null)
ModelToggles.addSelfLocalization(builder, selfLocalization);
if (usePosition !== null)
ModelToggles.addUsePosition(builder, usePosition);
return ModelToggles.endModelToggles(builder);
}

Expand All @@ -160,7 +171,8 @@ unpack(): ModelTogglesT {
this.viveEmulation(),
this.toeSnap(),
this.footPlant(),
this.selfLocalization()
this.selfLocalization(),
this.usePosition()
);
}

Expand All @@ -176,6 +188,7 @@ unpackTo(_o: ModelTogglesT): void {
_o.toeSnap = this.toeSnap();
_o.footPlant = this.footPlant();
_o.selfLocalization = this.selfLocalization();
_o.usePosition = this.usePosition();
}
}

Expand All @@ -190,7 +203,8 @@ constructor(
public viveEmulation: boolean|null = null,
public toeSnap: boolean|null = null,
public footPlant: boolean|null = null,
public selfLocalization: boolean|null = null
public selfLocalization: boolean|null = null,
public usePosition: boolean|null = null
){}


Expand All @@ -205,7 +219,8 @@ pack(builder:flatbuffers.Builder): flatbuffers.Offset {
this.viveEmulation,
this.toeSnap,
this.footPlant,
this.selfLocalization
this.selfLocalization,
this.usePosition
);
}
}
1 change: 1 addition & 0 deletions schema/settings/model.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ table ModelToggles{
toe_snap: bool = null;
foot_plant: bool = null;
self_localization: bool = null;
use_position: bool = null;
}

/// Settings for the skeletal model that are ratios.
Expand Down

0 comments on commit c0f8644

Please sign in to comment.