Ejemplo n.º 1
0
 public void SetDefaults()
 {
     m_Enabled                  = true;
     m_CastShadows              = 1;
     m_ReceiveShadows           = 1;
     m_LightmapIndex            = file.VersionNumber >= AssetCabinet.VERSION_5_0_0 ? -1 : 255;
     m_LightmapTilingOffset     = new Vector4(1, 1, 0, 0);
     m_Materials                = new List <PPtr <Material> >(1);
     m_SubsetIndices            = new uint[0];
     m_StaticBatchInfo          = new StaticBatchInfo();
     m_StaticBatchRoot          = new PPtr <Transform>((Component)null);
     m_ProbeAnchor              = new PPtr <Transform>((Component)null);
     m_LightProbeVolumeOverride = new PPtr <GameObject>((Component)null);
     m_AdditionalVertexStreams  = new PPtr <Mesh>((Component)null);
 }
Ejemplo n.º 2
0
        public void LoadFrom(Stream stream)
        {
            BinaryReader reader = new BinaryReader(stream);

            m_GameObject = new PPtr <GameObject>(stream, file);
            m_Enabled    = reader.ReadBoolean();
            if (file.VersionNumber >= AssetCabinet.VERSION_5_0_0 && file.VersionNumber < AssetCabinet.VERSION_5_4_1)
            {
                stream.Position += 3;
            }
            m_CastShadows    = reader.ReadByte();
            m_ReceiveShadows = reader.ReadByte();
            if (file.VersionNumber >= AssetCabinet.VERSION_5_0_0)
            {
                if (file.VersionNumber >= AssetCabinet.VERSION_5_4_1)
                {
                    m_MotionVectors        = reader.ReadByte();
                    m_LightProbeUsage      = reader.ReadByte();
                    m_ReflectionProbeUsage = reader.ReadByte();
                }
                stream.Position += 2;
            }
            m_LightmapIndex        = file.VersionNumber >= AssetCabinet.VERSION_5_0_0 ? reader.ReadInt32() : reader.ReadByte();
            m_LightmapTilingOffset = reader.ReadVector4();
            if (file.VersionNumber >= AssetCabinet.VERSION_5_0_0)
            {
                m_LightmapTilingOffsetDynamic = reader.ReadVector4();
            }

            int numMaterials = reader.ReadInt32();

            m_Materials = new List <PPtr <Material> >(numMaterials);
            for (int i = 0; i < numMaterials; i++)
            {
                m_Materials.Add(new PPtr <Material>(stream, file));
            }

            if (file.VersionNumber < AssetCabinet.VERSION_5_5_0)
            {
                int numSubsetIndices = reader.ReadInt32();
                m_SubsetIndices = reader.ReadUInt32Array(numSubsetIndices);
            }
            else
            {
                m_StaticBatchInfo = new StaticBatchInfo(stream);
            }

            m_StaticBatchRoot = new PPtr <Transform>(stream, file);
            if (file.VersionNumber < AssetCabinet.VERSION_5_4_1)
            {
                m_LightProbeUsage = reader.ReadByte();
                stream.Position  += 3;
                if (file.VersionNumber >= AssetCabinet.VERSION_5_0_0)
                {
                    m_ReflectionProbeUsage = reader.ReadInt32();
                }
            }
            m_ProbeAnchor = new PPtr <Transform>(stream, file);
            if (file.VersionNumber >= AssetCabinet.VERSION_5_4_1)
            {
                m_LightProbeVolumeOverride = new PPtr <GameObject>(stream, file);
            }
            m_SortingLayerID = reader.ReadUInt32();
            if (file.VersionNumber >= AssetCabinet.VERSION_5_6_2)
            {
                m_SortingLayer = reader.ReadInt16();
            }
            m_SortingOrder = reader.ReadInt16();
            if (file.VersionNumber < AssetCabinet.VERSION_5_6_2)
            {
                stream.Position += 2;
            }
            if (file.VersionNumber >= AssetCabinet.VERSION_5_0_0 && classID1 == UnityClassID.MeshRenderer)
            {
                m_AdditionalVertexStreams = new PPtr <Mesh>(stream, file);
            }
        }