示例#1
0
文件: Audit.cs 项目: pdjonov/x42view
        public Auditor( Libx42.Model model )
        {
            if( model == null )
                throw new ArgumentNullException( "model" );

            this.model = model;

            modelScore = new ModelScore( model );
        }
示例#2
0
        public ModelContext( Scene owner, string path )
            : base(owner)
        {
            if( path == null )
                throw new ArgumentNullException( "path" );

            this.path = path;

            IGraphicsDeviceService gds =
                owner.GetService<IGraphicsDeviceService>();

            this.model = new Libx42.Model( path );
        }
示例#3
0
        public VisualDiff OpenDiffView( string path1, string path2 )
        {
            Libx42.Model model1 = null;
            Libx42.Model model2 = null;

            try
            {
                try
                {
                    model1 = new Libx42.Model( path1 );
                }
                catch( Exception err )
                {
                    MessageBox.Show( this, string.Format( "Error opening '{0}':\n\n{1} - '{2}'", path1, err.GetType().Name, err.Message ),
                        "Error", MessageBoxButtons.OK, MessageBoxIcon.Error );
                    return null;
                }

                try
                {
                    model2 = new Libx42.Model( path2 );
                }
                catch( Exception err )
                {
                    MessageBox.Show( this, string.Format( "Error opening '{0}':\n\n{1} - '{2}'", path2, err.GetType().Name, err.Message ),
                        "Error", MessageBoxButtons.OK, MessageBoxIcon.Error );
                    return null;
                }

                VisualDiff diff = new VisualDiff( model1, model2 );

                //diff takes ownership
                model1 = null;
                model2 = null;

                diff.MdiParent = this;
                diff.Show();

                return diff;
            }
            finally
            {
                Helpers.DisposeAndClear( ref model1 );
                Helpers.DisposeAndClear( ref model2 );
            }
        }
示例#4
0
        public ModelRenderBuffers( Scene scene, Libx42.Model model )
            : base(scene.GetService<IGraphicsDeviceService>())
        {
            if( model == null )
                throw new ArgumentNullException( "model" );

            Libx42.AnimationFlags flags = Libx42.AnimationFlags.None;

            if( model.HasNormalData )
                flags |= Libx42.AnimationFlags.IncludeNormals;

            if( model.HasTangentBasisData )
            {
                flags |= Libx42.AnimationFlags.IncludeNormals;
                flags |= Libx42.AnimationFlags.IncludeTangentBasis;
            }

            this.model = model;
            this.animBuf = model.CreateAnimationBuffer( flags );
        }
示例#5
0
            public ModelItem( string path, string dispName )
                : base(path)
            {
                Text = dispName;
                ImageIndex = 1;

                using( FileStream fs = new FileStream( path, FileMode.Open, FileAccess.Read, FileShare.Read ) )
                {
                    SubItems.Add( Helpers.FormatFileSize( fs.Length ) );

                    using( Libx42.Model model = new Libx42.Model( fs ) )
                    {
                        SubItems.Add( string.Format( "{0}", model.Bones.Count ) );
                        SubItems.Add( string.Format( "{0}", model.Groups.Count ) );

                        Audit.Auditor audit = new x42view.Audit.Auditor( model );
                        audit.Run();

                        SubItems.Add( string.Format( "{0:#,#}", audit.Score.OverallScore ) );

                        scores = new int[model.Lods.Count];
                        for( int i = 0; i < scores.Length; i++ )
                            scores[i] = audit.Score.LodScores[i].OverallScore;
                    }
                }
            }
示例#6
0
文件: Audit.cs 项目: pdjonov/x42view
        internal ModelScore( Libx42.Model model )
        {
            this.model = model;

            for( int i = 0; i < model.Lods.Count; i++ )
                lodScores.Add( new LodScore( model.Lods[i] ) );
        }
示例#7
0
        private void fiReload_Click( object sender, EventArgs e )
        {
            if( path == null )
                return;

            Libx42.Model m;

            try
            {
                m = new Libx42.Model( path );
            }
            catch( Exception ex )
            {
                MessageBox.Show( this, "Couldn't reload the model:\n\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error );
                return;
            }

            using( Libx42.Model oldModel = model.Model )
                model.Model = m;
        }
示例#8
0
        private void btnReload_Click( object sender, EventArgs e )
        {
            Libx42.Model m;

            try
            {
                m = new Libx42.Model( path );
            }
            catch( Exception ex )
            {
                MessageBox.Show( this, "Couldn't reload the model:\n\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error );
                return;
            }

            pn3D.Enable3D = false; //destroy device

            string camTag = null;
            if( cameraTag != null )
            {
                camTag = cameraTag.Name;
                cameraTag = null;
            }

            Camera.State sv = pn3DCamera.SaveState();

            using( Libx42.Model oldModel = model.Model )
                model.Model = m;

            GenGroupTopology(); //refresh this data before the reload

            if( camTag != null )
            {
                foreach( Libx42.Tag tag in model.Model.Tags )
                    if( tag.Name == camTag )
                    {
                        cameraTag = tag;
                        break;
                    }
            }

            pn3DCamera.RestoreState( sv );
            pn3DCamera.Enabled = cameraTag == null;

            pn3D.Enable3D = true; //bring it back
        }
示例#9
0
        public RawDataView OpenRawDataView( string path )
        {
            try
            {
                Libx42.Model model = new Libx42.Model( path );

                RawDataView wnd = new RawDataView( model, path );
                wnd.MdiParent = this;

                wnd.Show();

                return wnd;
            }
            catch( Exception err )
            {
                MessageBox.Show( this, string.Format( "Error opening '{0}':\n\n{1} - '{2}'", path, err.GetType().Name, err.Message ),
                    "Error", MessageBoxButtons.OK, MessageBoxIcon.Error );
                return null;
            }
        }