Example #1
0
        private void RenderPreview(PreviewRenderMode renderMode)
        {
            // If the current camera isn't valid, early out.
            if (_currentCamera == null)
            {
                return;
            }

            // Check if the window size has changed. If it has,
            // recreate the preview window's associated resources
            // based on the new size.
            if (_windowWidth != _previousPreviewWindowWidth || _windowHeight != _previousPreviewWindowHeight)
            {
                this.DestroyPreviewResources();
                this.CreatePreviewResources();
            }

            // Disable the camera render callbacks while rendering the left
            // and right frames for the preview window.
            if (_cameraRenderCallbacks != null)
            {
                _cameraRenderCallbacks.enabled = false;
            }

            // Perform the render.
            switch (renderMode)
            {
            case PreviewRenderMode.LRPattern:
                this.RenderPreviewLRPattern();
                break;

            case PreviewRenderMode.Default:
                this.RenderPreviewDefault();
                break;

            default:
                break;
            }

            // Re-enable the camera render callbacks so that the center eye view
            // is rendered for the GameView window.
            if (_cameraRenderCallbacks != null)
            {
                _cameraRenderCallbacks.enabled = true;
            }

            // Set the stereo frame textures for the preview window.
            zcuSetPreviewStereoFrame(_leftPreviewNativeTexturePtr, _rightPreviewNativeTexturePtr);

            // Issue a plugin render event to copy the stereo frame textures to
            // underlying shared texture resources, which are available to the
            // preview window.
            ZCore.IssuePluginEvent(PluginEvent.CopyPreviewStereoFrame);

            // Update the previous window width and height in order to determine if they
            // have changed.
            _previousPreviewWindowWidth  = _windowWidth;
            _previousPreviewWindowHeight = _windowHeight;
        }
Example #2
0
        private void RenderMode_Click(object sender, RoutedEventArgs e)
        {
            MenuItem          mnu = sender as MenuItem;
            PreviewRenderMode ctype;

            Enum.TryParse <PreviewRenderMode>(mnu.Header.ToString().Replace("_", "").Replace(" ", ""), out ctype);
            previewRenderMode = ctype;
            Invalidate();
        }
Example #3
0
        public UI3DPreview()
        {
            HdriManager.Scan();
            HdriManager.OnHdriLoaded += HdriManager_OnHdriLoaded;
            InitializeComponent();
            previewRenderMode = PreviewRenderMode.FullShading;
            Instance          = this;

            materialSettings = new MaterialSettings();
            materialSettings.Load();
            materialSettings.OnMaterialUpdated += MaterialSettings_OnMaterialUpdated;

            lightSettings = new LightingSettings();
            lightSettings.OnLightingUpdated += LightSettings_OnLightingUpdated;

            InitGL();
            Log.Info("3d view inited");
        }