当前位置: 首页>>代码示例>>C#>>正文


C# BinaryReader.ReadBoundingBox方法代码示例

本文整理汇总了C#中System.IO.BinaryReader.ReadBoundingBox方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryReader.ReadBoundingBox方法的具体用法?C# BinaryReader.ReadBoundingBox怎么用?C# BinaryReader.ReadBoundingBox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.IO.BinaryReader的用法示例。


在下文中一共展示了BinaryReader.ReadBoundingBox方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Process

        public static ExtractedM2 Process(string basePath, MapId mapId, string path)
        {
            basePath = Path.Combine(basePath, mapId.ToString());
            var filePath = Path.Combine(basePath, path);
            filePath = Path.ChangeExtension(filePath, ".m2x");

            if (!File.Exists(filePath))
            {
                throw new FileNotFoundException("Extracted M2 file not found: {0}", filePath);
            }

            var m2 = new ExtractedM2();

            using(var file = File.OpenRead(filePath))
            using(var br = new BinaryReader(file))
            {
                var type = br.ReadString();
                if (type != fileType)
                {
                    br.Close();
                    throw new InvalidDataException(string.Format("M2x file in invalid format: {0}", filePath));
                }

                m2.Extents = br.ReadBoundingBox();
                m2.BoundingVertices = br.ReadVector3List();
                m2.BoundingTriangles = br.ReadIndex3List();

                br.Close();
            }

            return m2;
        }
开发者ID:WCell,项目名称:WCell-Terrain,代码行数:32,代码来源:ExtractedM2Parser.cs

示例2: Process

        public static ExtractedWMO Process(string basePath, MapId mapId, string path)
        {
            basePath = Path.Combine(basePath, mapId.ToString());
            var filePath = Path.Combine(basePath, path);
            filePath = Path.ChangeExtension(filePath, ".wmo");

            if (!File.Exists(filePath))
            {
                throw new FileNotFoundException("Extracted M2 file not found: {0}", filePath);
            }

            var wmo = new ExtractedWMO();

            using (var file = File.OpenRead(filePath))
            using (var br = new BinaryReader(file))
            {
                var type = br.ReadString();
                if (type != fileType)
                {
                    br.Close();
                    throw new InvalidDataException(string.Format("WMO file in invalid format: {0}", filePath));
                }

                wmo.Extents = br.ReadBoundingBox();
                wmo.WMOId = br.ReadUInt32();

                ReadWMODoodadDefs(br, wmo);

                ReadWMOGroups(br, wmo);
            }
            return wmo;
        }
开发者ID:WCell,项目名称:WCell-Terrain,代码行数:32,代码来源:ExtractedWMOParser.cs

示例3: ReadHeader

        static void ReadHeader(BinaryReader br, M2Model model)
        {
            var header = model.Header = new ModelHeader();

            header.Magic = br.ReadUInt32();
            header.Version = br.ReadUInt32();
            header.NameLength = br.ReadInt32();
            header.NameOffset = br.ReadInt32();
            header.GlobalModelFlags = (GlobalModelFlags) br.ReadUInt32();

            br.ReadOffsetLocation(ref header.GlobalSequences);
            br.ReadOffsetLocation(ref header.Animations);
            br.ReadOffsetLocation(ref header.AnimationLookup);
            br.ReadOffsetLocation(ref header.Bones);
            br.ReadOffsetLocation(ref header.KeyBoneLookup);
            br.ReadOffsetLocation(ref header.Vertices);
            header.ViewCount = br.ReadUInt32();
            br.ReadOffsetLocation(ref header.Colors);
            br.ReadOffsetLocation(ref header.Textures);
            br.ReadOffsetLocation(ref header.Transparency);
            br.ReadOffsetLocation(ref header.UVAnimation);
            br.ReadOffsetLocation(ref header.TexReplace);
            br.ReadOffsetLocation(ref header.RenderFlags);
            br.ReadOffsetLocation(ref header.BoneLookupTable);
            br.ReadOffsetLocation(ref header.TexLookup);
            br.ReadOffsetLocation(ref header.TexUnits);
            br.ReadOffsetLocation(ref header.TransLookup);
            br.ReadOffsetLocation(ref header.UVAnimLookup);

            header.VertexBox = br.ReadBoundingBox();
            header.VertexRadius = br.ReadSingle();
            header.BoundingBox = br.ReadBoundingBox();
            header.BoundingRadius = br.ReadSingle();

            br.ReadOffsetLocation(ref header.BoundingTriangles);
            br.ReadOffsetLocation(ref header.BoundingVertices);
            br.ReadOffsetLocation(ref header.BoundingNormals);
            br.ReadOffsetLocation(ref header.Attachments);
            br.ReadOffsetLocation(ref header.AttachLookup);
            br.ReadOffsetLocation(ref header.Events);
            br.ReadOffsetLocation(ref header.Lights);
            br.ReadOffsetLocation(ref header.Cameras);
            br.ReadOffsetLocation(ref header.CameraLookup);
            br.ReadOffsetLocation(ref header.RibbonEmitters);
            br.ReadOffsetLocation(ref header.ParticleEmitters);

            if (header.HasUnknownFinalPart)
            {
                br.ReadOffsetLocation(ref header.OptionalUnk);
            }


            br.BaseStream.Position = model.Header.NameOffset;
            //model.Name = Encoding.UTF8.GetString(br.ReadBytes(model.Header.NameLength));
            model.Name = br.ReadCString();
        }
开发者ID:remixod,项目名称:netServer,代码行数:56,代码来源:M2Reader.cs

示例4: ReadBuildingGroup

		public static WMOSubGroup ReadBuildingGroup(BinaryReader reader)
		{
			var group = new WMOSubGroup
			{
				Bounds = reader.ReadBoundingBox()
			};

			Vector3[] vertices;
			var numVerts = reader.ReadUInt16();
			if (numVerts > 0)
			{
				vertices = new Vector3[numVerts];
				for (var i = 0; i < numVerts; i++)
				{
					vertices[i] = reader.ReadVector3();
				}
			}
			else
			{
				vertices = null;
			}
			group.Vertices = vertices;

			group.Tree = ReadBSPTree(reader);
			return group;
		}
开发者ID:ray2006,项目名称:WCell,代码行数:26,代码来源:ObjectFileReader.cs

示例5: ReadBuilding

		public static WMO ReadBuilding(BinaryReader reader)
		{
			var building = new WMO
			{
				Bounds = reader.ReadBoundingBox(),
				RotationModelY = reader.ReadSingle(),
				WorldPos = reader.ReadVector3()
			};

			WMOSubGroup[] groups;
			var numGroups = reader.ReadUInt16();
			if (numGroups > 0)
			{
				groups = new WMOSubGroup[numGroups];
				for (var i = 0; i < numGroups; i++)
				{
					groups[i] = ReadBuildingGroup(reader);
				}
			}
			else
			{
				groups = null;
			}
			building.BuildingGroups = groups;

			return building;
		}
开发者ID:ray2006,项目名称:WCell,代码行数:27,代码来源:ObjectFileReader.cs

示例6: ReadMODF

        static void ReadMODF(BinaryReader fileReader, WDT wdt)
        {
            var type = fileReader.ReadUInt32();
            var size = fileReader.ReadUInt32();

            var endPos = fileReader.BaseStream.Position + size;
            while (fileReader.BaseStream.Position < endPos)
            {
                var objectDef = new MapObjectDefinition();
                var nameIndex = fileReader.ReadInt32(); // 4 bytes
                objectDef.FilePath = wdt.WmoFiles[nameIndex];
                objectDef.UniqueId = fileReader.ReadUInt32(); // 4 bytes
                objectDef.Position = fileReader.ReadVector3(); // 12 bytes
                objectDef.OrientationA = fileReader.ReadSingle(); // 4 Bytes
                objectDef.OrientationB = fileReader.ReadSingle(); // 4 Bytes
                objectDef.OrientationC = fileReader.ReadSingle(); // 4 Bytes
                objectDef.Extents = fileReader.ReadBoundingBox(); // 12*2 bytes
                objectDef.Flags = fileReader.ReadUInt16(); // 2 bytes
                objectDef.DoodadSetId = fileReader.ReadUInt16(); // 2 bytes
                objectDef.NameSet = fileReader.ReadUInt16(); // 2 bytes
                fileReader.ReadUInt16(); // padding

                wdt.WmoDefinitions.Add(objectDef);
            }
        }
开发者ID:KroneckerX,项目名称:WCell,代码行数:25,代码来源:WDTReader.cs

示例7: ReadWMODoodadDefs

 private static void ReadWMODoodadDefs(BinaryReader br, ExtractedWMO wmo)
 {
     var numSets = br.ReadInt32();
     var setList = new List<Dictionary<int, ExtractedWMOM2Definition>>(numSets);
     for (var i = 0; i < numSets; i++)
     {
         var numDefs = br.ReadInt32();
         var defDict = new Dictionary<int, ExtractedWMOM2Definition>(numDefs);
         for (var j = 0; j < numDefs; j++)
         {
             var key = br.ReadInt32();
             var def = new ExtractedWMOM2Definition {
                                                        FilePath = br.ReadString(),
                                                        Position = br.ReadVector3(),
                                                        Extents = br.ReadBoundingBox(),
                                                        WMOToModel = br.ReadMatrix(),
                                                        ModeltoWMO = br.ReadMatrix()
                                                    };
             defDict.Add(key, def);
         }
         setList.Add(defDict);
     }
     wmo.WMOM2Defs = setList;
 }
开发者ID:WCell,项目名称:WCell-Terrain,代码行数:24,代码来源:ExtractedWMOParser.cs

示例8: ReadModels

        private static void ReadModels(BinaryReader br, TreeReference<Model> tree)
        {
            var numModels = br.ReadInt32();
            for (var i = 0; i < numModels; i++)
            {
                var bounds = br.ReadBoundingBox();
                
                Vector3[] vertices;
                var numVertices = br.ReadInt32();
                if (numVertices > 0)
                {
                    vertices = new Vector3[numVertices];
                    for (var j = 0; j < numVertices; j++)
                    {
                        vertices[j] = br.ReadVector3();
                    }
                }
                else
                {
                    vertices = null;
                }

                Index3[] indices;
                var numIndices = br.ReadInt32();
                if (numIndices > 0)
                {
                    indices = new Index3[numIndices];
                    for (var j = 0; j < numIndices; j++)
                    {
                        indices[j] = br.ReadIndex3();
                    }
                }
                else
                {
                    indices = null;
                }

                var model = new Model
                {
                    Bounds = bounds,
                    Vertices = vertices,
                    Triangles = indices
                };

                tree.Tree.Insert(model);
            }
        }
开发者ID:pallmall,项目名称:WCell,代码行数:47,代码来源:WorldModels.cs

示例9: ReadWMOGroups

        private static void ReadWMOGroups(BinaryReader br, ExtractedWMO wmo)
        {
            var groupCount = br.ReadInt32();
            var groupList = new List<ExtractedWMOGroup>(groupCount);
            for (int i = 0; i < groupCount; i++)
            {
                var group = new ExtractedWMOGroup();
                group.Flags = (WMOGroupFlags) br.ReadUInt32();
                group.Bounds = br.ReadBoundingBox();
                group.GroupId = br.ReadUInt32();
                group.ModelRefs = br.ReadInt32List();

                group.HasLiquid = br.ReadBoolean();
                if (group.HasLiquid)
                {
                    ReadWMOGroupLiquidInfo(br, group);
                }
                group.WmoVertices = br.ReadVector3List();

                ReadBSPTree(br, group);

                groupList.Add(group);
            }
            wmo.Groups = groupList;
        }
开发者ID:WCell,项目名称:WCell-Terrain,代码行数:25,代码来源:ExtractedWMOParser.cs

示例10: ReadBuildingGroup

        private static BuildingGroup ReadBuildingGroup(BinaryReader br)
        {
            var group = new BuildingGroup {
                Bounds = br.ReadBoundingBox()
            };

            Vector3[] vertices;
            var numVerts = br.ReadInt32();
            if (numVerts > 0)
            {
                vertices = new Vector3[numVerts];
                for (var j = 0; j < numVerts; j++)
                {
                    vertices[j] = br.ReadVector3();
                }
            }
            else
            {
                vertices = null;
            }
            group.Vertices = vertices;
            group.Tree = ReadBSPTree(br);

            return group;
        }
开发者ID:WCellFR,项目名称:WCellFR,代码行数:25,代码来源:WorldMapObjects.cs

示例11: ReadBuildings

        private static void ReadBuildings(BinaryReader br, TreeReference<Building> tree)
        {
            var numBuildings = br.ReadInt32();
            for (var i = 0; i < numBuildings; i++)
            {
                var bounds = br.ReadBoundingBox();
                var invRot = br.ReadSingle();
                var matrix = Matrix.CreateRotationY(((-1.0f*(invRot - 90)))*RadiansPerDegree);
                var center = br.ReadVector3();

                BuildingGroup[] groups;
                var numGroups = br.ReadInt32();
                if (numGroups > 0)
                {
                    groups = new BuildingGroup[numGroups];
                    for (var j = 0; j < numGroups; j++)
                    {
                        groups[j] = ReadBuildingGroup(br);
                    }
                }
                else
                {
                    groups = null;
                }

                var building = new Building {
                    Bounds = bounds,
                    Center = center,
                    InverseRotation = matrix,
                    BuildingGroups = groups
                };

                tree.Tree.Insert(building);
            }
        }
开发者ID:WCellFR,项目名称:WCellFR,代码行数:35,代码来源:WorldMapObjects.cs

示例12: ReadMOGI

        static void ReadMOGI(BinaryReader br, WMORoot wmo)
        {
            wmo.GroupInformation = new GroupInformation[wmo.Header.GroupCount];

            for (int i = 0; i < wmo.GroupInformation.Length; i++)
            {
                var g = new GroupInformation
                {
                    Flags = (WMOGroupFlags)br.ReadUInt32(),
                    BoundingBox = br.ReadBoundingBox(),
                    NameIndex = br.ReadInt32()
                };

                wmo.GroupInformation[i] = g;
            }
        }
开发者ID:pallmall,项目名称:WCell,代码行数:16,代码来源:WMORootParser.cs

示例13: ReadWMODefs

 private static void ReadWMODefs(BinaryReader br, ExtractedADT adt)
 {
     var count = br.ReadInt32();
     var wmoDefList = new List<ExtractedWMODefinition>(count);
     for (var i = 0; i < count; i++)
     {
         var def = new ExtractedWMODefinition {
                                                  UniqueId = br.ReadUInt32(),
                                                  FilePath = br.ReadString(),
                                                  Extents = br.ReadBoundingBox(),
                                                  Position = br.ReadVector3(),
                                                  DoodadSetId = br.ReadUInt16(),
                                                  WorldToWMO = br.ReadMatrix(),
                                                  WMOToWorld = br.ReadMatrix()
                                              };
         wmoDefList.Add(def);
     }
     adt.WMODefs = wmoDefList;
 }
开发者ID:WCell,项目名称:WCell-Terrain,代码行数:19,代码来源:ExtractedADTParser.cs

示例14: ReadMapM2Defs

 private static void ReadMapM2Defs(BinaryReader br, ExtractedADT adt)
 {
     var count = br.ReadInt32();
     var m2DefList = new List<ExtractedMapM2Definition>(count);
     for (var i = 0; i < count; i++)
     {
         var def = new ExtractedMapM2Definition {
                                                    UniqueId = br.ReadUInt32(),
                                                    FilePath = br.ReadString(),
                                                    Extents = br.ReadBoundingBox(),
                                                    Position = br.ReadVector3(),
                                                    WorldToModel = br.ReadMatrix(),
                                                    ModelToWorld = br.ReadMatrix()
                                                };
         m2DefList.Add(def);
     }
     adt.M2Defs = m2DefList;
 }
开发者ID:WCell,项目名称:WCell-Terrain,代码行数:18,代码来源:ExtractedADTParser.cs


注:本文中的System.IO.BinaryReader.ReadBoundingBox方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。