コード例 #1
0
ファイル: MainWindow.cs プロジェクト: GraceDarkling/open3mod
        public MainWindow()
        {        
            // create delegate used for asynchronous calls 
            _delegateSelectTab = SelectTab;
            _delegatePopulateInspector = PopulateInspector;
         
            InitializeComponent();
            _captionStub = Text;

            AddEmptyTab();           
   
            // initialize UI state shelf with a default tab
            _ui = new UiState(new Tab(_emptyTab, null));
            _fps = new FpsTracker();

            // sync global UI with UIState
            framerateToolStripMenuItem.Checked = toolStripButtonShowFPS.Checked = _ui.ShowFps;
            lightingToolStripMenuItem.Checked = toolStripButtonShowShaded.Checked = _ui.RenderLit;
            texturedToolStripMenuItem.Checked = toolStripButtonShowTextures.Checked = _ui.RenderTextured;
            wireframeToolStripMenuItem.Checked = toolStripButtonWireframe.Checked = _ui.RenderWireframe;
            showNormalVectorsToolStripMenuItem.Checked = toolStripButtonShowNormals.Checked = _ui.ShowNormals;
            showBoundingBoxesToolStripMenuItem.Checked = toolStripButtonShowBB.Checked = _ui.ShowBBs;
            showAnimationSkeletonToolStripMenuItem.Checked = toolStripButtonShowSkeleton.Checked = _ui.ShowSkeleton;

            // manually register the MouseWheel handler
            glControl1.MouseWheel += OnMouseMove;

            // intercept all key events sent to children
            KeyPreview = true;

            InitRecentList();

#if LEAP
            //LeapMotion Support
            _leapListener = new LeapListener(this as MainWindow);
            _leapController = new Controller(_leapListener);
#endif

            // register listener for tab changs
           tabControl1.SelectedIndexChanged += (object o, EventArgs e) => {
               if (SelectedTabChanged != null)
               {
                   SelectedTabChanged(UiState.TabForId(tabControl1.SelectedTab));
               }
           };

            _initialized = true;
            StartUndoRedoUiStatePollLoop();
        }
コード例 #2
0
ファイル: Scene.cs プロジェクト: acgessler/open3mod
        /// <summary>
        /// Call once per frame to render the scene to the current viewport.
        /// </summary>
        public void Render(UiState state, ICameraController cam, Renderer target)
        {
            RenderFlags flags = 0;

            if (state.ShowNormals)
            {
                flags |= RenderFlags.ShowNormals;
            }
            if (state.ShowBBs)
            {
                flags |= RenderFlags.ShowBoundingBoxes;
            }
            if (state.ShowSkeleton || _overrideSkeleton)
            {
                flags |= RenderFlags.ShowSkeleton;
            }
            if (state.RenderLit)
            {
                flags |= RenderFlags.Shaded;
            }
            if (state.RenderTextured)
            {
                flags |= RenderFlags.Textured;
            }
            if (state.RenderWireframe)
            {
                flags |= RenderFlags.Wireframe;
            }

            flags |= RenderFlags.ShowGhosts;

            _wantSetTexturesChanged = false;
            _renderer.Render(cam, _meshesToShow, _nodesToShowChanged, _texturesChanged, flags, target);

            lock (_texChangeLock)
            {
                if (!_wantSetTexturesChanged)
                {
                    _texturesChanged = false;
                }
            }

            _nodesToShowChanged = false;
        }
コード例 #3
0
 private void OnCloseForm(object sender, FormClosedEventArgs e)
 {
     UiState.Dispose();
     _renderer.Dispose();
 }