Esempio n. 1
0
        private void FileOpen(string[] Files, bool MergeMode)
        {
            if (!MergeMode)
            {
                Renderer.DeleteAll();

                Renderer.Lights.Add(new Light()
                {
                    Ambient         = new Color4(0.1f, 0.1f, 0.1f, 1.0f),
                    Diffuse         = new Color4(0.9f, 0.9f, 0.9f, 1.0f),
                    Specular0       = new Color4(0.8f, 0.8f, 0.8f, 1.0f),
                    Specular1       = new Color4(0.4f, 0.4f, 0.4f, 1.0f),
                    TwoSidedDiffuse = true,
                    Enabled         = true
                });

                ResetTransforms();

                Scene = FileIO.Merge(Files, Renderer);

                if (Scene != null)
                {
                    TextureManager.Textures = Scene.Textures;
                    ModelsList.Bind(Scene.Models);
                    TexturesList.Bind(Scene.Textures);
                    CamerasList.Bind(Scene.Cameras);
                    LightsList.Bind(Scene.Lights);
                    SklAnimsList.Bind(Scene.SkeletalAnimations);
                    MatAnimsList.Bind(Scene.MaterialAnimations);
                    VisAnimsList.Bind(Scene.VisibilityAnimations);
                    CamAnimsList.Bind(Scene.CameraAnimations);
                    LUTsList.Bind(Scene.LUTs);

                    Animator.Enabled     = false;
                    LblAnimSpeed.Text    = string.Empty;
                    LblAnimLoopMode.Text = string.Empty;
                    AnimSeekBar.Value    = 0;
                    AnimSeekBar.Maximum  = 0;
                    AnimGrp.Frame        = 0;
                    AnimGrp.FramesCount  = 0;

                    if (Scene.Models.Count > 0)
                    {
                        ModelsList.Select(0);
                    }
                    else
                    {
                        UpdateTransforms();
                    }
                }
            }
            else
            {
                Scene = FileIO.Merge(Files, Renderer, Scene);
            }
        }
Esempio n. 2
0
        private void FileOpen(string[] Files, bool MergeMode)
        {
            if (!MergeMode)                     //if not merging in a model
            {
                Renderer.DeleteAll();           //clear existing meshes

                Renderer.Lights.Add(new Light() //add a new light to the {scene/renderer}
                {
                    Ambient         = new Color4(0.1f, 0.1f, 0.1f, 1.0f),
                    Diffuse         = new Color4(0.9f, 0.9f, 0.9f, 1.0f),
                    Specular0       = new Color4(0.8f, 0.8f, 0.8f, 1.0f),
                    Specular1       = new Color4(0.4f, 0.4f, 0.4f, 1.0f),
                    TwoSidedDiffuse = true,
                    Enabled         = true
                });

                ResetTransforms();

                Scene = FileIO.Merge(Files, Renderer);

                TextureManager.Textures = Scene.Textures;

                ModelsList.Bind(Scene.Models);
                TexturesList.Bind(Scene.Textures);
                CamerasList.Bind(Scene.Cameras);
                LightsList.Bind(Scene.Lights);
                SklAnimsList.Bind(Scene.SkeletalAnimations);
                MatAnimsList.Bind(Scene.MaterialAnimations);
                VisAnimsList.Bind(Scene.VisibilityAnimations);
                CamAnimsList.Bind(Scene.CameraAnimations);

                Animator.Enabled     = false;
                LblAnimSpeed.Text    = string.Empty;
                LblAnimLoopMode.Text = string.Empty;
                AnimSeekBar.Value    = 0;
                AnimSeekBar.Maximum  = 0;
                AnimGrp.Frame        = 0;
                AnimGrp.FramesCount  = 0;

                if (Scene.Models.Count > 0)
                {
                    //TODO: if not moving camera on model select, move camera to default pos here
                    ModelsList.Select(0);
                }
                else
                {
                    UpdateTransforms();
                }
            }
            else
            {
                Scene = FileIO.Merge(Files, Renderer, Scene);
            }
        }