Esempio n. 1
0
            public bool CheckAndUpdateInfo()
            {
                VertsCount     = 0;
                PolygonsCount  = 0;
                SubMeshesCount = 0;
                bool fileExist = System.IO.File.Exists(Path);

                if (!fileExist)
                {
                    Info       = "missing file";
                    VertsCount = -1;
                    return(false);
                }
                else if (ObjData.GetObjInfo(Path, ref MeshName, ref VertsCount, ref PolygonsCount, ref SubMeshesCount))
                {
                    Info = string.Format("{0}.obj {1} verts, {2} polygons, {3} submeshes", MeshName, VertsCount, PolygonsCount, SubMeshesCount);
                    return(true);
                }
                else
                {
                    Info       = "not valid obj file";
                    VertsCount = -1;
                    return(false);
                }
            }
Esempio n. 2
0
                bool GetPointCacheSourceStatistic(string path, ref string name, ref int vertCount, ref int framesCount, ref string message)
                {
                    string extension = System.IO.Path.GetExtension(path);

                    if (extension == ".obj")
                    {
                        MeshSequenceInfo msi = new MeshSequenceInfo(path, MeshSequenceInfo.SortModeEnum.ByNumber);
                        name        = msi.SequenceName;
                        framesCount = msi.infos.Length;
                        vertCount   = 0;
                        ObjData.GetObjInfo(path, ref vertCount);
                        return(true);
                    }
                    else
                    {
                        name = (new System.IO.FileInfo(path)).Name;
                        System.IO.FileStream   fs        = new System.IO.FileStream(path, System.IO.FileMode.Open);
                        System.IO.BinaryReader binReader = new System.IO.BinaryReader(fs);
                        binReader.ReadChars(12);
                        binReader.ReadInt32();
                        vertCount = binReader.ReadInt32();
                        binReader.ReadSingle(); //start frame
                        binReader.ReadSingle(); //sample rate
                        framesCount = binReader.ReadInt32();


#if UNITY_WSA
                        binReader.Dispose();
                        fs.Dispose();
#else
                        binReader.Close();
                        fs.Close();
#endif


                        return(vertCount > 0 && framesCount > 0);
                    }
                }