Esempio n. 1
0
    void ReadAttribs(System.IO.BinaryReader bin_stream)
    {
        attribs = new List <VoxelAttrib>();

        voxel_len = 0;

        int count = bin_stream.ReadByte();
        int i     = 0;

        for (int id = 0; id < count; id++)
        {
            var attrib = new VoxelAttrib();
            attrib.name = ReadString(bin_stream).ToLower();
            attrib.i    = i;
            attrib.n    = bin_stream.ReadByte();
            i          += attrib.n;
            voxel_len  += attrib.n;

            attribs.Add(attrib);

            if (PrintChannelNames)
            {
                Debug.Log(attrib.name);
            }

            if (attrib.name == color_name.ToLower())
            {
                color_i0 = attrib.i;
                color_i1 = color_i0 + attrib.n;
            }
            else if (attrib.name == normal_name.ToLower())
            {
                normal_i0 = attrib.i;
                normal_i1 = normal_i0 + attrib.n;
            }
            else if (attrib.name == ao_name.ToLower())
            {
                ao_i0 = attrib.i;
                ao_i1 = ao_i0 + attrib.n;
            }
        }
    }
Esempio n. 2
0
    void ReadAttribs(System.IO.BinaryReader bin_stream)
    {
        attribs = new List<VoxelAttrib>();

        voxel_len = 0;

        int count = bin_stream.ReadByte();
        int i = 0;
        for (int id = 0; id < count; id++) {
            var attrib = new VoxelAttrib();
            attrib.name = ReadString(bin_stream).ToLower();
            attrib.i = i;
            attrib.n = bin_stream.ReadByte();
            i += attrib.n;
            voxel_len += attrib.n;

            attribs.Add(attrib);

            if (PrintChannelNames) Debug.Log(attrib.name);

            if (attrib.name == color_name.ToLower()) {
                color_i0 = attrib.i;
                color_i1 = color_i0 + attrib.n;
            } else if (attrib.name == normal_name.ToLower()) {
                normal_i0 = attrib.i;
                normal_i1 = normal_i0 + attrib.n;
            } else if (attrib.name == ao_name.ToLower()) {
                ao_i0 = attrib.i;
                ao_i1 = ao_i0 + attrib.n;
            }
        }
    }