示例#1
0
 public ClothSimulationFile()
 {
     Header              = new ClothSimulationHeader();
     Nodes               = new List <SimulatedNodeInfo>();
     NodeLinks           = new List <SimulatedNodeLinkInfo>();
     Ropes               = new List <ClothSimRopeInfo>();
     RopeNodes           = new List <List <uint> >();
     RopeLinks           = new List <List <uint> >();
     CollisionPrimitives = new List <ClothSimCollisionPrimitiveInfo>();
 }
示例#2
0
        public ClothSimulationFile(Stream s)
        {
            Header = s.ReadStruct <ClothSimulationHeader>();

            Nodes               = new List <SimulatedNodeInfo>();
            NodeLinks           = new List <SimulatedNodeLinkInfo>();
            Ropes               = new List <ClothSimRopeInfo>();
            RopeNodes           = new List <List <uint> >();
            RopeLinks           = new List <List <uint> >();
            CollisionPrimitives = new List <ClothSimCollisionPrimitiveInfo>();


            for (int i = 0; i < Header.NumNodes; i++)
            {
                SimulatedNodeInfo sni = s.ReadStruct <SimulatedNodeInfo>();
                Nodes.Add(sni);
            }

            for (int i = 0; i < Header.NumNodeLinks; i++)
            {
                SimulatedNodeLinkInfo snli = s.ReadStruct <SimulatedNodeLinkInfo>();
                NodeLinks.Add(snli);
            }

            for (int i = 0; i < Header.NumColliders; i++)
            {
                ClothSimCollisionPrimitiveInfo cscpi = s.ReadStruct <ClothSimCollisionPrimitiveInfo>();
                CollisionPrimitives.Add(cscpi);
            }

            s.Align(8);

            for (int i = 0; i < Header.NumRopes; i++)
            {
                ClothSimRopeInfo csri = s.ReadStruct <ClothSimRopeInfo>();
                Ropes.Add(csri);
            }

            for (int i = 0; i < Header.NumRopes; i++)
            {
                ClothSimRopeInfo csri      = Ropes[i];
                List <UInt32>    ropeNodes = new List <uint>();

                for (int j = 0; j < csri.NumNodes; j++)
                {
                    uint ropeNode = s.ReadUInt32();
                    ropeNodes.Add(ropeNode);
                }

                RopeNodes.Add(ropeNodes);

                List <UInt32> ropeLinks = new List <uint>();

                for (int j = 0; j < csri.NumLinks; j++)
                {
                    uint ropeLink = s.ReadUInt32();
                    ropeLinks.Add(ropeLink);
                }

                RopeLinks.Add(ropeLinks);
            }
        }