@@ -47,6 +47,13 @@ private enum ControllerState
47
47
Ended
48
48
}
49
49
50
+ public enum DepthStencilFormats
51
+ {
52
+ None = 0 ,
53
+ Depth = 16 ,
54
+ DepthAndStencil = 24
55
+ }
56
+
50
57
private const float WEBCAM_DISTANCE_CALIBRATION = 0.5f ;
51
58
private const float WEBCAM_SIZE_CALIBRATION = 0.25f ;
52
59
private const float WEBCAM_MIN_SIZE = 0.001f ;
@@ -126,6 +133,8 @@ private enum ControllerState
126
133
#endif
127
134
[ SerializeField ]
128
135
private int webcamFramesDelaySize = 0 ;
136
+ [ SerializeField , Tooltip ( "The depth buffer or depth and stencil format of the Background and Foreground RenderTextures" ) ]
137
+ private DepthStencilFormats depthStencilFormat = DepthStencilFormats . DepthAndStencil ;
129
138
130
139
private ControllerState state = ControllerState . None ;
131
140
private float webcamBaseSize = 1f ;
@@ -540,7 +549,7 @@ private void CreateRenderTextures()
540
549
backgroundStack = new RenderTexture [ webcamFramesDelaySize ] ;
541
550
foregroundStack = new RenderTexture [ webcamFramesDelaySize ] ;
542
551
webcamStack = new RenderTexture [ webcamFramesDelaySize ] ;
543
- RenderTextureDescriptor envDesc = new RenderTextureDescriptor ( Screen . width , Screen . height , RenderTextureFormat . Default , 16 ) ;
552
+ RenderTextureDescriptor envDesc = new RenderTextureDescriptor ( Screen . width , Screen . height , RenderTextureFormat . Default , ( int ) depthStencilFormat ) ;
544
553
RenderTextureDescriptor webcamDesc = new RenderTextureDescriptor ( Mathf . RoundToInt ( 100 * webcam . transform . localScale . x ) , 100 , RenderTextureFormat . Default ) ;
545
554
for ( int i = 0 ; i < webcamFramesDelaySize ; i ++ )
546
555
{
0 commit comments