public void reset() { using (var ee = Log.ee(TAG, "reset")) { #if UNITY_EDITOR poolSize = 3; if (!Application.isEditor) #endif { poolSize = WaveVR_Utils.WVR_GetNumberOfTextures(); } int size = Mathf.Max(Screen.width / 2, Screen.height); uint w = (uint)size; uint h = (uint)size; Interop.WVR_GetRenderTargetSize(ref w, ref h); screenWidth = (int)w; screenHeight = (int)h; float previewRatio = GetPreviewImageRatio(); int scaledWidth = ToMultipleOfTwo((int)(screenWidth * FinalScale * previewRatio)); int scaledHeight = ToMultipleOfTwo((int)(screenHeight * FinalScale * previewRatio)); int antiAliasing = AllowAntiAliasing ? QualitySettings.antiAliasing : 0; if (antiAliasing == 0) { antiAliasing = 1; } Log.d(TAG, "Texture width=" + scaledWidth + " height=" + scaledHeight + " antiAliasing=" + antiAliasing); var cfg = new TextureConfig(); cfg.w = scaledWidth; cfg.h = scaledHeight; cfg.depth = 24; // Only 24 has StencilBuffer. See Unity document. Only 24 can let VR work normally. cfg.format = RenderTextureFormat.ARGB32; cfg.useMipMap = false; cfg.wrapMode = TextureWrapMode.Clamp; cfg.filterMode = FilterMode.Bilinear; cfg.anisoLevel = 1; cfg.antiAliasing = antiAliasing; if (validate()) { ReleaseTexturePools(); } if (IsSinglePass) { both = new TexturePoolRenderTexture2DArray(cfg, poolSize); } else { left = new TexturePoolRenderTexture(cfg, poolSize, WVR_Eye.WVR_Eye_Left); right = new TexturePoolRenderTexture(cfg, poolSize, WVR_Eye.WVR_Eye_Right); } } // reset log.ee }
public void reset() { using (var ee = Log.ee("WVR_TexMngr", "reset")) { #if UNITY_EDITOR poolSize = 3; if (!Application.isEditor) #endif { poolSize = WaveVR_Utils.WVR_GetNumberOfTextures(); } int size = Mathf.Max(Screen.width / 2, Screen.height); uint w = (uint)size; uint h = (uint)size; if (!Application.isEditor) { Interop.WVR_GetRenderTargetSize(ref w, ref h); } int screenWidth = (int)(w); int screenHeight = (int)(h); int antiAliasing = AllowAntiAliasing ? QualitySettings.antiAliasing : 0; if (antiAliasing == 0) { antiAliasing = 1; } Log.d("WVR_TexMngr", "TextureManager: screenWidth=" + screenWidth + " screenHeight=" + screenHeight + " antiAliasing=" + antiAliasing); var cfg = new TextureConfig(); cfg.w = screenWidth; cfg.h = screenHeight; cfg.depth = 24; cfg.format = RenderTextureFormat.ARGB32; cfg.useMipMap = false; cfg.wrapMode = TextureWrapMode.Clamp; cfg.filterMode = FilterMode.Bilinear; cfg.anisoLevel = 1; cfg.antiAliasing = antiAliasing; if (validate()) { ReleaseTexturePools(); } if (IsSinglePass) { both = new TexturePoolRenderTexture2DArray(cfg, poolSize); } else { left = new TexturePoolRenderTexture(cfg, poolSize, WVR_Eye.WVR_Eye_Left); right = new TexturePoolRenderTexture(cfg, poolSize, WVR_Eye.WVR_Eye_Right); } } // reset log.ee }