protected void RefreshRenderTextures()

in Networked Physics/Assets/Oculus/VR/Scripts/Composition/OVRSandwichComposition.cs [252:294]


	protected void RefreshRenderTextures(Camera mainCamera)
	{
		int width = Screen.width;
		int height = Screen.height;
		RenderTextureFormat format = mainCamera.targetTexture ? DesiredRenderTextureFormat(mainCamera.targetTexture.format) : RenderTextureFormat.ARGB32;
		int depth = mainCamera.targetTexture ? mainCamera.targetTexture.depth : 24;

		Debug.Assert(fgCamera != null && bgCamera != null);

		HistoryRecord record = historyRecordArray[historyRecordCursorIndex];

		record.timestamp = frameRealtime;

		if (record.fgRenderTexture == null || record.fgRenderTexture.width != width || record.fgRenderTexture.height != height || record.fgRenderTexture.format != format || record.fgRenderTexture.depth != depth)
		{
			record.fgRenderTexture = new RenderTexture(width, height, depth, format);
			record.fgRenderTexture.name = "Sandwich FG " + historyRecordCursorIndex.ToString();
		}
		fgCamera.targetTexture = record.fgRenderTexture;

		if (record.bgRenderTexture == null || record.bgRenderTexture.width != width || record.bgRenderTexture.height != height || record.bgRenderTexture.format != format || record.bgRenderTexture.depth != depth)
		{
			record.bgRenderTexture = new RenderTexture(width, height, depth, format);
			record.bgRenderTexture.name = "Sandwich BG " + historyRecordCursorIndex.ToString();
		}
		bgCamera.targetTexture = record.bgRenderTexture;

		if (OVRManager.instance.virtualGreenScreenType != OVRManager.VirtualGreenScreenType.Off)
		{
			if (record.boundaryMeshMaskTexture == null || record.boundaryMeshMaskTexture.width != width || record.boundaryMeshMaskTexture.height != height)
			{
				record.boundaryMeshMaskTexture = new RenderTexture(width, height, 0, RenderTextureFormat.R8);
				record.boundaryMeshMaskTexture.name = "Boundary Mask " + historyRecordCursorIndex.ToString();
				record.boundaryMeshMaskTexture.Create();
			}
		}
		else
		{
			record.boundaryMeshMaskTexture = null;
		}

		Debug.Assert(fgCamera.targetTexture != null && bgCamera.targetTexture != null && (OVRManager.instance.virtualGreenScreenType == OVRManager.VirtualGreenScreenType.Off || record.boundaryMeshMaskTexture != null));
	}