OpenXR Reference Space浅析

在OpenXR中space也是一个重要的模块,这里参考Monado的代码分析一下。

入口是oxr_xrLocateSpace -》oxr_space_locate,

其中分两个大部分,一是先获取原始的space pose,

	XrResult ret = get_pure_space_relation(log, spc, baseSpc, time, &pure);

二是和space的pose,以及baseSpace的pose,合到一起。

	// Combine space and base space poses with pure relation
	struct xrt_space_relation result;
	struct xrt_space_graph graph = {0};
	m_space_graph_add_pose_if_not_identity(&graph, &spc->pose);
	m_space_graph_add_relation(&graph, &pure);
	m_space_graph_add_inverted_pose_if_not_identity(&graph, &baseSpc->pose);
	m_space_graph_resolve(&graph, &result);

可以概括成这样计算的: Inverted(baseSpace.pose) * purePose * Space.pose

其中两个transform相乘,C = A * B,计算公式:

C.orientation = A.orientation * B.orientation;

C.position = A.position + (A.orientation * B.position);

你可能感兴趣的:(图形渲染,xr,android)