Exemplo n.º 1
0
        private void ReadCrushDataSection()
        {
            //3 sections: unused, car model, bonnet model

            for (int i = 0; i < 3; i++)
            {
                CrushSection section = new CrushSection();
                CrushSections.Add(section);

                Debug.WriteLine("CRUSH " + i);
                section.DamageMultiplier = ReadLineAsFloat(false);
                SkipLines(5); //unk1
                int nbrData = ReadLineAsInt();

                for (int m = 0; m < nbrData; m++)
                {
                    CrushData crushData = new CrushData();
                    section.Data.Add(crushData);

                    crushData.RefVertex = ReadLineAsInt();
                    crushData.Box       = new BoundingBox(ReadLineAsVector3(false), ReadLineAsVector3(false));
                    Vector3 v = ReadLineAsVector3(false);
                    crushData.RightScale = v.X;
                    crushData.TopScale   = v.Y;
                    crushData.RearScale  = v.Z;
                    v = ReadLineAsVector3(false);
                    crushData.LeftScale   = v.X;
                    crushData.BottomScale = v.Y;
                    crushData.FrontScale  = v.Z;
                    //crushData.MinScale = ReadLineAsVector3(false);
                    //crushData.MaxScale = ReadLineAsVector3(false);

                    int nbrPoints = ReadLineAsInt();
                    int curVertex = -1; // 0;// crushData.RefVertex;

                    for (int p = 0; p < nbrPoints; p++)
                    {
                        CrushPoint point = new CrushPoint();
                        curVertex               += ReadLineAsInt();
                        point.VertexIndex        = curVertex;
                        point.DistanceFromParent = ReadLineAsFloat(false) / 255f; //values are 0-255 so convert to 0-1
                        crushData.Points.Add(point);
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void ReadCrushDataSection()
        {
            //3 sections: unused, car model, bonnet model

            for (int i = 0; i < 3; i++)
            {
                CrushSection section = new CrushSection();
                CrushSections.Add(section);

                Debug.WriteLine("CRUSH " + i);
                section.DamageMultiplier = ReadLineAsFloat(false);
                SkipLines(5); //unk1
                int nbrData = ReadLineAsInt();

                for (int m = 0; m < nbrData; m++)
                {
                    CrushData crushData = new CrushData();
                    section.Data.Add(crushData);

                    crushData.RefVertex = ReadLineAsInt();
                    crushData.Box = new BoundingBox(ReadLineAsVector3(false), ReadLineAsVector3(false));
                    Vector3 v = ReadLineAsVector3(false);
                    crushData.RightScale = v.X;
                    crushData.TopScale = v.Y;
                    crushData.RearScale = v.Z;
                    v = ReadLineAsVector3(false);
                    crushData.LeftScale = v.X;
                    crushData.BottomScale = v.Y;
                    crushData.FrontScale = v.Z;
                    //crushData.MinScale = ReadLineAsVector3(false);
                    //crushData.MaxScale = ReadLineAsVector3(false);

                    int nbrPoints = ReadLineAsInt();
                    int curVertex = -1; // 0;// crushData.RefVertex;

                    for (int p = 0; p < nbrPoints; p++)
                    {
                        CrushPoint point = new CrushPoint();
                        curVertex += ReadLineAsInt();
                        point.VertexIndex = curVertex;
                        point.DistanceFromParent = ReadLineAsFloat(false) / 255f; //values are 0-255 so convert to 0-1
                        crushData.Points.Add(point);
                    }
                }
            }
        }