Represents a 3D scene/asset loaded through assimp. This class contains the aiScene plus some auxiliary structures for drawing. Since assimp is the only source for model data and this is only a viewer, we ignore the recommendation of the assimp docs and use its data structures (almost) directly for rendering.
상속: IDisposable
예제 #1
0
        public AnimationInspectionView(Scene scene, TabPage tabPageAnimations)
        {
            _scene = scene;          
            
            Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
            Dock = DockStyle.Fill;
            InitializeComponent();

            tabPageAnimations.Controls.Add(this);

            listBoxAnimations.Items.Add("None (Bind Pose)");

            if (scene.Raw.Animations != null)
            {
                foreach (var anim in scene.Raw.Animations)
                {
                    var dur = anim.DurationInTicks;
                    if (anim.TicksPerSecond > 1e-10)
                    {
                        dur /= anim.TicksPerSecond;
                    }
                    else
                    {
                        dur /= SceneAnimator.DefaultTicksPerSecond;
                    }
                    listBoxAnimations.Items.Add(string.Format("{0} ({1}s)", anim.Name, dur.ToString("0.000")));
                }                
            }
            listBoxAnimations.SelectedIndex = 0;

            checkBoxLoop.Checked = _scene.SceneAnimator.Loop;
            _imagePlay = ImageFromResource.Get("open3mod.Images.PlayAnim.png");
            _imageStop = ImageFromResource.Get("open3mod.Images.StopAnim.png");
            buttonPlay.Image = _imagePlay;

            // initially, animations are disabled.
            _scene.SceneAnimator.AnimationPlaybackSpeed = 0.0;
            labelSpeedValue.Text = "1.0x";

            timeSlideControl.Rewind += (o, args) =>
            {
                if (_scene.SceneAnimator.ActiveAnimation >= 0)
                {
                    _scene.SceneAnimator.AnimationCursor = args.NewPosition;
                }
            };
        }
예제 #2
0
        /// <summary>
        /// Binds a scene to the InspectionView.
        /// </summary>
        /// <param name="scene">May be null, in this case the inspector remains disabled</param>
        public void SetSceneSource(Scene scene)
        {
            if (Scene == scene)
            {
                return;
            }

            Clear();
            Scene = scene;

            if(scene == null)
            {
                Enabled = false;
                return;
            }

            Enabled = true;
           
            Hierarchy = new HierarchyInspectionView(Scene, tabPageTree);
            Textures = new TextureInspectionView(Scene, textureFlowPanel);
            if(Textures.Empty)
            {
                // disable the texture tab altogether if there are no textures
                // this would need to be changed if there was a way to add 
                // new texture slots later on.
                tabControlInfoViewPicker.TabPages.Remove(tabPageTextures);
            }

            Animations = new AnimationInspectionView(Scene, tabPageAnimations);
            if (Animations.Empty)
            {
                // same for animations
                tabControlInfoViewPicker.TabPages.Remove(tabPageAnimations);
            }

            //
            Materials = new MaterialInspectionView(Scene, ParentForm as MainWindow, materialFlowPanel);
        }
예제 #3
0
파일: Tab.cs 프로젝트: JSandusky/open3mod
 /// <summary>
 /// Sets the tab to a permanent "failed to load" state. In this
 /// state, the tab keeps displaying an error message but nothing
 /// else. 
 /// </summary>
 /// <param name="message"></param>
 public void SetFailed(string message)
 {
     State = TabState.Failed;
     _activeScene = null;
     _errorMessage = message;
 }
예제 #4
0
파일: Renderer.cs 프로젝트: Kolky/open3mod
 private void DrawScene(Scene scene, ICameraController view)
 {
     Debug.Assert(scene != null);
     scene.Render(Window.UiState, view, this);
 }
예제 #5
0
 internal MaterialMapperClassicGl(Scene scene)
     : base(scene)
 {
 }