19 using UnityEngine.Rendering;
62 #endregion Public Fields
65 #region Public Functions
90 RenderTextureFormat.Default);
96 RenderTextureFormat.Default);
151 switch (glassesMirrorMode)
167 public void SubmitPreviewTexturesSRP(
169 Camera headPoseCamera,
170 CommandBuffer commandBuffer,
175 switch (glassesMirrorMode)
178 CopyTextureToPreviewTextureSRP(commandBuffer,
LeftTexture_GLS, previewTex);
181 CopyTextureToPreviewTextureSRP(commandBuffer,
RightTexture_GLS, previewTex);
185 CopyTextureToPreviewTextureSRP(commandBuffer,
LeftTexture_GLS, previewTex);
191 var tempRTIdentifier = Shader.PropertyToID(
"TiltFiveCanvas");
192 int tempRTWidth = (int)(previewTex.width * frameScale.x);
193 int tempRTHeight = (int)(previewTex.height * frameScale.y);
195 RenderTargetIdentifier currentRenderTarget = BuiltinRenderTextureType.CurrentActive;
208 commandBuffer.GetTemporaryRT(tempRTIdentifier,
211 previewTex.descriptor.depthBufferBits,
212 previewTex.filterMode,
214 RenderTextureReadWrite.Default,
215 previewTex.antiAliasing,
218 commandBuffer.SetRenderTarget(tempRTIdentifier);
219 commandBuffer.ClearRenderTarget(
true,
true, Color.black);
220 commandBuffer.CopyTexture(previewTex, 0, 0, 0, 0,
221 previewTex.width, previewTex.height,
222 tempRTIdentifier, 0, 0,
223 (tempRTWidth - previewTex.width) / 2, (tempRTHeight - previewTex.height) / 2);
224 commandBuffer.Blit(tempRTIdentifier, headPoseCamera.targetTexture, Vector2.one, Vector2.zero);
225 commandBuffer.ReleaseTemporaryRT(tempRTIdentifier);
226 commandBuffer.SetRenderTarget(currentRenderTarget);
230 #endregion Public Functions
233 #region Private Functions
235 void CopyTexture(RenderTexture sourceTex, RenderTexture destinationTex,
int xOffset = 0)
237 Graphics.CopyTexture(
242 sourceTex.width, sourceTex.height,
249 void CopyTextureToPreviewTextureSRP(CommandBuffer cmd, RenderTexture sourceTex, RenderTexture destinationTex,
int xOffset = 0)
256 sourceTex.width, sourceTex.height,
262 #endregion Private Functions
Display settings constants.
const RenderTextureFormat nativeTextureFormat
static int monoWidth
The display width for a single eye.
static int height
The display height.
const int depthBuffer
The depth buffer's precision.
static int stereoWidth
The display width for two eyes.
RenderTexture MonoPreviewTex
The rendertexture used to display onscreen previews for the left or right eye camera.
void ValidateNativeTexturePointers()
Determines whether the left/right texture handles are still valid, and resets them if needed
void GetNativeTexturePointers(out IntPtr leftTexHandle, out IntPtr rightTexHandle)
Acquires the native output textures upon startup or invalidaiton.
IntPtr RightTexHandle
The native pointer to the right eye rendertexture
void CopyTexture(RenderTexture sourceTex, RenderTexture destinationTex, int xOffset=0)
IntPtr LeftTexHandle
The native pointer to the left eye rendertexture
void SubmitPreviewTextures(GlassesMirrorMode glassesMirrorMode)
Copies frame data from the HDR input textures to the onscreen preview textures.
RenderTexture LeftTexture_GLS
The left eye rendertexture
RenderTexture RightTexture_GLS
The right eye rendertexture
RenderTexture StereoPreviewTex
The rendertexture used to display onscreen previews for the left and right eye cameras in stereo.
void Initialize()
Creates and configures the stereo rendertextures