Created
November 28, 2018 08:33
-
-
Save paulrouget/1c5abb6603ebd79a3960d4d776007092 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
impl VRDisplay for VRExternalDisplay { | |
fn data(&self) -> VRDisplayData { | |
let mut data = VRDisplayData::default(); | |
let state: &mozgfx::VRDisplayState = &self.shmem().state.displayState; | |
data.display_name = state.mDisplayName.iter().map(|x| *x as char).collect(); | |
data.display_id = self.display_id; | |
data.connected = state.mIsConnected; | |
// FIXME: better option than != 0? | |
data.capabilities.has_position = state.mCapabilityFlags | mozgfx::VRDisplayCapabilityFlags_Cap_Position != 0; | |
data.capabilities.can_present = state.mCapabilityFlags | mozgfx::VRDisplayCapabilityFlags_Cap_Present != 0; | |
data.capabilities.has_orientation = state.mCapabilityFlags | mozgfx::VRDisplayCapabilityFlags_Cap_Orientation != 0; | |
data.capabilities.has_external_display = false; // FIXME: How do I know? And why? | |
data.stage_parameters = Some(VRStageParameters { | |
sitting_to_standing_transform: state.mSittingToStandingTransform.clone(), | |
size_x: state.mStageSize.width, // FIXME: Not sure about that, size_x is width? | |
size_z: state.mStageSize.height, // FIXME: Not sure about that, size_z is height? | |
}); | |
data.left_eye_parameters.offset = [state.mEyeTranslation[0].x, state.mEyeTranslation[0].y, state.mEyeTranslation[0].y]; | |
data.left_eye_parameters.render_width = state.mEyeResolution.width as u32; // FIXME: Not sure about that | |
data.left_eye_parameters.render_height = state.mEyeResolution.height as u32; // FIXME: Not sure about that | |
data.left_eye_parameters.field_of_view.up_degrees = state.mEyeFOV[0].upDegrees; | |
data.left_eye_parameters.field_of_view.right_degrees = state.mEyeFOV[0].rightDegrees; | |
data.left_eye_parameters.field_of_view.down_degrees = state.mEyeFOV[0].downDegrees; | |
data.left_eye_parameters.field_of_view.left_degrees = state.mEyeFOV[0].leftDegrees; | |
data.right_eye_parameters.offset = [state.mEyeTranslation[1].x, state.mEyeTranslation[1].y, state.mEyeTranslation[1].y]; | |
data.right_eye_parameters.render_width = state.mEyeResolution.width as u32; // FIXME: Not sure about that | |
data.right_eye_parameters.render_height = state.mEyeResolution.height as u32; // FIXME: Not sure about that | |
data.right_eye_parameters.field_of_view.up_degrees = state.mEyeFOV[1].upDegrees; | |
data.right_eye_parameters.field_of_view.right_degrees = state.mEyeFOV[1].rightDegrees; | |
data.right_eye_parameters.field_of_view.down_degrees = state.mEyeFOV[1].downDegrees; | |
data.right_eye_parameters.field_of_view.left_degrees = state.mEyeFOV[1].leftDegrees; | |
data | |
} | |
... | |
} |
It should be with and: (state.mCapabilityFlags & mozgfx::VRDisplayCapabilityFlags_Cap_Position) != 0
data.capabilities.has_external_display = true
There is a Cap_External
flag
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Should we add parenthesis into
state.mCapabilityFlags | mozgfx::VRDisplayCapabilityFlags_Cap_Position != 0;
?(state.mCapabilityFlags | mozgfx::VRDisplayCapabilityFlags_Cap_Position) != 0;