Esempio n. 1
0
        public void Parse()
        {
            while (Reader.BaseStream.Position < Reader.BaseStream.Length)
            {
                string sectionName   = Encoding.UTF8.GetString(Reader.ReadBytes(4));
                int    sectionLength = Reader.ReadInt32();
                byte[] sectionBytes  = Reader.ReadBytes(sectionLength);

                BinaryReader sectionReader = new BinaryReader(new MemoryStream(sectionBytes));

                switch (sectionName)
                {
                case "VERS":
                    // TODO: Implement parsing of VERS section
                    break;

                case "TEXT":
                    // TODO: Implement parsing of TEXT section
                    break;

                case "SMTL":
                    // TODO: Implement parsing of SMTL section
                    break;

                case "BONE":
                    Bones = BoneReader.ReadAllBones(sectionReader);
                    break;

                case "ANIM":
                    // TODO: Implement parsing of ANIM section
                    break;

                case "MESH":
                    Vertices = VertexReader.ReadAllVertices(sectionReader);
                    Polygons = PolygonReader.ReadAllPolygons(sectionReader);
                    break;

                case "FANM":
                    // TODO: Implement parsing of FANM section
                    break;

                case "FRAM":
                    // TODO: Implement parsing of FRAM section
                    break;

                case "MOTI":
                    Motions = MotionReader.ReadAllMotions(sectionReader);
                    break;

                case "COLL":
                    CollisionBoxes = CollisionBoxReader.ReadAllCollisionBoxes(sectionReader);
                    break;
                }

                sectionReader.Close();
            }
        }
Esempio n. 2
0
        private VertexInfo[,] GetControlPoints(int uCount,int vCount)
        {
            var controlPoints = new VertexInfo[uCount,vCount];

            var vertexPtr =
                (byte*)GpuProcessor.Memory.PspAddressToPointerSafe(
                    GpuStateStructPointer.GetAddressRelativeToBaseOffset(GpuStateStructPointer.VertexAddress));
            var vertexReader = new VertexReader();

            vertexReader.SetVertexTypeStruct(GpuStateStructPointer.VertexState.Type,vertexPtr);

            for (var u = 0; u < uCount; u++)
            {
                for (var v = 0; v < vCount; v++)
                {
                    controlPoints[u,v] = vertexReader.ReadVertex(v * uCount + u);
                    //Console.WriteLine("getControlPoints({0}, {1}) : {2}", u, v, controlPoints[u, v]);
                }
            }
            return(controlPoints);
        }
		private VertexInfo[,] GetControlPoints(int UCount, int VCount)
		{
			var ControlPoints = new VertexInfo[UCount, VCount];

			var VertexPtr = (byte*)GpuDisplayList.GpuProcessor.Memory.PspAddressToPointerSafe(GpuState->GetAddressRelativeToBaseOffset(GpuState->VertexAddress), 0);
			var VertexReader = new VertexReader();
			VertexReader.SetVertexTypeStruct(GpuState->VertexState.Type, VertexPtr);

			for (int u = 0; u < UCount; u++)
			{
				for (int v = 0; v < VCount; v++)
				{
					ControlPoints[u, v] = VertexReader.ReadVertex(v * UCount + u);
					//Console.WriteLine("getControlPoints({0}, {1}) : {2}", u, v, controlPoints[u, v]);
				}
			}
			return ControlPoints;
		}