The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

d/sample: Clean up, specify a blend mode

+15 -5
+15 -5
src/xrt/drivers/sample/sample_hmd.c
··· 123 123 (enum u_device_alloc_flags)(U_DEVICE_ALLOC_HMD | U_DEVICE_ALLOC_TRACKING_NONE); 124 124 125 125 struct sample_hmd *sh = U_DEVICE_ALLOCATE(struct sample_hmd, flags, 1, 0); 126 + 127 + // This list should be ordered, most preferred first. 128 + size_t idx = 0; 129 + sh->base.hmd->blend_modes[idx++] = XRT_BLEND_MODE_OPAQUE; 130 + sh->base.hmd->blend_mode_count = idx; 131 + 126 132 sh->base.update_inputs = sample_hmd_update_inputs; 127 133 sh->base.get_tracked_pose = sample_hmd_get_tracked_pose; 128 134 sh->base.get_view_poses = sample_hmd_get_view_poses; 129 135 sh->base.destroy = sample_hmd_destroy; 130 - sh->base.name = XRT_DEVICE_GENERIC_HMD; 131 - sh->base.device_type = XRT_DEVICE_TYPE_HMD; 132 - sh->pose.orientation.w = 1.0f; // All other values set to zero by U_DEVICE_ALLOCATE (which calls U_CALLOC) 136 + 137 + sh->pose = (struct xrt_pose)XRT_POSE_IDENTITY; 133 138 sh->log_level = debug_get_log_option_sample_log(); 134 139 135 140 // Print name. ··· 137 142 snprintf(sh->base.serial, XRT_DEVICE_NAME_LEN, "Sample HMD S/N"); 138 143 139 144 // Setup input. 145 + sh->base.name = XRT_DEVICE_GENERIC_HMD; 146 + sh->base.device_type = XRT_DEVICE_TYPE_HMD; 140 147 sh->base.inputs[0].name = XRT_INPUT_GENERIC_HEAD_POSE; 148 + sh->base.orientation_tracking_supported = true; 149 + sh->base.position_tracking_supported = false; 141 150 142 151 // Set up display details 143 152 // refresh rate ··· 182 191 sh->base.hmd->views[0].viewport.x_pixels = 0; 183 192 sh->base.hmd->views[1].viewport.x_pixels = panel_w; 184 193 194 + // Distortion information, fills in xdev->compute_distortion(). 195 + u_distortion_mesh_set_none(&sh->base); 196 + 185 197 // Setup variable tracker: Optional but useful for debugging 186 198 u_var_add_root(sh, "Sample HMD", true); 187 199 u_var_add_pose(sh, &sh->pose, "pose"); 188 200 u_var_add_log_level(sh, &sh->log_level, "log_level"); 189 201 190 - // Distortion information, fills in xdev->compute_distortion(). 191 - u_distortion_mesh_set_none(&sh->base); 192 202 193 203 return &sh->base; 194 204 }