Exemplo n.º 1
0
 public Limit(ObjectReader reader)
 {
     var version = reader.version;
     if (version[0] > 5 || (version[0] == 5 && version[1] >= 4))//5.4 and up
     {
         m_Min = reader.ReadVector3();
         m_Max = reader.ReadVector3();
     }
     else
     {
         m_Min = reader.ReadVector4();
         m_Max = reader.ReadVector4();
     }
 }
Exemplo n.º 2
0
        public HumanPose(ObjectReader reader)
        {
            var version = reader.version;

            m_RootX          = new xform(reader);
            m_LookAtPosition = version[0] > 5 || (version[0] == 5 && version[1] >= 4) ? (object)reader.ReadVector3() : (object)reader.ReadVector4();//5.4 and up
            m_LookAtWeight   = reader.ReadVector4();

            int numGoals = reader.ReadInt32();

            m_GoalArray = new List <HumanGoal>(numGoals);
            for (int i = 0; i < numGoals; i++)
            {
                m_GoalArray.Add(new HumanGoal(reader));
            }

            m_LeftHandPose  = new HandPose(reader);
            m_RightHandPose = new HandPose(reader);

            int numDoFs = reader.ReadInt32();

            m_DoFArray = reader.ReadSingleArray(numDoFs);

            if (version[0] > 5 || (version[0] == 5 && version[1] >= 2))//5.2 and up
            {
                int numTDof = reader.ReadInt32();
                m_TDoFArray = new object[numTDof];
                for (int i = 0; i < numTDof; i++)
                {
                    m_TDoFArray[i] = version[0] > 5 || (version[0] == 5 && version[1] >= 4) ? (object)reader.ReadVector3() : (object)reader.ReadVector4();//5.4 and up
                }
            }
        }
Exemplo n.º 3
0
        public HumanPose(ObjectReader reader)
        {
            var version = reader.version;

            m_RootX          = new xform(reader);
            m_LookAtPosition = version[0] > 5 || (version[0] == 5 && version[1] >= 4) ? reader.ReadVector3() : (Vector3)reader.ReadVector4();//5.4 and up
            m_LookAtWeight   = reader.ReadVector4();

            var numGoals = reader.ReadInt32();

            m_GoalArray = new HumanGoal[numGoals];
            for (var i = 0; i < numGoals; i++)
            {
                m_GoalArray[i] = new HumanGoal(reader);
            }

            m_LeftHandPose  = new HandPose(reader);
            m_RightHandPose = new HandPose(reader);

            m_DoFArray = reader.ReadSingleArray();

            if (version[0] > 5 || (version[0] == 5 && version[1] >= 2))//5.2 and up
            {
                var numTDof = reader.ReadInt32();
                m_TDoFArray = new Vector3[numTDof];
                for (var i = 0; i < numTDof; i++)
                {
                    m_TDoFArray[i] = version[0] > 5 || (version[0] == 5 && version[1] >= 4) ? reader.ReadVector3() : (Vector3)reader.ReadVector4();//5.4 and up
                }
            }
        }
Exemplo n.º 4
0
        public SpriteAtlasData(ObjectReader reader)
        {
            var version = reader.version;

            texture           = new PPtr <Texture2D>(reader);
            alphaTexture      = new PPtr <Texture2D>(reader);
            textureRect       = new Rectf(reader);
            textureRectOffset = reader.ReadVector2();
            if (version[0] > 2017 || (version[0] == 2017 && version[1] >= 2)) //2017.2 and up
            {
                atlasRectOffset = reader.ReadVector2();
            }
            uvTransform         = reader.ReadVector4();
            downscaleMultiplier = reader.ReadSingle();
            settingsRaw         = new SpriteSettings(reader);
            if (version[0] > 2020 || (version[0] == 2020 && version[1] >= 2)) //2020.2 and up
            {
                var secondaryTexturesSize = reader.ReadInt32();
                secondaryTextures = new SecondarySpriteTexture[secondaryTexturesSize];
                for (int i = 0; i < secondaryTexturesSize; i++)
                {
                    secondaryTextures[i] = new SecondarySpriteTexture(reader);
                }
                reader.AlignStream();
            }
        }
Exemplo n.º 5
0
 public Axes(ObjectReader reader)
 {
     var version = reader.version;
     m_PreQ = reader.ReadVector4();
     m_PostQ = reader.ReadVector4();
     if (version[0] > 5 || (version[0] == 5 && version[1] >= 4)) //5.4 and up
     {
         m_Sgn = reader.ReadVector3();
     }
     else
     {
         m_Sgn = reader.ReadVector4();
     }
     m_Limit = new Limit(reader);
     m_Length = reader.ReadSingle();
     m_Type = reader.ReadUInt32();
 }
Exemplo n.º 6
0
        public Sprite(ObjectReader reader) : base(reader)
        {
            m_Rect   = reader.ReadRectangleF();
            m_Offset = reader.ReadVector2();
            if (version[0] > 4 || (version[0] == 4 && version[1] >= 5)) //4.5 and up
            {
                m_Border = reader.ReadVector4();
            }

            m_PixelsToUnits = reader.ReadSingle();
            if (version[0] > 5 ||
                (version[0] == 5 && version[1] > 4) ||
                (version[0] == 5 && version[1] == 4 && version[2] >= 2))    //5.4.2 and up
            {
                m_Pivot = reader.ReadVector2();
            }

            m_Extrude = reader.ReadUInt32();
            if (version[0] > 5 || (version[0] == 5 && version[1] >= 3)) //5.3 and up
            {
                m_IsPolygon = reader.ReadBoolean();
                reader.AlignStream(4);
            }

            if (version[0] >= 2017) //2017 and up
            {
                var first  = new Guid(reader.ReadBytes(16));
                var second = reader.ReadInt64();
                m_RenderDataKey = new KeyValuePair <Guid, long>(first, second);

                var m_AtlasTagsSize = reader.ReadInt32();
                m_AtlasTags = new string[m_AtlasTagsSize];
                for (int i = 0; i < m_AtlasTagsSize; i++)
                {
                    m_AtlasTags[i] = reader.ReadAlignedString();
                }

                m_SpriteAtlas = new PPtr <SpriteAtlas>(reader);
            }

            m_RD = new SpriteRenderData(reader);

            if (version[0] >= 2017) //2017 and up
            {
                var m_PhysicsShapeSize = reader.ReadInt32();
                m_PhysicsShape = new Vector2[m_PhysicsShapeSize][];
                for (int i = 0; i < m_PhysicsShapeSize; i++)
                {
                    m_PhysicsShape[i] = reader.ReadVector2Array(reader.ReadInt32());
                }
            }

            //vector m_Bones 2018 and up
        }
Exemplo n.º 7
0
        public SpriteAtlasData(ObjectReader reader)
        {
            var version = reader.version;

            texture           = new PPtr <Texture2D>(reader);
            alphaTexture      = new PPtr <Texture2D>(reader);
            textureRect       = reader.ReadRectangleF();
            textureRectOffset = reader.ReadVector2();
            if (version[0] > 2017 || (version[0] == 2017 && version[1] >= 2)) //2017.2 and up
            {
                atlasRectOffset = reader.ReadVector2();
            }
            uvTransform         = reader.ReadVector4();
            downscaleMultiplier = reader.ReadSingle();
            settingsRaw         = new SpriteSettings(reader);
        }
Exemplo n.º 8
0
        public ValueArray(ObjectReader reader)
        {
            var version = reader.version;

            if (version[0] < 5 || (version[0] == 5 && version[1] < 5)) //5.5 down
            {
                m_BoolValues = reader.ReadBooleanArray();
                reader.AlignStream();
                m_IntValues   = reader.ReadInt32Array();
                m_FloatValues = reader.ReadSingleArray();
            }

            if (version[0] < 4 || (version[0] == 4 && version[1] < 3)) //4.3 down
            {
                m_VectorValues = reader.ReadVector4Array();
            }
            else
            {
                int numPosValues = reader.ReadInt32();
                m_PositionValues = new Vector3[numPosValues];
                for (int i = 0; i < numPosValues; i++)
                {
                    m_PositionValues[i] = version[0] > 5 || (version[0] == 5 && version[1] >= 4) ? reader.ReadVector3() : (Vector3)reader.ReadVector4(); //5.4 and up
                }

                m_QuaternionValues = reader.ReadVector4Array();

                int numScaleValues = reader.ReadInt32();
                m_ScaleValues = new Vector3[numScaleValues];
                for (int i = 0; i < numScaleValues; i++)
                {
                    m_ScaleValues[i] = version[0] > 5 || (version[0] == 5 && version[1] >= 4) ? reader.ReadVector3() : (Vector3)reader.ReadVector4(); //5.4 and up
                }

                if (version[0] > 5 || (version[0] == 5 && version[1] >= 5)) //5.5 and up
                {
                    m_FloatValues = reader.ReadSingleArray();
                    m_IntValues   = reader.ReadInt32Array();
                    m_BoolValues  = reader.ReadBooleanArray();
                    reader.AlignStream();
                }
            }
        }
Exemplo n.º 9
0
        public SpriteRenderData(ObjectReader reader)
        {
            var version = reader.version;

            texture = new PPtr <Texture2D>(reader);
            if (version[0] > 5 || (version[0] == 5 && version[1] >= 2)) //5.2 and up
            {
                alphaTexture = new PPtr <Texture2D>(reader);
            }

            if (version[0] > 5 || (version[0] == 5 && version[1] >= 6)) //5.6 and up
            {
                var m_SubMeshesSize = reader.ReadInt32();
                m_SubMeshes = new SubMesh[m_SubMeshesSize];
                for (int i = 0; i < m_SubMeshesSize; i++)
                {
                    m_SubMeshes[i] = new SubMesh(reader);
                }

                m_IndexBuffer = reader.ReadBytes(reader.ReadInt32());
                reader.AlignStream(4);

                m_VertexData = new VertexData(reader);
            }
            else
            {
                var verticesSize = reader.ReadInt32();
                vertices = new SpriteVertex[verticesSize];
                for (int i = 0; i < verticesSize; i++)
                {
                    vertices[i] = new SpriteVertex(reader);
                }

                indices = reader.ReadUInt16Array(reader.ReadInt32());
                reader.AlignStream(4);
            }

            if (version[0] >= 2018) //2018 and up
            {
                m_Bindpose = reader.ReadMatrixArray(reader.ReadInt32());

                if (version[0] == 2018 && version[1] < 2) //2018.2 down
                {
                    var m_SourceSkinSize = reader.ReadInt32();
                    for (int i = 0; i < m_SourceSkinSize; i++)
                    {
                        m_SourceSkin[i] = new BoneWeights4(reader);
                    }
                }
            }

            textureRect       = reader.ReadRectangleF();
            textureRectOffset = reader.ReadVector2();
            if (version[0] > 5 || (version[0] == 5 && version[1] >= 6)) //5.6 and up
            {
                atlasRectOffset = reader.ReadVector2();
            }

            settingsRaw = new SpriteSettings(reader);
            if (version[0] > 4 || (version[0] == 4 && version[1] >= 5)) //4.5 and up
            {
                uvTransform = reader.ReadVector4();
            }

            if (version[0] >= 2017) //2017 and up
            {
                downscaleMultiplier = reader.ReadSingle();
            }
        }
Exemplo n.º 10
0
        protected Renderer(ObjectReader reader) : base(reader)
        {
            if (version[0] < 5) //5.0 down
            {
                var m_Enabled        = reader.ReadBoolean();
                var m_CastShadows    = reader.ReadBoolean();
                var m_ReceiveShadows = reader.ReadBoolean();
                var m_LightmapIndex  = reader.ReadByte();
            }
            else //5.0 and up
            {
                if (version[0] > 5 || (version[0] == 5 && version[1] >= 4)) //5.4 and up
                {
                    var m_Enabled        = reader.ReadBoolean();
                    var m_CastShadows    = reader.ReadByte();
                    var m_ReceiveShadows = reader.ReadByte();
                    if (version[0] > 2017 || (version[0] == 2017 && version[1] >= 2)) //2017.2 and up
                    {
                        var m_DynamicOccludee = reader.ReadByte();
                    }
                    var m_MotionVectors        = reader.ReadByte();
                    var m_LightProbeUsage      = reader.ReadByte();
                    var m_ReflectionProbeUsage = reader.ReadByte();
                    if (version[0] > 2019 || (version[0] == 2019 && version[1] >= 3)) //2019.3 and up
                    {
                        var m_RayTracingMode = reader.ReadByte();
                    }
                    reader.AlignStream();
                }
                else
                {
                    var m_Enabled = reader.ReadBoolean();
                    reader.AlignStream();
                    var m_CastShadows    = reader.ReadByte();
                    var m_ReceiveShadows = reader.ReadBoolean();
                    reader.AlignStream();
                }

                if (version[0] >= 2018) //2018 and up
                {
                    var m_RenderingLayerMask = reader.ReadUInt32();
                }

                if (version[0] > 2018 || (version[0] == 2018 && version[1] >= 3)) //2018.3 and up
                {
                    var m_RendererPriority = reader.ReadInt32();
                }

                var m_LightmapIndex        = reader.ReadUInt16();
                var m_LightmapIndexDynamic = reader.ReadUInt16();
            }

            if (version[0] >= 3) //3.0 and up
            {
                var m_LightmapTilingOffset = reader.ReadVector4();
            }

            if (version[0] >= 5) //5.0 and up
            {
                var m_LightmapTilingOffsetDynamic = reader.ReadVector4();
            }

            var m_MaterialsSize = reader.ReadInt32();

            m_Materials = new PPtr <Material> [m_MaterialsSize];
            for (int i = 0; i < m_MaterialsSize; i++)
            {
                m_Materials[i] = new PPtr <Material>(reader);
            }

            if (version[0] < 3) //3.0 down
            {
                var m_LightmapTilingOffset = reader.ReadVector4();
            }
            else //3.0 and up
            {
                if (version[0] > 5 || (version[0] == 5 && version[1] >= 5)) //5.5 and up
                {
                    m_StaticBatchInfo = new StaticBatchInfo(reader);
                }
                else
                {
                    m_SubsetIndices = reader.ReadUInt32Array();
                }

                var m_StaticBatchRoot = new PPtr <Transform>(reader);
            }

            if (version[0] > 5 || (version[0] == 5 && version[1] >= 4)) //5.4 and up
            {
                var m_ProbeAnchor = new PPtr <Transform>(reader);
                var m_LightProbeVolumeOverride = new PPtr <GameObject>(reader);
            }
            else if (version[0] > 3 || (version[0] == 3 && version[1] >= 5)) //3.5 - 5.3
            {
                var m_UseLightProbes = reader.ReadBoolean();
                reader.AlignStream();

                if (version[0] >= 5)//5.0 and up
                {
                    var m_ReflectionProbeUsage = reader.ReadInt32();
                }

                var m_LightProbeAnchor = new PPtr <Transform>(reader); //5.0 and up m_ProbeAnchor
            }

            if (version[0] > 4 || (version[0] == 4 && version[1] >= 3)) //4.3 and up
            {
                if (version[0] == 4 && version[1] == 3)                 //4.3
                {
                    var m_SortingLayer = reader.ReadInt16();
                }
                else
                {
                    var m_SortingLayerID = reader.ReadUInt32();
                }

                //SInt16 m_SortingLayer 5.6 and up
                var m_SortingOrder = reader.ReadInt16();
                reader.AlignStream();
            }
        }
Exemplo n.º 11
0
        public ValueArray(ObjectReader reader)
        {
            var version = reader.version;

            if (version[0] < 5 || (version[0] == 5 && version[1] < 5)) //5.5 down
            {
                int numBools = reader.ReadInt32();
                m_BoolValues = new bool[numBools];
                for (int i = 0; i < numBools; i++)
                {
                    m_BoolValues[i] = reader.ReadBoolean();
                }

                reader.AlignStream(4);

                m_IntValues   = reader.ReadInt32Array(reader.ReadInt32());
                m_FloatValues = reader.ReadSingleArray(reader.ReadInt32());
            }

            int numPosValues = reader.ReadInt32();

            m_PositionValues = new object[numPosValues];
            for (int i = 0; i < numPosValues; i++)
            {
                m_PositionValues[i] = version[0] > 5 || (version[0] == 5 && version[1] >= 4) ? (object)reader.ReadVector3() : (object)reader.ReadVector4(); //5.4 and up
            }

            m_QuaternionValues = reader.ReadVector4Array(reader.ReadInt32());

            int numScaleValues = reader.ReadInt32();

            m_ScaleValues = new object[numScaleValues];
            for (int i = 0; i < numScaleValues; i++)
            {
                m_ScaleValues[i] = version[0] > 5 || (version[0] == 5 && version[1] >= 4) ? (object)reader.ReadVector3() : (object)reader.ReadVector4(); //5.4 adn up
            }

            if (version[0] > 5 || (version[0] == 5 && version[1] >= 5)) //5.5 and up
            {
                m_FloatValues = reader.ReadSingleArray(reader.ReadInt32());
                m_IntValues   = reader.ReadInt32Array(reader.ReadInt32());

                int numBools = reader.ReadInt32();
                m_BoolValues = new bool[numBools];
                for (int i = 0; i < numBools; i++)
                {
                    m_BoolValues[i] = reader.ReadBoolean();
                }

                reader.AlignStream(4);
            }
        }
Exemplo n.º 12
0
        public ClipMuscleConstant(ObjectReader reader)
        {
            var version = reader.version;

            m_DeltaPose = new HumanPose(reader);
            m_StartX    = new xform(reader);
            if (version[0] > 5 || (version[0] == 5 && version[1] >= 5))//5.5 and up
            {
                m_StopX = new xform(reader);
            }
            m_LeftFootStartX  = new xform(reader);
            m_RightFootStartX = new xform(reader);
            if (version[0] < 5)//5.0 down
            {
                m_MotionStartX = new xform(reader);
                m_MotionStopX  = new xform(reader);
            }
            m_AverageSpeed        = version[0] > 5 || (version[0] == 5 && version[1] >= 4) ? (object)reader.ReadVector3() : (object)reader.ReadVector4();//5.4 and up
            m_Clip                = new Clip(reader);
            m_StartTime           = reader.ReadSingle();
            m_StopTime            = reader.ReadSingle();
            m_OrientationOffsetY  = reader.ReadSingle();
            m_Level               = reader.ReadSingle();
            m_CycleOffset         = reader.ReadSingle();
            m_AverageAngularSpeed = reader.ReadSingle();

            int numIndices = reader.ReadInt32();

            m_IndexArray = reader.ReadInt32Array(numIndices);
            if (version[0] < 4 || (version[0] == 4 && version[1] < 3)) //4.3 down
            {
                int numAdditionalCurveIndexs    = reader.ReadInt32();
                var m_AdditionalCurveIndexArray = new List <int>(numAdditionalCurveIndexs);
                for (int i = 0; i < numAdditionalCurveIndexs; i++)
                {
                    m_AdditionalCurveIndexArray.Add(reader.ReadInt32());
                }
            }
            int numDeltas = reader.ReadInt32();

            m_ValueArrayDelta = new List <ValueDelta>(numDeltas);
            for (int i = 0; i < numDeltas; i++)
            {
                m_ValueArrayDelta.Add(new ValueDelta(reader));
            }
            if (version[0] > 5 || (version[0] == 5 && version[1] >= 3))//5.3 and up
            {
                m_ValueArrayReferencePose = reader.ReadSingleArray(reader.ReadInt32());
            }

            m_Mirror               = reader.ReadBoolean();
            m_LoopTime             = reader.ReadBoolean();
            m_LoopBlend            = reader.ReadBoolean();
            m_LoopBlendOrientation = reader.ReadBoolean();
            m_LoopBlendPositionY   = reader.ReadBoolean();
            m_LoopBlendPositionXZ  = reader.ReadBoolean();
            if (version[0] > 5 || (version[0] == 5 && version[1] >= 5))//5.5 and up
            {
                m_StartAtOrigin = reader.ReadBoolean();
            }
            m_KeepOriginalOrientation = reader.ReadBoolean();
            m_KeepOriginalPositionY   = reader.ReadBoolean();
            m_KeepOriginalPositionXZ  = reader.ReadBoolean();
            m_HeightFromFeet          = reader.ReadBoolean();
            reader.AlignStream(4);
        }
Exemplo n.º 13
0
        public HumanGoal(ObjectReader reader)
        {
            var version = reader.version;

            m_X       = new xform(reader);
            m_WeightT = reader.ReadSingle();
            m_WeightR = reader.ReadSingle();
            if (version[0] >= 5)                                                                                                                      //5.0 and up
            {
                m_HintT       = version[0] > 5 || (version[0] == 5 && version[1] >= 4) ? (object)reader.ReadVector3() : (object)reader.ReadVector4(); //5.4 and up
                m_HintWeightT = reader.ReadSingle();
            }
        }
Exemplo n.º 14
0
        public xform(ObjectReader reader)
        {
            var version = reader.version;

            t = version[0] > 5 || (version[0] == 5 && version[1] >= 4) ? (object)reader.ReadVector3() : (object)reader.ReadVector4(); //5.4 and up
            q = reader.ReadQuaternion();
            s = version[0] > 5 || (version[0] == 5 && version[1] >= 4) ? (object)reader.ReadVector3() : (object)reader.ReadVector4(); //5.4 and up
        }