Example #1
0
 public Material(AssetCabinet file) :
     this(file, 0, UnityClassID.Material, UnityClassID.Material)
 {
     file.ReplaceSubfile(-1, this, null);
     if (file.VersionNumber >= AssetCabinet.VERSION_5_0_0)
     {
         stringTagMap = new List <KeyValuePair <FastPropertyName, FastPropertyName> >();
     }
     m_SavedProperties = new UnityPropertySheet(file);
 }
Example #2
0
        public void LoadFrom(Stream stream)
        {
            BinaryReader reader = new BinaryReader(stream);

            m_Name   = reader.ReadNameA4();
            m_Shader = new PPtr <Shader>(stream, file);

            int numShaderKeywords = reader.ReadInt32();

            m_ShaderKeywords = new List <string>(numShaderKeywords);
            for (int i = 0; i < numShaderKeywords; i++)
            {
                m_ShaderKeywords.Add(reader.ReadNameA4());
            }

            m_CustomRenderQueue = reader.ReadInt32();
            m_SavedProperties   = new UnityPropertySheet(file, stream);
        }
Example #3
0
 public Material(AssetCabinet file) :
     this(file, 0, UnityClassID.Material, UnityClassID.Material)
 {
     file.ReplaceSubfile(-1, this, null);
     m_SavedProperties = new UnityPropertySheet(file);
 }
Example #4
0
        public void LoadFrom(Stream stream)
        {
            BinaryReader reader = new BinaryReader(stream);

            m_Name   = reader.ReadNameA4U8();
            m_Shader = new PPtr <Shader>(stream, file);

            if (file.VersionNumber >= AssetCabinet.VERSION_5_0_0)
            {
                string   space_separated   = reader.ReadNameA4U8();
                string[] split             = space_separated.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                int      numShaderKeywords = split.Length;
                m_ShaderKeywords = new List <string>(numShaderKeywords);
                for (int i = 0; i < numShaderKeywords; i++)
                {
                    m_ShaderKeywords.Add(split[i]);
                }
                m_LightmapFlags = reader.ReadUInt32();

                if (file.VersionNumber >= AssetCabinet.VERSION_5_6_2)
                {
                    m_EnableInstancingVariants = reader.ReadBoolean();
                    m_DoubleSidedGI            = reader.ReadBoolean();
                    stream.Position           += 2;
                }
            }
            else
            {
                int numShaderKeywords = reader.ReadInt32();
                m_ShaderKeywords = new List <string>(numShaderKeywords);
                for (int i = 0; i < numShaderKeywords; i++)
                {
                    m_ShaderKeywords.Add(reader.ReadNameA4U8());
                }
            }

            m_CustomRenderQueue = reader.ReadInt32();

            if (file.VersionNumber >= AssetCabinet.VERSION_5_0_0)
            {
                int numNames = reader.ReadInt32();
                stringTagMap = new List <KeyValuePair <FastPropertyName, FastPropertyName> >(numNames);
                for (int i = 0; i < numNames; i++)
                {
                    stringTagMap.Add
                    (
                        new KeyValuePair <FastPropertyName, FastPropertyName>
                        (
                            new FastPropertyName(stream),
                            new FastPropertyName(stream)
                        )
                    );
                }

                if (file.VersionNumber >= AssetCabinet.VERSION_5_6_2)
                {
                    int numPasses = reader.ReadInt32();
                    disabledShaderPasses = new List <string>(numPasses);
                    for (int i = 0; i < numPasses; i++)
                    {
                        disabledShaderPasses.Add(reader.ReadNameA4U8());
                    }
                }
            }

            m_SavedProperties = new UnityPropertySheet(file, stream);
        }
Example #5
0
 public Material(AssetCabinet file)
     : this(file, 0, UnityClassID.Material, UnityClassID.Material)
 {
     file.ReplaceSubfile(-1, this, null);
     m_SavedProperties = new UnityPropertySheet(file);
 }
Example #6
0
        public void LoadFrom(Stream stream)
        {
            BinaryReader reader = new BinaryReader(stream);
            m_Name = reader.ReadNameA4();
            m_Shader = new PPtr<Shader>(stream, file);

            int numShaderKeywords = reader.ReadInt32();
            m_ShaderKeywords = new List<string>(numShaderKeywords);
            for (int i = 0; i < numShaderKeywords; i++)
            {
                m_ShaderKeywords.Add(reader.ReadNameA4());
            }

            m_CustomRenderQueue = reader.ReadInt32();
            m_SavedProperties = new UnityPropertySheet(file, stream);
        }