コード例 #1
0
ファイル: Material.cs プロジェクト: zhangxv12138/SB3Utility
        public void LoadFrom(Stream stream)
        {
            BinaryReader reader = new BinaryReader(stream);

            int numTexEnvs = reader.ReadInt32();

            m_TexEnvs = new List <KeyValuePair <FastPropertyName, UnityTexEnv> >(numTexEnvs);
            for (int i = 0; i < numTexEnvs; i++)
            {
                m_TexEnvs.Add
                (
                    new KeyValuePair <FastPropertyName, UnityTexEnv>
                    (
                        new FastPropertyName(stream),
                        new UnityTexEnv(file, stream)
                    )
                );
            }

            int numFloats = reader.ReadInt32();

            m_Floats = new List <KeyValuePair <FastPropertyName, float> >(numFloats);
            for (int i = 0; i < numFloats; i++)
            {
                m_Floats.Add
                (
                    new KeyValuePair <FastPropertyName, float>
                    (
                        new FastPropertyName(stream),
                        reader.ReadSingle()
                    )
                );
            }

            int numCols = reader.ReadInt32();

            m_Colors = new List <KeyValuePair <FastPropertyName, Color4> >(numCols);
            for (int i = 0; i < numCols; i++)
            {
                FastPropertyName name = new FastPropertyName(stream);
                Color4           col  = new Color4();
                col.Red   = reader.ReadSingle();
                col.Green = reader.ReadSingle();
                col.Blue  = reader.ReadSingle();
                col.Alpha = reader.ReadSingle();
                m_Colors.Add(new KeyValuePair <FastPropertyName, Color4>(name, col));
            }
        }
コード例 #2
0
ファイル: Material.cs プロジェクト: hejob/SB3Utility
        public void LoadFrom(Stream stream)
        {
            BinaryReader reader = new BinaryReader(stream);

            int numTexEnvs = reader.ReadInt32();
            m_TexEnvs = new List<KeyValuePair<FastPropertyName, UnityTexEnv>>(numTexEnvs);
            for (int i = 0; i < numTexEnvs; i++)
            {
                m_TexEnvs.Add
                (
                    new KeyValuePair<FastPropertyName, UnityTexEnv>
                    (
                        new FastPropertyName(stream),
                        new UnityTexEnv(file, stream)
                    )
                );
            }

            int numFloats = reader.ReadInt32();
            m_Floats = new List<KeyValuePair<FastPropertyName, float>>(numFloats);
            for (int i = 0; i < numFloats; i++)
            {
                m_Floats.Add
                (
                    new KeyValuePair<FastPropertyName, float>
                    (
                        new FastPropertyName(stream),
                        reader.ReadSingle()
                    )
                );
            }

            int numCols = reader.ReadInt32();
            m_Colors = new List<KeyValuePair<FastPropertyName, Color4>>(numCols);
            for (int i = 0; i < numCols; i++)
            {
                FastPropertyName name = new FastPropertyName(stream);
                Color4 col = new Color4();
                col.Red = reader.ReadSingle();
                col.Green = reader.ReadSingle();
                col.Blue = reader.ReadSingle();
                col.Alpha = reader.ReadSingle();
                m_Colors.Add(new KeyValuePair<FastPropertyName, Color4>(name, col));
            }
        }