Пример #1
0
    public void MountImage(MegaCacheImage image)
    {
        if (image)
        {
            subs = new MegaCacheImageFace[image.maxsm];

            for (int i = 0; i < image.maxsm; i++)
            {
                MegaCacheImageFace cf = new MegaCacheImageFace();

                cf.max  = image.smfc[i];
                cf.tris = new int[cf.max];
                subs[i] = cf;
            }

            vertcache    = new Vector3[image.maxv];
            normcache    = new Vector3[image.maxv];
            tangentcache = new Vector4[image.maxv];
            uvcache      = new Vector2[image.maxv];
        }
    }
Пример #2
0
    public void OpenCache(string filename)
    {
        if (filename.Length == 0)
        {
            return;
        }

        fs = new FileStream(filename, FileMode.Open);
        if (fs != null)
        {
            br = new BinaryReader(fs);

            if (br != null)
            {
                int version = br.ReadInt32();

                if (version == 0)
                {
                    framecount = br.ReadInt32();

                    optimized = br.ReadBoolean();

                    maxv = br.ReadInt32();
                    br.ReadInt32();
                    maxsm = br.ReadInt32();

                    subs = new MegaCacheImageFace[maxsm];

                    for (int i = 0; i < maxsm; i++)
                    {
                        MegaCacheImageFace cf = new MegaCacheImageFace();

                        cf.max  = br.ReadInt32();
                        cf.tris = new int[cf.max];
                        subs[i] = cf;
                    }
                }

                vertcache    = new Vector3[maxv];
                normcache    = new Vector3[maxv];
                tangentcache = new Vector4[maxv];
                uvcache      = new Vector2[maxv];

                if (buffer == null || buffer.Length < maxv * 16)
                {
                    buffer = new byte[maxv * 16];
                }

                meshoffs = new long[framecount];

                for (int i = 0; i < framecount; i++)
                {
                    meshoffs[i] = br.ReadInt64();
                }

                ClearMesh();
                Mesh mesh = new Mesh();
                mf.sharedMesh = mesh;
                update        = true;
            }
        }
    }
Пример #3
0
    public void OpenCache(string filename)
    {
        if ( filename.Length == 0 )
            return;

        fs = new FileStream(filename, FileMode.Open);
        if ( fs != null )
        {
            br = new BinaryReader(fs);

            if ( br != null )
            {
                int version = br.ReadInt32();

                if ( version == 0 )
                {
                    framecount = br.ReadInt32();

                    optimized = br.ReadBoolean();

                    maxv = br.ReadInt32();
                    br.ReadInt32();
                    maxsm = br.ReadInt32();

                    subs = new MegaCacheImageFace[maxsm];

                    for ( int i = 0; i < maxsm; i++ )
                    {
                        MegaCacheImageFace cf = new MegaCacheImageFace();

                        cf.max = br.ReadInt32();
                        cf.tris = new int[cf.max];
                        subs[i] = cf;
                    }
                }

                vertcache = new Vector3[maxv];
                normcache = new Vector3[maxv];
                tangentcache = new Vector4[maxv];
                uvcache = new Vector2[maxv];

                if ( buffer == null || buffer.Length < maxv * 16 )
                    buffer = new byte[maxv * 16];

                meshoffs = new long[framecount];

                for ( int i = 0; i < framecount; i++ )
                    meshoffs[i] = br.ReadInt64();

                ClearMesh();
                Mesh mesh = new Mesh();
                mf.sharedMesh = mesh;
                update = true;
            }
        }
    }
Пример #4
0
    public void MountImage(MegaCacheImage image)
    {
        if ( image )
        {
            subs = new MegaCacheImageFace[image.maxsm];

            for ( int i = 0; i < image.maxsm; i++ )
            {
                MegaCacheImageFace cf = new MegaCacheImageFace();

                cf.max = image.smfc[i];
                cf.tris = new int[cf.max];
                subs[i] = cf;
            }

            vertcache = new Vector3[image.maxv];
            normcache = new Vector3[image.maxv];
            tangentcache = new Vector4[image.maxv];
            uvcache = new Vector2[image.maxv];
        }
    }