@@ -59,6 +59,8 @@ class WebXRDisplayProvider : ProviderImpl
59
59
std::vector<UnityXRRenderTextureId> m_UnityTextures;
60
60
std::vector<UnityXRVector2> m_UnityTexturesSizes;
61
61
float *m_ViewsDataArray;
62
+ float viewWidth;
63
+ float viewHeight;
62
64
float frameBufferWidth;
63
65
float frameBufferHeight;
64
66
bool hasMultipleViews = true ;
@@ -85,16 +87,26 @@ UnitySubsystemErrorCode WebXRDisplayProvider::Initialize()
85
87
UnitySubsystemErrorCode WebXRDisplayProvider::Start ()
86
88
{
87
89
m_ViewsDataArray = WebXRGetViewsDataArray ();
90
+ viewWidth = *(m_ViewsDataArray + 46 );
91
+ viewHeight = *(m_ViewsDataArray + 47 );
88
92
frameBufferWidth = *(m_ViewsDataArray + 56 );
89
93
frameBufferHeight = *(m_ViewsDataArray + 57 );
90
94
printf (" Start %f, %f\n " , frameBufferWidth, frameBufferHeight);
91
- float viewsHalfDistance = 0 .5f * sqrt (
92
- pow ((*(m_ViewsDataArray + 40 ) - *(m_ViewsDataArray + 43 )), 2 )
93
- + pow ((*(m_ViewsDataArray + 41 ) - *(m_ViewsDataArray + 44 )), 2 )
94
- + pow ((*(m_ViewsDataArray + 42 ) - *(m_ViewsDataArray + 45 )), 2 ));
95
- s_PoseXPositionPerPass[0 ] = -viewsHalfDistance;
96
- s_PoseXPositionPerPass[1 ] = viewsHalfDistance;
97
95
hasMultipleViews = *(m_ViewsDataArray + 54 ) > 1 ;
96
+ if (hasMultipleViews)
97
+ {
98
+ float viewsHalfDistance = 0 .5f * sqrt (
99
+ pow ((*(m_ViewsDataArray + 40 ) - *(m_ViewsDataArray + 43 )), 2 )
100
+ + pow ((*(m_ViewsDataArray + 41 ) - *(m_ViewsDataArray + 44 )), 2 )
101
+ + pow ((*(m_ViewsDataArray + 42 ) - *(m_ViewsDataArray + 45 )), 2 ));
102
+ s_PoseXPositionPerPass[0 ] = -viewsHalfDistance;
103
+ s_PoseXPositionPerPass[1 ] = viewsHalfDistance;
104
+ }
105
+ else
106
+ {
107
+ s_PoseXPositionPerPass[0 ] = 0 ;
108
+ s_PoseXPositionPerPass[1 ] = 0 ;
109
+ }
98
110
transparentBackground = *(m_ViewsDataArray + 55 ) > 0 ;
99
111
webXRFrameBuffer = WebXRInitDisplayRender ();
100
112
@@ -364,8 +376,8 @@ void WebXRDisplayProvider::Shutdown()
364
376
365
377
void WebXRDisplayProvider::CreateTextures (int numTextures, int textureArrayLength, float requestedTextureScale)
366
378
{
367
- const int texWidth = (int )(frameBufferWidth);
368
- const int texHeight = (int )(frameBufferHeight);
379
+ const int texWidth = (int )(SIDE_BY_SIDE ? frameBufferWidth : viewWidth );
380
+ const int texHeight = (int )(SIDE_BY_SIDE ? frameBufferHeight : viewHeight );
369
381
370
382
// m_NativeTextures.resize(numTextures);
371
383
m_UnityTextures.resize (numTextures);
0 commit comments