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


C# BinaryReader.ReadVector3方法代码示例

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


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

示例1: Deserialize

        public static Mesh Deserialize(BinaryReader reader)
        {
            Action<bool> assert = (b) => { if (!b) throw new InvalidDataException(); };
            assert(reader.ReadString() == "MESH");
            assert(reader.ReadByte() == 1);
            assert(reader.ReadByte() == 0);
            int texture = reader.ReadInt32();
            int vertexCount = reader.ReadInt32();
            int indexCount = reader.ReadInt32();

            var vertices = new BlockVertex[vertexCount];
            for (int i = 0; i < vertexCount; i++)
            {
                var vertex = new BlockVertex();

                vertex.position = reader.ReadVector3();
                vertex.normal = reader.ReadVector3();
                vertex.color = reader.ReadVector3();
                vertex.uv = reader.ReadVector3();

                vertices[i] = vertex;
            }

            var indices = new int[indexCount];
            for (int i = 0; i < indexCount; i++)
            {
                indices[i] = reader.ReadInt32();
            }

            return new Mesh(indices, vertices, texture);
        }
开发者ID:MasterQ32,项目名称:BlocksWorld,代码行数:31,代码来源:MeshModel.IO.cs

示例2: reaParser

 public reaParser(Stream stream)
 {
     try
     {
         using (BinaryReader reader = new BinaryReader(stream))
         {
             byte[] type = reader.ReadBytes(4);
             Trace.Assert(remParser.TypeCheck(reaANICsection.ClassType, type));
             int anicLength = reader.ReadInt32();
             int unk1 = reader.ReadInt32();
             float unk2 = reader.ReadSingle();
             int count = reader.ReadInt32();
             ANIC = new reaANICsection(count);
             ANIC.unk1 = unk1;
             ANIC.unk2 = unk2;
             for (int i = 0; i < count; i++)
             {
                 reaAnimationTrack track = new reaAnimationTrack();
                 type = reader.ReadBytes(4);
                 Trace.Assert(remParser.TypeCheck(reaAnimationTrack.ClassType, type));
                 int anioLength = reader.ReadInt32();
                 byte[] name = reader.ReadBytes(256);
                 track.boneFrame = remParser.GetIdentifier(name, 0, 256);
                 int numScalings = reader.ReadInt32();
                 track.scalings = new reaIndexVector[numScalings];
                 int numRotations = reader.ReadInt32();
                 track.rotations = new reaIndexQuaternion[numRotations];
                 int numTranslations = reader.ReadInt32();
                 track.translations = new reaIndexVector[numTranslations];
                 for (int j = 0; j < numScalings; j++)
                 {
                     reaIndexVector ivec = new reaIndexVector();
                     ivec.index = reader.ReadInt32();
                     ivec.value = reader.ReadVector3();
                     track.scalings[j] = ivec;
                 }
                 for (int j = 0; j < numRotations; j++)
                 {
                     reaIndexQuaternion iq = new reaIndexQuaternion();
                     iq.index = reader.ReadInt32();
                     iq.value = reader.ReadQuaternion();
                     track.rotations[j] = iq;
                 }
                 for (int j = 0; j < numTranslations; j++)
                 {
                     reaIndexVector ivec = new reaIndexVector();
                     ivec.index = reader.ReadInt32();
                     ivec.value = reader.ReadVector3();
                     track.translations[j] = ivec;
                 }
                 ANIC.AddChild(track);
             }
         }
     }
     catch (FileNotFoundException)
     {
         Report.ReportLog("file not found");
     }
 }
开发者ID:hejob,项目名称:SB3Utility,代码行数:59,代码来源:REAParser.cs

示例3: RoRsmMeshTransMatrix

		public RoRsmMeshTransMatrix(BinaryReader bin, GenericFileFormatVersion version)
			: base(bin, version) {
			Matrix = bin.ReadMatrix();
			Position = bin.ReadVector3();
			RotationAngle = bin.ReadSingle();
			RotationAxis = bin.ReadVector3();
			Scale = bin.ReadVector3();
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:8,代码来源:RoRsmMeshTransMatrix.cs

示例4: Particle

        /// <summary>
        /// Initializes a new instance of the <see cref="Particle"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public Particle(NiFile file, BinaryReader reader)
		{
			this.Velocity = reader.ReadVector3();
			this.UnkownVector = reader.ReadVector3();
			this.Lifetime = reader.ReadSingle();
			this.Lifespan = reader.ReadSingle();
			this.Timestamp = reader.ReadSingle();
			this.UnkownShort = reader.ReadUInt16();
			this.VertexID = reader.ReadUInt16();
		}
开发者ID:dol-leodagan,项目名称:niflib.net,代码行数:15,代码来源:Particle.cs

示例5: NiGravity

        /// <summary>
        /// Initializes a new instance of the <see cref="NiGravity" /> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiGravity(NiFile file, BinaryReader reader) : base(file, reader)
		{
			if (this.File.Header.Version >= eNifVersion.VER_4_0_0_2)
			{
				this.UnkownFloat1 = reader.ReadSingle();
			}
			this.Force = reader.ReadSingle();
			this.Type = reader.ReadUInt32();
			this.Position = reader.ReadVector3();
			this.Direction = reader.ReadVector3();
		}
开发者ID:dol-leodagan,项目名称:niflib.net,代码行数:16,代码来源:NiGravity.cs

示例6: Read

 public static MDDFEntry Read(BinaryReader br)
 {
     return new MDDFEntry
     {
         MMIDEntryIndex = br.ReadUInt32(),
         UniqueId = br.ReadUInt32(),
         Position = br.ReadVector3(),
         Rotation = br.ReadVector3(),
         Scale = br.ReadUInt16(),
         Flags = (MDDFFlags)br.ReadUInt16(),
     };
 }
开发者ID:aeo24,项目名称:WoWMap,代码行数:12,代码来源:MDDF.cs

示例7: Deserialise

        public int MeshFlags; // 60 is normal, 124 is decal

        public static int Deserialise(BinaryReader reader, GameObject parent)
        {
            GameObject go = new GameObject("Mesh Part");
            MeshPart part = go.AddComponent<MeshPart>();
            part.transform.SetParent(parent.transform);

            long offset = reader.BaseStream.Position;

            int NextOffset = reader.ReadInt32();
            reader.SkipInt32(64);
            reader.SkipInt32();//Length 
            reader.SkipInt32(0);

            int VertexCount = reader.ReadInt32();
            part.ObjectType = reader.ReadInt32(); //1 = static, 2 = can be or not there, 3 = can move
            int val = reader.ReadInt32();
            part.OcclusionGroup = "0x" + val.ToString("X") + " 0b" + Convert.ToString(val, 2);
            part.MeshFlags = reader.ReadInt32();

            reader.SkipBytes(32, 0);

            go.isStatic = part.ObjectType != 3;

            Matrix4x4 matrix = part.GetComponentInParent<Scene>().GetSH3ToUnityMatrix();

            List<Vector3> _verts = new List<Vector3>();
            List<Vector3> _norms = new List<Vector3>();
            List<Vector2> _uvs = new List<Vector2>();
            List<Color32> _colors = new List<Color32>();
            for (int i = 0; i != VertexCount; i++)
            {
                Vector3 temp = reader.ReadVector3();
                temp.y = -temp.y;
                _verts.Add(matrix.MultiplyPoint(temp));

                temp = reader.ReadVector3();
                temp.x = -temp.x;
                temp.z = -temp.z;
                _norms.Add(temp);

                _uvs.Add(reader.ReadVector2());
                _colors.Add(reader.ReadBGRA());
            }

            Mesh mesh = MeshUtils.MakeStripped(_verts, _norms, _uvs, _colors);

            mesh.name = "mesh_" + offset;
            go.AddComponent<MeshFilter>().sharedMesh = mesh;
            go.AddComponent<MeshRenderer>().shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;

            return NextOffset;
        }
开发者ID:JokieW,项目名称:ShiningHill,代码行数:54,代码来源:MeshPart.cs

示例8: NiScreenLODData

        /// <summary>
        /// Initializes a new instance of the <see cref="NiScreenLODData"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiScreenLODData(NiFile file, BinaryReader reader) : base(file, reader)
		{
			this.BoundCenter = reader.ReadVector3();
			this.BoundRadius = reader.ReadSingle();
			this.WorldCenter = reader.ReadVector3();
			this.WorldRadius = reader.ReadSingle();
			uint num = reader.ReadUInt32();
			this.ProportionLevels = new float[num];
			int num2 = 0;
			while ((long)num2 < (long)((ulong)num))
			{
				this.ProportionLevels[num2] = reader.ReadSingle();
				num2++;
			}
		}
开发者ID:dol-leodagan,项目名称:niflib.net,代码行数:20,代码来源:NiScreenLODData.cs

示例9: Read

 public static MODFEntry Read(BinaryReader br)
 {
     return new MODFEntry
     {
         MWIDEntryIndex = br.ReadUInt32(),
         UniqueId = br.ReadUInt32(),
         Position = br.ReadVector3(),
         Rotation = br.ReadVector3(),
         LowerBounds = br.ReadVector3(),
         UpperBounds = br.ReadVector3(),
         Flags = (MODFFlags)br.ReadUInt16(),
         DoodadSet = br.ReadUInt16(),
         NameSet = br.ReadUInt16(),
         padding = br.ReadUInt16(),
     };
 }
开发者ID:aeo24,项目名称:WoWMap,代码行数:16,代码来源:MODF.cs

示例10: Deserialise

        public static Skybox Deserialise(BinaryReader reader, GameObject parent)
        {
            GameObject go = new GameObject("Skybox");
            Skybox sky = go.AddComponent<Skybox>();
            go.transform.SetParent(parent.transform);

            sky.NextSkyboxOffset = reader.ReadInt32();
            sky.HeaderLength = reader.ReadInt32();
            sky.SkyboxLength = reader.ReadInt32();
            sky.Unknown1 = reader.ReadInt32();

            sky.Unknown2 = reader.ReadInt32();
            sky.Unknown3 = reader.ReadInt32();
            sky.Unknown4 = reader.ReadInt32();
            sky.Unknown5 = reader.ReadInt32();

            sky.Matrix = reader.ReadMatrix4x4();

            List<Vector3> _verts = new List<Vector3>();
            for (int i = 0; i != 8; i++)
            {
                _verts.Add(reader.ReadVector3());
                reader.SkipInt32();
            }
            sky.Vertices = _verts.ToArray();

            return sky;
        }
开发者ID:JokieW,项目名称:ShiningHill,代码行数:28,代码来源:Skybox.cs

示例11: Polygon

 public Polygon(BinaryReader reader)
 {
     int vertexCount = reader.ReadInt32();
     Vector3[] vertices = new Vector3[vertexCount];
     for (int x = 0; x < vertexCount; x++)
         vertices[x] = reader.ReadVector3();
     CalculateValues(vertices);
 }
开发者ID:MyEyes,项目名称:MobaAI,代码行数:8,代码来源:Polygon.cs

示例12: RoRswDataModel

		public RoRswDataModel(BinaryReader reader, GenericFileFormatVersion version)
			: base(reader, version) {
			name = reader.ReadWord(40);
			if (version.IsCompatible(1, 3)) {
				unk1 = reader.ReadInt32();
				unk2 = reader.ReadSingle();
				unk3 = reader.ReadSingle();
			}
			filename = reader.ReadWord(40);
			reserved = reader.ReadWord(40);
			type = reader.ReadWord(20);
			sound = reader.ReadWord(20);
			todo1 = reader.ReadWord(40);
			pos = reader.ReadVector3();
			rot = reader.ReadVector3();
			scale = reader.ReadVector3();
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:17,代码来源:RoRswDataModel.cs

示例13: Structure

 public Structure(Map map, BinaryReader reader)
 {
     position = reader.ReadVector3();
     collisionPolygon = new Polygon(reader);
     characterFile = reader.ReadString();
     teamID = reader.ReadInt32();
     info = new CharacterInfo(characterFile);
     health = info.maxHealth;
     this.map = map;
 }
开发者ID:MyEyes,项目名称:MobaAI,代码行数:10,代码来源:Structure.cs

示例14: Bone

        public Bone(BinaryReader reader)
        {
            Name = reader.ReadString();
            parentName = reader.ReadString();

            InheritScale = reader.ReadBoolean();
            InheritRotation = reader.ReadBoolean();
            Position = reader.ReadVector3();
            RotationMatrix = reader.ReadMatrix3();
            Rotation = Quaternion.FromMatrix3(RotationMatrix);
        }
开发者ID:reignstudios,项目名称:ReignSDK,代码行数:11,代码来源:Armature.cs

示例15: Lane

 public Lane(BinaryReader reader)
 {
     teamID = reader.ReadInt32();
     int numWayPoints = reader.ReadInt32();
     waypoints = new Vector3[numWayPoints];
     for (int x = 0; x < numWayPoints; x++)
         waypoints[x] = reader.ReadVector3();
     totalLength = 0;
     for (int x = 0; x < waypoints.Length - 1; x++)
         totalLength += (waypoints[x + 1] - waypoints[x]).Length();
 }
开发者ID:MyEyes,项目名称:MobaAI,代码行数:11,代码来源:Lane.cs


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