Example #1
0
        public BlendTreeNodeConstant(ObjectReader reader)
        {
            var version = reader.version;

            m_BlendType     = reader.ReadUInt32();
            m_BlendEventID  = reader.ReadUInt32();
            m_BlendEventYID = reader.ReadUInt32();
            m_ChildIndices  = reader.ReadUInt32Array(reader.ReadInt32());
            m_Blend1dData   = new Blend1dDataConstant(reader);
            m_Blend2dData   = new Blend2dDataConstant(reader);
            if (version[0] >= 5) //5.0 and up
            {
                m_BlendDirectData = new BlendDirectDataConstant(reader);
            }

            m_ClipID = reader.ReadUInt32();
            if (version[0] < 5) //5.0 down
            {
                m_ClipIndex = reader.ReadUInt32();
            }

            m_Duration    = reader.ReadSingle();
            m_CycleOffset = reader.ReadSingle();
            m_Mirror      = reader.ReadBoolean();
            reader.AlignStream(4);
        }
        public StateMachineConstant(ObjectReader reader)
        {
            var version = reader.version;

            int numStates = reader.ReadInt32();

            m_StateConstantArray = new StateConstant[numStates];
            for (int i = 0; i < numStates; i++)
            {
                m_StateConstantArray[i] = new StateConstant(reader);
            }

            int numAnyStates = reader.ReadInt32();

            m_AnyStateTransitionConstantArray = new TransitionConstant[numAnyStates];
            for (int i = 0; i < numAnyStates; i++)
            {
                m_AnyStateTransitionConstantArray[i] = new TransitionConstant(reader);
            }

            if (version[0] >= 5) //5.0 and up
            {
                int numSelectors = reader.ReadInt32();
                m_SelectorStateConstantArray = new SelectorStateConstant[numSelectors];
                for (int i = 0; i < numSelectors; i++)
                {
                    m_SelectorStateConstantArray[i] = new SelectorStateConstant(reader);
                }
            }

            m_DefaultState   = reader.ReadUInt32();
            m_MotionSetCount = reader.ReadUInt32();
        }
 public ConditionConstant(ObjectReader reader)
 {
     m_ConditionMode  = reader.ReadUInt32();
     m_EventID        = reader.ReadUInt32();
     m_EventThreshold = reader.ReadSingle();
     m_ExitTime       = reader.ReadSingle();
 }
Example #4
0
 public MeshBlendShape(ObjectReader reader)
 {
     firstVertex = reader.ReadUInt32();
     vertexCount = reader.ReadUInt32();
     hasNormals  = reader.ReadBoolean();
     hasTangents = reader.ReadBoolean();
     reader.AlignStream();
 }
Example #5
0
 public HumanPoseMask(ObjectReader reader)
 {
     word0 = reader.ReadUInt32();
     word1 = reader.ReadUInt32();
     if (reader.version[0] >= 5) //5.0 and up
     {
         word2 = reader.ReadUInt32();
     }
 }
        public HumanPoseMask(ObjectReader reader)
        {
            var version = reader.version;

            word0 = reader.ReadUInt32();
            word1 = reader.ReadUInt32();
            if (version[0] > 5 || (version[0] == 5 && version[1] >= 2)) //5.2 and up
            {
                word2 = reader.ReadUInt32();
            }
        }
 public Collider(ObjectReader reader)
 {
     m_X           = new xform(reader);
     m_Type        = reader.ReadUInt32();
     m_XMotionType = reader.ReadUInt32();
     m_YMotionType = reader.ReadUInt32();
     m_ZMotionType = reader.ReadUInt32();
     m_MinLimitX   = reader.ReadSingle();
     m_MaxLimitX   = reader.ReadSingle();
     m_MaxLimitY   = reader.ReadSingle();
     m_MaxLimitZ   = reader.ReadSingle();
 }
Example #8
0
        public Avatar(ObjectReader reader) : base(reader)
        {
            m_AvatarSize = reader.ReadUInt32();
            m_Avatar = new AvatarConstant(reader);

            int numTOS = reader.ReadInt32();
            m_TOS = new KeyValuePair<uint, string>[numTOS];
            for (int i = 0; i < numTOS; i++)
            {
                m_TOS[i] = new KeyValuePair<uint, string>(reader.ReadUInt32(), reader.ReadAlignedString());
            }
        }
Example #9
0
        public ValueConstant(ObjectReader reader)
        {
            var version = reader.version;

            m_ID = reader.ReadUInt32();
            if (version[0] < 5 || (version[0] == 5 && version[1] < 5))//5.5 down
            {
                m_TypeID = reader.ReadUInt32();
            }
            m_Type  = reader.ReadUInt32();
            m_Index = reader.ReadUInt32();
        }
Example #10
0
 public LayerConstant(ObjectReader reader)
 {
     m_StateMachineIndex          = reader.ReadUInt32();
     m_StateMachineMotionSetIndex = reader.ReadUInt32();
     m_BodyMask                 = new HumanPoseMask(reader);
     m_SkeletonMask             = new SkeletonMask(reader);
     m_Binding                  = reader.ReadUInt32();
     m_LayerBlendingMode        = reader.ReadInt32();
     m_DefaultWeight            = reader.ReadSingle();
     m_IKPass                   = reader.ReadBoolean();
     m_SyncedLayerAffectsTiming = reader.ReadBoolean();
     reader.AlignStream(4);
 }
Example #11
0
        public VertexData(ObjectReader reader)
        {
            var version = reader.version;

            if (version[0] < 2018)//2018 down
            {
                m_CurrentChannels = reader.ReadUInt32();
            }

            m_VertexCount = reader.ReadUInt32();

            if (version[0] >= 4) //4.0 and up
            {
                var m_ChannelsSize = reader.ReadInt32();
                m_Channels = new ChannelInfo[m_ChannelsSize];
                for (int i = 0; i < m_ChannelsSize; i++)
                {
                    m_Channels[i] = new ChannelInfo(reader);
                }
            }

            if (version[0] < 5) //5.0 down
            {
                if (version[0] < 4)
                {
                    m_Streams = new StreamInfo[4];
                }
                else
                {
                    m_Streams = new StreamInfo[reader.ReadInt32()];
                }

                for (int i = 0; i < m_Streams.Length; i++)
                {
                    m_Streams[i] = new StreamInfo(reader);
                }

                if (version[0] < 4) //4.0 down
                {
                    GetChannels(version);
                }
            }
            else //5.0 and up
            {
                GetStreams(version);
            }

            m_DataSize = reader.ReadBytes(reader.ReadInt32());
            reader.AlignStream();
        }
Example #12
0
        public StreamingInfo(ObjectReader reader)
        {
            var version = reader.version;

            if (version[0] >= 2020) //2020.1 and up
            {
                offset = reader.ReadInt64();
            }
            else
            {
                offset = reader.ReadUInt32();
            }
            size = reader.ReadUInt32();
            path = reader.ReadAlignedString();
        }
        public Avatar(ObjectReader reader) : base(reader)
        {
            m_AvatarSize = reader.ReadUInt32();
            m_Avatar     = new AvatarConstant(reader);

            var numTOS = reader.ReadInt32();

            m_TOS = new KeyValuePair <uint, string> [numTOS];
            for (var i = 0; i < numTOS; i++)
            {
                m_TOS[i] = new KeyValuePair <uint, string>(reader.ReadUInt32(), reader.ReadAlignedString());
            }

            //HumanDescription m_HumanDescription 2019 and up
        }
Example #14
0
        public SerializedPass(ObjectReader reader)
        {
            var version = reader.version;

            if (version[0] > 2020 || (version[0] == 2020 && version[1] >= 2)) //2020.2 and up
            {
                int numEditorDataHash = reader.ReadInt32();
                m_EditorDataHash = new Hash128[numEditorDataHash];
                for (int i = 0; i < numEditorDataHash; i++)
                {
                    m_EditorDataHash[i] = new Hash128(reader);
                }
                reader.AlignStream();
                m_Platforms = reader.ReadUInt8Array();
                reader.AlignStream();
                if (version[0] < 2021 || (version[0] == 2021 && version[1] < 2)) //2021.1 and down
                {
                    m_LocalKeywordMask = reader.ReadUInt16Array();
                    reader.AlignStream();
                    m_GlobalKeywordMask = reader.ReadUInt16Array();
                    reader.AlignStream();
                }
            }

            int numIndices = reader.ReadInt32();

            m_NameIndices = new KeyValuePair <string, int> [numIndices];
            for (int i = 0; i < numIndices; i++)
            {
                m_NameIndices[i] = new KeyValuePair <string, int>(reader.ReadAlignedString(), reader.ReadInt32());
            }

            m_Type        = (PassType)reader.ReadInt32();
            m_State       = new SerializedShaderState(reader);
            m_ProgramMask = reader.ReadUInt32();
            progVertex    = new SerializedProgram(reader);
            progFragment  = new SerializedProgram(reader);
            progGeometry  = new SerializedProgram(reader);
            progHull      = new SerializedProgram(reader);
            progDomain    = new SerializedProgram(reader);
            if (version[0] > 2019 || (version[0] == 2019 && version[1] >= 3)) //2019.3 and up
            {
                progRayTracing = new SerializedProgram(reader);
            }
            m_HasInstancingVariant = reader.ReadBoolean();
            if (version[0] >= 2018) //2018 and up
            {
                var m_HasProceduralInstancingVariant = reader.ReadBoolean();
            }
            reader.AlignStream();
            m_UseName     = reader.ReadAlignedString();
            m_Name        = reader.ReadAlignedString();
            m_TextureName = reader.ReadAlignedString();
            m_Tags        = new SerializedTagMap(reader);
            if (version[0] > 2021 || (version[0] == 2021 && version[1] >= 2)) //2021.2 and up
            {
                m_SerializedKeywordStateMask = reader.ReadUInt16Array();
                reader.AlignStream();
            }
        }
Example #15
0
 public MeshBlendShapeChannel(ObjectReader reader)
 {
     name       = reader.ReadAlignedString();
     nameHash   = reader.ReadUInt32();
     frameIndex = reader.ReadInt32();
     frameCount = reader.ReadInt32();
 }
Example #16
0
 public Shader(ObjectReader reader) : base(reader)
 {
     if (version[0] == 5 && version[1] >= 5 || version[0] > 5) //5.5 and up
     {
         m_ParsedForm = new SerializedShader(reader);
         platforms    = reader.ReadUInt32Array().Select(x => (ShaderCompilerPlatform)x).ToArray();
         if (version[0] > 2019 || (version[0] == 2019 && version[1] >= 3)) //2019.3 and up
         {
             offsets             = reader.ReadUInt32ArrayArray().Select(x => x[0]).ToArray();
             compressedLengths   = reader.ReadUInt32ArrayArray().Select(x => x[0]).ToArray();
             decompressedLengths = reader.ReadUInt32ArrayArray().Select(x => x[0]).ToArray();
         }
         else
         {
             offsets             = reader.ReadUInt32Array();
             compressedLengths   = reader.ReadUInt32Array();
             decompressedLengths = reader.ReadUInt32Array();
         }
         compressedBlob = reader.ReadBytes(reader.ReadInt32());
     }
     else
     {
         m_Script = reader.ReadBytes(reader.ReadInt32());
         reader.AlignStream();
         var m_PathName = reader.ReadAlignedString();
         if (version[0] == 5 && version[1] >= 3) //5.3 - 5.4
         {
             decompressedSize = reader.ReadUInt32();
             m_SubProgramBlob = reader.ReadBytes(reader.ReadInt32());
         }
     }
 }
Example #17
0
        public Skeleton(ObjectReader reader)
        {
            int numNodes = reader.ReadInt32();

            m_Node = new List <Node>(numNodes);
            for (int i = 0; i < numNodes; i++)
            {
                m_Node.Add(new Node(reader));
            }

            int numIDs = reader.ReadInt32();

            m_ID = new List <uint>(numIDs);
            for (int i = 0; i < numIDs; i++)
            {
                m_ID.Add(reader.ReadUInt32());
            }

            int numAxes = reader.ReadInt32();

            m_AxesArray = new List <Axes>(numAxes);
            for (int i = 0; i < numAxes; i++)
            {
                m_AxesArray.Add(new Axes(reader));
            }
        }
Example #18
0
        public StreamedClip(ObjectReader reader)
        {
            int numData = reader.ReadInt32();

            data       = reader.ReadUInt32Array(numData);
            curveCount = reader.ReadUInt32();
        }
Example #19
0
        public CompressedMesh(ObjectReader reader)
        {
            var version = reader.version;

            m_Vertices = new PackedFloatVector(reader);
            m_UV       = new PackedFloatVector(reader);
            if (version[0] < 5)
            {
                m_BindPoses = new PackedFloatVector(reader);
            }
            m_Normals      = new PackedFloatVector(reader);
            m_Tangents     = new PackedFloatVector(reader);
            m_Weights      = new PackedIntVector(reader);
            m_NormalSigns  = new PackedIntVector(reader);
            m_TangentSigns = new PackedIntVector(reader);
            if (version[0] >= 5)
            {
                m_FloatColors = new PackedFloatVector(reader);
            }
            m_BoneIndices = new PackedIntVector(reader);
            m_Triangles   = new PackedIntVector(reader);
            if (version[0] > 3 || (version[0] == 3 && version[1] >= 5)) //3.5 and up
            {
                if (version[0] < 5)
                {
                    m_Colors = new PackedIntVector(reader);
                }
                else
                {
                    m_UVInfo = reader.ReadUInt32();
                }
            }
        }
Example #20
0
        public Shader(ObjectReader reader) : base(reader)
        {
            if (version[0] == 5 && version[1] >= 5 || version[0] > 5) //5.5.0 and up
            {
                var str = reader.Dump();
                m_Script = Encoding.UTF8.GetBytes(str ?? "Serialized Shader can't be read");
            }
            else
            {
                m_Script = reader.ReadBytes(reader.ReadInt32());
                if (version[0] == 5 && version[1] >= 3) //5.3 - 5.4
                {
                    reader.AlignStream(4);
                    var m_PathName        = reader.ReadAlignedString();
                    var decompressedSize  = reader.ReadUInt32();
                    var m_SubProgramBlob  = reader.ReadBytes(reader.ReadInt32());
                    var decompressedBytes = new byte[decompressedSize];
                    using (var decoder = new Lz4DecoderStream(new MemoryStream(m_SubProgramBlob)))
                    {
                        decoder.Read(decompressedBytes, 0, (int)decompressedSize);
                    }

                    m_Script = m_Script.Concat(decompressedBytes.ToArray()).ToArray();
                }
            }
        }
Example #21
0
 public BlendShapeVertex(ObjectReader reader)
 {
     vertex  = reader.ReadVector3();
     normal  = reader.ReadVector3();
     tangent = reader.ReadVector3();
     index   = reader.ReadUInt32();
 }
Example #22
0
        public AudioClip(ObjectReader reader) : base(reader)
        {
            if (version[0] < 5)
            {
                m_Format      = reader.ReadInt32();
                m_Type        = (AudioType)reader.ReadInt32();
                m_3D          = reader.ReadBoolean();
                m_UseHardware = reader.ReadBoolean();
                reader.AlignStream();

                if (version[0] >= 4 || (version[0] == 3 && version[1] >= 2)) //3.2.0 to 5
                {
                    var m_Stream = reader.ReadInt32();
                    m_Size = reader.ReadInt32();
                    var tsize = m_Size % 4 != 0 ? m_Size + 4 - m_Size % 4 : m_Size;
                    if (reader.byteSize + reader.byteStart - reader.Position != tsize)
                    {
                        m_Offset = reader.ReadUInt32();
                        m_Source = assetsFile.fullName + ".resS";
                    }
                }
                else
                {
                    m_Size = reader.ReadInt32();
                }
            }
            else
            {
                m_LoadType        = reader.ReadInt32();
                m_Channels        = reader.ReadInt32();
                m_Frequency       = reader.ReadInt32();
                m_BitsPerSample   = reader.ReadInt32();
                m_Length          = reader.ReadSingle();
                m_IsTrackerFormat = reader.ReadBoolean();
                reader.AlignStream();
                m_SubsoundIndex    = reader.ReadInt32();
                m_PreloadAudioData = reader.ReadBoolean();
                m_LoadInBackground = reader.ReadBoolean();
                m_Legacy3D         = reader.ReadBoolean();
                reader.AlignStream();

                //StreamedResource m_Resource
                m_Source            = reader.ReadAlignedString();
                m_Offset            = reader.ReadUInt64();
                m_Size              = reader.ReadInt64();
                m_CompressionFormat = (AudioCompressionFormat)reader.ReadInt32();
            }

            ResourceReader resourceReader;

            if (!string.IsNullOrEmpty(m_Source))
            {
                resourceReader = new ResourceReader(m_Source, assetsFile, m_Offset, (int)m_Size);
            }
            else
            {
                resourceReader = new ResourceReader(reader, reader.BaseStream.Position, (int)m_Size);
            }
            m_AudioData = resourceReader;
        }
Example #23
0
 public MonoScript(ObjectReader reader) : base(reader)
 {
     if (version[0] > 3 || (version[0] == 3 && version[1] >= 4)) //3.4 and up
     {
         var m_ExecutionOrder = reader.ReadInt32();
     }
     if (version[0] < 5) //5.0 down
     {
         var m_PropertiesHash = reader.ReadUInt32();
     }
     else
     {
         var m_PropertiesHash = reader.ReadBytes(16);
     }
     if (version[0] < 3) //3.0 down
     {
         var m_PathName = reader.ReadAlignedString();
     }
     m_ClassName = reader.ReadAlignedString();
     if (version[0] >= 3) //3.0 and up
     {
         m_Namespace = reader.ReadAlignedString();
     }
     m_AssemblyName = reader.ReadAlignedString();
     if (version[0] < 2018 || (version[0] == 2018 && version[1] < 2)) //2018.2 down
     {
         var m_IsEditorScript = reader.ReadBoolean();
     }
 }
Example #24
0
        public SerializedPass(ObjectReader reader)
        {
            var version = reader.version;

            int numIndices = reader.ReadInt32();

            m_NameIndices = new KeyValuePair <string, int> [numIndices];
            for (int i = 0; i < numIndices; i++)
            {
                m_NameIndices[i] = new KeyValuePair <string, int>(reader.ReadAlignedString(), reader.ReadInt32());
            }

            m_Type                 = (PassType)reader.ReadInt32();
            m_State                = new SerializedShaderState(reader);
            m_ProgramMask          = reader.ReadUInt32();
            progVertex             = new SerializedProgram(reader);
            progFragment           = new SerializedProgram(reader);
            progGeometry           = new SerializedProgram(reader);
            progHull               = new SerializedProgram(reader);
            progDomain             = new SerializedProgram(reader);
            m_HasInstancingVariant = reader.ReadBoolean();
            if (version[0] >= 2018) //2018 and up
            {
                var m_HasProceduralInstancingVariant = reader.ReadBoolean();
            }
            reader.AlignStream();
            m_UseName     = reader.ReadAlignedString();
            m_Name        = reader.ReadAlignedString();
            m_TextureName = reader.ReadAlignedString();
            m_Tags        = new SerializedTagMap(reader);
        }
Example #25
0
        public BlendTreeNodeConstant(ObjectReader reader)
        {
            var version = reader.version;

            if (version[0] > 4 || (version[0] == 4 && version[1] >= 1)) //4.1 and up
            {
                m_BlendType = reader.ReadUInt32();
            }
            m_BlendEventID = reader.ReadUInt32();
            if (version[0] > 4 || (version[0] == 4 && version[1] >= 1)) //4.1 and up
            {
                m_BlendEventYID = reader.ReadUInt32();
            }
            m_ChildIndices = reader.ReadUInt32Array();
            if (version[0] < 4 || (version[0] == 4 && version[1] < 1)) //4.1 down
            {
                m_ChildThresholdArray = reader.ReadSingleArray();
            }

            if (version[0] > 4 || (version[0] == 4 && version[1] >= 1)) //4.1 and up
            {
                m_Blend1dData = new Blend1dDataConstant(reader);
                m_Blend2dData = new Blend2dDataConstant(reader);
            }

            if (version[0] >= 5) //5.0 and up
            {
                m_BlendDirectData = new BlendDirectDataConstant(reader);
            }

            m_ClipID = reader.ReadUInt32();
            if (version[0] == 4 && version[1] >= 5) //4.5 - 5.0
            {
                m_ClipIndex = reader.ReadUInt32();
            }

            m_Duration = reader.ReadSingle();

            if (version[0] > 4 ||
                (version[0] == 4 && version[1] > 1) ||
                (version[0] == 4 && version[1] == 1 && version[2] >= 3))    //4.1.3 and up
            {
                m_CycleOffset = reader.ReadSingle();
                m_Mirror      = reader.ReadBoolean();
                reader.AlignStream();
            }
        }
Example #26
0
        public Shader(ObjectReader reader) : base(reader)
        {
            if (version[0] == 5 && version[1] >= 5 || version[0] > 5) //5.5 and up
            {
                m_ParsedForm = new SerializedShader(reader);
                int numPlatforms = reader.ReadInt32();
                platforms = new List <uint>(numPlatforms);
                for (int i = 0; i < numPlatforms; i++)
                {
                    platforms.Add(reader.ReadUInt32());
                }

                int numOffsets = reader.ReadInt32();
                offsets = new List <uint>(numOffsets);
                for (int i = 0; i < numOffsets; i++)
                {
                    offsets.Add(reader.ReadUInt32());
                }

                int numCompressedLengths = reader.ReadInt32();
                compressedLengths = new List <uint>(numCompressedLengths);
                for (int i = 0; i < numCompressedLengths; i++)
                {
                    compressedLengths.Add(reader.ReadUInt32());
                }

                int numDecompressedLengths = reader.ReadInt32();
                decompressedLengths = new List <uint>(numDecompressedLengths);
                for (int i = 0; i < numDecompressedLengths; i++)
                {
                    decompressedLengths.Add(reader.ReadUInt32());
                }

                compressedBlob = reader.ReadBytes(reader.ReadInt32());
            }
            else
            {
                m_Script = reader.ReadBytes(reader.ReadInt32());
                reader.AlignStream(4);
                var m_PathName = reader.ReadAlignedString();
                if (version[0] == 5 && version[1] >= 3) //5.3 - 5.4
                {
                    decompressedSize = reader.ReadUInt32();
                    m_SubProgramBlob = reader.ReadBytes(reader.ReadInt32());
                }
            }
        }
Example #27
0
 public DenseClip(ObjectReader reader)
 {
     m_FrameCount  = reader.ReadInt32();
     m_CurveCount  = reader.ReadUInt32();
     m_SampleRate  = reader.ReadSingle();
     m_BeginTime   = reader.ReadSingle();
     m_SampleArray = reader.ReadSingleArray();
 }
        public TransitionConstant(ObjectReader reader)
        {
            var version = reader.version;

            int numConditions = reader.ReadInt32();

            m_ConditionConstantArray = new ConditionConstant[numConditions];
            for (int i = 0; i < numConditions; i++)
            {
                m_ConditionConstantArray[i] = new ConditionConstant(reader);
            }

            m_DestinationState = reader.ReadUInt32();
            if (version[0] >= 5) //5.0 and up
            {
                m_FullPathID = reader.ReadUInt32();
            }

            m_ID                 = reader.ReadUInt32();
            m_UserID             = reader.ReadUInt32();
            m_TransitionDuration = reader.ReadSingle();
            m_TransitionOffset   = reader.ReadSingle();
            if (version[0] >= 5) //5.0 and up
            {
                m_ExitTime         = reader.ReadSingle();
                m_HasExitTime      = reader.ReadBoolean();
                m_HasFixedDuration = reader.ReadBoolean();
                reader.AlignStream();
                m_InterruptionSource  = reader.ReadInt32();
                m_OrderedInterruption = reader.ReadBoolean();
            }
            else
            {
                m_Atomic = reader.ReadBoolean();
            }

            if (version[0] > 4 || (version[0] == 4 && version[1] >= 5)) //4.5 and up
            {
                m_CanTransitionToSelf = reader.ReadBoolean();
            }

            reader.AlignStream();
        }
Example #29
0
        public StreamInfo(ObjectReader reader)
        {
            var version = reader.version;

            channelMask = reader.ReadUInt32();
            offset      = reader.ReadUInt32();

            if (version[0] < 4)
            {
                stride = reader.ReadUInt32();
                align  = reader.ReadUInt32();
            }
            else
            {
                stride    = reader.ReadByte();
                dividerOp = reader.ReadByte();
                frequency = reader.ReadUInt16();
            }
        }
Example #30
0
        public PackedQuatVector(ObjectReader reader)
        {
            m_NumItems = reader.ReadUInt32();

            int numData = reader.ReadInt32();

            m_Data = reader.ReadBytes(numData);

            reader.AlignStream(4);
        }