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


C# BinaryReader.ReadVector2方法代码示例

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


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

示例1: 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

示例2: Read

        /// <summary>
        /// Reads the event data from the underlying stream.
        /// </summary>
        /// <param name="reader">The reader.</param>
        public override void Read(BinaryReader reader)
        {
            base.Read(reader);

            Scale = new MinMax<Vector2>(reader.ReadVector2(), reader.ReadVector2());
        }
开发者ID:Jiwan,项目名称:Revise,代码行数:10,代码来源:ScaleEvent.cs

示例3: ReadVertices

        static void ReadVertices(BinaryReader br, M2Model model)
        {
            var vertInfo = model.Header.Vertices;

            model.Vertices = new ModelVertices[vertInfo.Count];

            br.BaseStream.Position = vertInfo.Offset;
            for (int i = 0; i < vertInfo.Count; i++)
            {
                var mv = new ModelVertices
                             {
                                 Position = br.ReadVector3(),
                                 BoneWeight = br.ReadBytes(4),
                                 BoneIndices = br.ReadBytes(4),
                                 Normal = br.ReadVector3(),
                                 TextureCoordinates = br.ReadVector2(),
                                 Float_1 = br.ReadSingle(),
                                 Float_2 = br.ReadSingle()
                             };

                model.Vertices[i] = mv;
            }
        }
开发者ID:remixod,项目名称:netServer,代码行数:23,代码来源:M2Reader.cs

示例4: ReadFrame

 /// <summary>
 /// Reads a channel frame from the underlying stream.
 /// </summary>
 /// <param name="reader">The reader.</param>
 /// <param name="frame">The frame to read.</param>
 public override void ReadFrame(BinaryReader reader, int frame)
 {
     frames[frame] = reader.ReadVector2();
 }
开发者ID:Jiwan,项目名称:Revise,代码行数:9,代码来源:TextureCoordinateChannel.cs

示例5: Deserialize

 public static EnemyBuildingUpdater Deserialize(BinaryReader s, GameState state)
 {
     int ti = s.ReadInt32();
     ViewedBuilding vb = new ViewedBuilding();
     vb.Team = s.ReadInt32();
     vb.Type = s.ReadInt32();
     vb.CellPoint = s.ReadPoint();
     vb.WorldPosition = s.ReadVector3();
     vb.ViewDirection = s.ReadVector2();
     int uuid = s.ReadInt32();
     RTSBuilding b = null;
     foreach(var building in state.teams[vb.Team].Buildings) {
         if(building.UUID == uuid) {
             b = building;
             break;
         }
     }
     EnemyBuildingUpdater ebu = new EnemyBuildingUpdater(state, ti, vb, b);
     ebu.Added = s.ReadBoolean();
     ebu.isDead = s.ReadBoolean();
     if(ebu.Added) {
         state.teams[ebu.teamIndex].ViewedEnemyBuildings.Add(vb);
     }
     return ebu;
 }
开发者ID:RegrowthStudios,项目名称:VoxelRTS,代码行数:25,代码来源:FOWResolver.cs

示例6: init

		private void init(string filename, Stream stream, string contentDirectory, Dictionary<string,Type> materialTypes, List<MaterialFieldBinder> value1BinderTypes, List<MaterialFieldBinder> value2BinderTypes, List<MaterialFieldBinder> value3BinderTypes, List<MaterialFieldBinder> value4BinderTypes, List<MaterialFieldBinder> textureBinderTypes, Dictionary<string,string> fileExtOverrides, int classicInstanceCount, Loader.LoadedCallbackMethod loadedCallback)
		{
			try
			{
				var reader = new BinaryReader(stream);

				// meta data
				if (reader.ReadInt32() != Streams.MakeFourCC('R', 'M', 'F', 'T')) Debug.ThrowError("Error", "Not a ReignModel file: " + filename);
				float version = reader.ReadSingle();
				if (version != 1.0f) Debug.ThrowError("Error", "Unsuported model version: " + version.ToString());
				bool compressed = reader.ReadBoolean();

				// frames
				FrameStart = reader.ReadSingle();
				FrameEnd = reader.ReadSingle();
				FrameCount = FrameEnd - FrameStart;
				FPS = reader.ReadSingle();

				// materials
				int materialCount = reader.ReadInt32();
				Materials = new MaterialI[materialCount];
				Textures = new List<ITexture2D>();
				for (int i = 0; i != materialCount; ++i)
				{
					string name = reader.ReadString();

					// create material
					bool pass = false;
					foreach (var materialType in (Dictionary<string,Type>)materialTypes)
					{
						if (materialType.Key == name)
						{
							Materials[i] = (MaterialI)Activator.CreateInstance(materialType.Value);
							Materials[i].Name = name;
							pass = true;
							break;
						}
					}
					if (!pass) Debug.ThrowError("Model", "Failed to find a valid material type for: " + name);
					var material = Materials[i];

					// values1
					var values1 = new Dictionary<string,float>();
					int valueCount = reader.ReadInt32();
					for (int i2 = 0; i2 != valueCount; ++i2) values1.Add(reader.ReadString(), reader.ReadSingle());
					bindTypes(material, values1, value1BinderTypes, contentDirectory, fileExtOverrides, handleFoundValueBinder);

					// values2
					var values2 = new Dictionary<string,Vector2>();
					valueCount = reader.ReadInt32();
					for (int i2 = 0; i2 != valueCount; ++i2) values2.Add(reader.ReadString(), reader.ReadVector2());
					bindTypes(material, values2, value2BinderTypes, contentDirectory, fileExtOverrides, handleFoundValueBinder);

					// values3
					var values3 = new Dictionary<string,Vector3>();
					valueCount = reader.ReadInt32();
					for (int i2 = 0; i2 != valueCount; ++i2) values3.Add(reader.ReadString(), reader.ReadVector3());
					bindTypes(material, values3, value3BinderTypes, contentDirectory, fileExtOverrides, handleFoundValueBinder);

					// values4
					var values4 = new Dictionary<string,Vector4>();
					valueCount = reader.ReadInt32();
					for (int i2 = 0; i2 != valueCount; ++i2) values4.Add(reader.ReadString(), reader.ReadVector4());
					bindTypes(material, values4, value4BinderTypes, contentDirectory, fileExtOverrides, handleFoundValueBinder);

					// textures
					var textures = new Dictionary<string,string>();
					int textureCount = reader.ReadInt32();
					for (int i2 = 0; i2 != textureCount; ++i2) textures.Add(reader.ReadString(), reader.ReadString());
					bindTypes(material, textures, textureBinderTypes, contentDirectory, fileExtOverrides, handleFoundTextureBinder);
				}

				// meshes
				int meshCount = reader.ReadInt32();
				Meshes = new Mesh[meshCount];
				for (int i = 0; i != meshCount; ++i)
				{
					Meshes[i] = new Mesh(reader, this, classicInstanceCount);
				}

				// actions
				int actionCount = reader.ReadInt32();
				Actions = new Action[actionCount];
				for (int i = 0; i != actionCount; ++i)
				{
					Actions[i] = new Action(reader);
				}

				// armatures
				int armatureCount = reader.ReadInt32();
				Armatures = new Armature[armatureCount];
				for (int i = 0; i != armatureCount; ++i)
				{
					Armatures[i] = new Armature(reader);
				}

				// objects
				int objectCount = reader.ReadInt32();
				Objects = new Object[objectCount];
				for (int i = 0; i != objectCount; ++i)
//.........这里部分代码省略.........
开发者ID:reignstudios,项目名称:ReignSDK,代码行数:101,代码来源:Model.cs

示例7: LoadFrom

 public void LoadFrom(Stream stream)
 {
     BinaryReader reader = new BinaryReader(stream);
     enabled = reader.ReadBoolean();
     reader.ReadBytes(3);
     curve = new MinMaxCurve(stream);
     range = reader.ReadVector2();
 }
开发者ID:hejob,项目名称:SB3Utility,代码行数:8,代码来源:ParticleSystem.cs

示例8: RestoreSuspendedState

        public void RestoreSuspendedState(CanvasDevice device, BinaryReader reader)
        {
            bitmapFormat = (DirectXPixelFormat)reader.ReadInt32();
            bitmapData = reader.ReadByteArray();

            Size = reader.ReadVector2();

            reader.ReadCollection(Edits, () => EditGroup.RestoreSuspendedState(this, reader));

            RecoverAfterDeviceLost(device);
        }
开发者ID:shawnhar,项目名称:stuart,代码行数:11,代码来源:Photo.cs

示例9: UserHintWellPointBlock

 public UserHintWellPointBlock(BinaryReader binaryReader)
 {
     this.type = (Type)binaryReader.ReadInt16();
     this.padding = binaryReader.ReadBytes(2);
     this.point = binaryReader.ReadVector3();
     this.referenceFrame = binaryReader.ReadInt16();
     this.padding0 = binaryReader.ReadBytes(2);
     this.sectorIndex = binaryReader.ReadInt32();
     this.normal = binaryReader.ReadVector2();
 }
开发者ID:jacksoncougar,项目名称:Moonfish-Editor,代码行数:10,代码来源:Scenario.cs

示例10: FiringPositionsBlock

 public FiringPositionsBlock(BinaryReader binaryReader)
 {
     this.positionLocal = binaryReader.ReadVector3();
     this.referenceFrame = binaryReader.ReadInt16();
     this.flags = (Flags)binaryReader.ReadInt16();
     this.area = binaryReader.ReadShortBlockIndex1();
     this.clusterIndex = binaryReader.ReadInt16();
     this.skip = binaryReader.ReadBytes(4);
     this.normal = binaryReader.ReadVector2();
 }
开发者ID:jacksoncougar,项目名称:Moonfish-Editor,代码行数:10,代码来源:Scenario.cs

示例11: ActorStartingLocationsBlock

 public ActorStartingLocationsBlock(BinaryReader binaryReader)
 {
     this.name = binaryReader.ReadStringID();
     this.position = binaryReader.ReadVector3();
     this.referenceFrame = binaryReader.ReadInt16();
     this.padding = binaryReader.ReadBytes(2);
     this.facingYawPitchDegrees = binaryReader.ReadVector2();
     this.flags = (Flags)binaryReader.ReadInt32();
     this.characterType = binaryReader.ReadShortBlockIndex1();
     this.initialWeapon = binaryReader.ReadShortBlockIndex1();
     this.initialSecondaryWeapon = binaryReader.ReadShortBlockIndex1();
     this.padding0 = binaryReader.ReadBytes(2);
     this.vehicleType = binaryReader.ReadShortBlockIndex1();
     this.seatType = (SeatType)binaryReader.ReadInt16();
     this.grenadeType = (GrenadeType)binaryReader.ReadInt16();
     this.swarmCountNumberOfCreturesInSwarmIfASwarmIsSpawnedAtThisLocation = binaryReader.ReadInt16();
     this.actorVariantName = binaryReader.ReadStringID();
     this.vehicleVariantName = binaryReader.ReadStringID();
     this.initialMovementDistanceBeforeDoingAnythingElseTheActorWillTravelTheGivenDistanceInItsForwardDirection = binaryReader.ReadSingle();
     this.emitterVehicle = binaryReader.ReadShortBlockIndex1();
     this.initialMovementMode = (InitialMovementMode)binaryReader.ReadInt16();
     this.placementScript = binaryReader.ReadString32();
     this.skip1 = binaryReader.ReadBytes(2);
     this.padding2 = binaryReader.ReadBytes(2);
 }
开发者ID:jacksoncougar,项目名称:Moonfish-Editor,代码行数:25,代码来源:Scenario.cs

示例12: TexDesc

        /// <summary>
        /// Initializes a new instance of the <see cref="TexDesc"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public TexDesc(NiFile file, BinaryReader reader)
		{
			this.Source = new NiRef<NiSourceTexture>(reader);
			if (file.Version <= eNifVersion.VER_20_0_0_5)
			{
				this.ClampMode = (eTexClampMode)reader.ReadUInt32();
				this.FilterMode = (eTexFilterMode)reader.ReadUInt32();
			}
			if (file.Version >= eNifVersion.VER_20_1_0_3)
			{
				this.Flags = reader.ReadUInt16();
			}
			if (file.Version <= eNifVersion.VER_20_0_0_5)
			{
				this.UVSetIndex = reader.ReadUInt32();
			}
			if (file.Version <= eNifVersion.VER_10_4_0_1)
			{
				this.PS2L = reader.ReadInt16();
				this.PS2K = reader.ReadInt16();
			}
			if (file.Version <= eNifVersion.VER_4_1_0_12)
			{
				reader.ReadUInt16();
			}
			if (file.Version >= eNifVersion.VER_10_1_0_0)
			{
				this.HasTextureTransform = reader.ReadBoolean(file.Version);
				if (this.HasTextureTransform)
				{
					this.Translation = reader.ReadVector2();
					this.Tiling = reader.ReadVector2();
					this.WRotation = reader.ReadSingle();
					this.TransformType = reader.ReadUInt32();
					this.CenterOffset = reader.ReadVector2();
				}
			}
		}
开发者ID:dol-leodagan,项目名称:niflib.net,代码行数:43,代码来源:TexDesc.cs

示例13: GlobalGeometrySectionRawVertexBlock

 public GlobalGeometrySectionRawVertexBlock(BinaryReader binaryReader)
 {
     this.position = binaryReader.ReadVector3();
     this.nodeIndicesOLD = new NodeIndicesOLD[4];
     for (int i = 0; i < 4; ++i)
     {
         this.nodeIndicesOLD[i] = new NodeIndicesOLD(binaryReader);
     }
     this.nodeWeights = new NodeWeights[4];
     for (int i = 0; i < 4; ++i)
     {
         this.nodeWeights[i] = new NodeWeights(binaryReader);
     }
     this.nodeIndicesNEW = new NodeIndicesNEW[4];
     for (int i = 0; i < 4; ++i)
     {
         this.nodeIndicesNEW[i] = new NodeIndicesNEW(binaryReader);
     }
     this.useNewNodeIndices = binaryReader.ReadInt32();
     this.adjustedCompoundNodeIndex = binaryReader.ReadInt32();
     this.texcoord = binaryReader.ReadVector2();
     this.normal = binaryReader.ReadVector3();
     this.binormal = binaryReader.ReadVector3();
     this.tangent = binaryReader.ReadVector3();
     this.anisotropicBinormal = binaryReader.ReadVector3();
     this.secondaryTexcoord = binaryReader.ReadVector2();
     this.primaryLightmapColor = binaryReader.ReadColorR8G8B8();
     this.primaryLightmapTexcoord = binaryReader.ReadVector2();
     this.primaryLightmapIncidentDirection = binaryReader.ReadVector3();
     this.padding = binaryReader.ReadBytes(12);
     this.padding0 = binaryReader.ReadBytes(8);
     this.padding1 = binaryReader.ReadBytes(12);
 }
开发者ID:jacksoncougar,项目名称:Moonfish-Editor,代码行数:33,代码来源:RenderModel.cs

示例14: Deserialize

 public static RTSBuilding Deserialize(BinaryReader s, RTSTeam team, out int? target)
 {
     int type = s.ReadInt32();
     RTSBuilding e = team.AddBuilding(type, Vector2.Zero);
     if(e == null) throw new Exception("Could Not Create A Building That Was Previously Created");
     e.UUID = s.ReadInt32();
     e.State = s.ReadInt32();
     e.ViewDirection = s.ReadVector2();
     e.GridPosition = s.ReadVector2();
     e.Height = s.ReadSingle();
     if(s.ReadBoolean()) {
         target = s.ReadInt32();
     }
     else {
         target = null;
     }
     e.Health = s.ReadInt32();
     for(int i = 0; i < GameState.MAX_PLAYERS; i++) {
         e.viewedInfo.Set(i, s.ReadBoolean());
     }
     if(s.ReadBoolean()) {
         if(e.ActionController != null) e.ActionController.Deserialize(s);
     }
     else {
         e.ActionController = null;
     }
     return e;
 }
开发者ID:RegrowthStudios,项目名称:VoxelRTS,代码行数:28,代码来源:RTSBuilding.cs

示例15: Deserialize

 public static RTSUnitData Deserialize(BinaryReader s, GameState state, int index)
 {
     RTSUnitData data = new RTSUnitData(index);
     data.FriendlyName = s.ReadString();
     data.InfoFile = s.ReadString();
     data.Health = s.ReadInt32();
     data.CapitalCost = s.ReadInt32();
     data.PopulationCost = s.ReadInt32();
     data.MaxCount = s.ReadInt32();
     data.MovementSpeed = s.ReadSingle();
     data.Impact = s.ReadInt32();
     data.BuildTime = s.ReadInt32();
     data.CarryingCapacity = s.ReadInt32();
     data.IsWorker = s.ReadBoolean();
     BaseCombatData.Deserialize(s, data.BaseCombatData);
     CollisionType ct = (CollisionType)s.ReadInt32();
     Vector2 cc = s.ReadVector2();
     bool cs = s.ReadBoolean();
     switch(ct) {
         case CollisionType.Circle:
             float cr = s.ReadSingle();
             data.ICollidableShape = new CollisionCircle(cr, cc, cs);
             break;
         case CollisionType.Rectangle:
             float cw = s.ReadSingle();
             float cd = s.ReadSingle();
             data.ICollidableShape = new CollisionRect(cw, cd, cc, cs);
             break;
         default:
             throw new Exception("Nonexistent Collision Type");
     }
     data.BBox.Min = s.ReadVector3();
     data.BBox.Max = s.ReadVector3();
     data.DefaultActionController = state.Scripts[s.ReadString()];
     data.DefaultCombatController = state.Scripts[s.ReadString()];
     data.DefaultMoveController = state.Scripts[s.ReadString()];
     data.DefaultAnimationController = state.Scripts[s.ReadString()];
     return data;
 }
开发者ID:RegrowthStudios,项目名称:VoxelRTS,代码行数:39,代码来源:RTSUnitData.cs


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