Exemplo n.º 1
0
    private void ReadIndices(ReadChunk chunk)
    {
        List <uint> indicesVector = new List <uint>();

        while (chunk.BytesAvailable() > 0)
        {
            indicesVector.Add(chunk.Bytes.ReadUInt16());
        }
        resource[chunk.Id] = indicesVector;
    }
Exemplo n.º 2
0
    private void ReadBuffer(ReadChunk chunk)
    {
        List <float> verticesVector = new List <float>();

        while (chunk.BytesAvailable() > 0)
        {
            verticesVector.Add(chunk.Bytes.ReadSingle());
        }
        resource[chunk.Id] = verticesVector;
    }
Exemplo n.º 3
0
    private void ReadObject(ReadChunk chunk)
    {
        ReadChunk    data;
        BinaryReader input = chunk.Bytes;
        string       type  = ReadUtil.ReadUTF(chunk.Bytes);
        string       name  = ReadUtil.ReadUTF(chunk.Bytes);

        //名字不能包含\
        name = System.Text.RegularExpressions.Regex.Replace(name, @"/+|\*+|\\+", string.Empty);
        if (!uniqueName.ContainsKey(name))
        {
            uniqueName.Add(name, 1);
        }
        else
        {
            uniqueName[name]++;
            if (uniqueName[name] > 1)
            {
                name = name + uniqueName[name].ToString();
            }
        }


        UnityEngine.Matrix4x4 matrix = ReadMatrix3D(chunk.Bytes, _compressionLevel);
        int   layer      = chunk.Bytes.ReadInt16();
        int   parent     = chunk.Bytes.ReadInt16();
        float frameSpeed = chunk.Bytes.ReadSingle();

        if (parent != -1)
        {
            matrix = cascadeTransform[parent] * matrix;
        }
        cascadeTransform[chunk.Id] = matrix;

        while (chunk.BytesAvailable() > 0)
        {
            data = new ReadChunk(input);
            switch (data.Name)
            {
            case "particleSysterm":
                ReadParticleSystem(name, layer, matrix, data, parent, chunk.Id);
                break;

            case "extends":
                ReadExtends(data);
                break;

            default:
                System.Diagnostics.Debug.WriteLine("未识别属性{0}", data.Name);
                break;
            }
            data.Next();
        }
    }