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


C# BinaryReader.ReadQuaternion方法代码示例

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


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

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

示例2: Load

        /// <summary>
        /// Loads the file from the specified stream.
        /// </summary>
        /// <param name="stream">The stream to read from.</param>
        public override void Load(Stream stream)
        {
            BinaryReader reader = new BinaryReader(stream, Encoding.GetEncoding("EUC-KR"));

            Name = reader.ReadIntString();
            SoundEnabled = reader.ReadInt32() != 0;
            SoundFilePath = reader.ReadIntString();
            LoopCount = reader.ReadInt32();

            int particleCount = reader.ReadInt32();

            for (int i = 0; i < particleCount; i++) {
                EffectParticle particle = new EffectParticle();
                particle.Name = reader.ReadIntString();
                particle.UniqueIdentifier = reader.ReadIntString();
                particle.ParticleIndex = reader.ReadInt32();
                particle.FilePath = reader.ReadIntString();
                particle.AnimationEnabled = reader.ReadInt32() != 0;
                particle.AnimationName = reader.ReadIntString();
                particle.AnimationLoopCount = reader.ReadInt32();
                particle.AnimationIndex = reader.ReadInt32();
                particle.Position = reader.ReadVector3();
                particle.Rotation = reader.ReadQuaternion();
                particle.Delay = reader.ReadInt32();
                particle.LinkedToRoot = reader.ReadInt32() != 0;

                Particles.Add(particle);
            }

            int animationCount = reader.ReadInt32();

            for (int i = 0; i < animationCount; i++) {
                EffectAnimation animation = new EffectAnimation();
                animation.EffectName = reader.ReadIntString();
                animation.MeshName = reader.ReadIntString();
                animation.MeshIndex = reader.ReadInt32();
                animation.MeshFilePath = reader.ReadIntString();
                animation.AnimationFilePath = reader.ReadIntString();
                animation.TextureFilePath = reader.ReadIntString();
                animation.AlphaEnabled = reader.ReadInt32() != 0;
                animation.TwoSidedEnabled = reader.ReadInt32() != 0;
                animation.AlphaTestEnabled = reader.ReadInt32() != 0;
                animation.DepthTestEnabled = reader.ReadInt32() != 0;
                animation.DepthWriteEnabled = reader.ReadInt32() != 0;
                animation.SourceBlend = reader.ReadInt32();
                animation.DestinationBlend = reader.ReadInt32();
                animation.BlendOperation = reader.ReadInt32();
                animation.AnimationEnabled = reader.ReadInt32() != 0;
                animation.AnimationName = reader.ReadIntString();
                animation.AnimationLoopCount = reader.ReadInt32();
                animation.AnimationIndex = reader.ReadInt32();
                animation.Position = reader.ReadVector3();
                animation.Rotation = reader.ReadQuaternion();
                animation.Delay = reader.ReadInt32();
                animation.LoopCount = reader.ReadInt32();
                animation.LinkedToRoot = reader.ReadInt32() != 0;

                Animations.Add(animation);
            }
        }
开发者ID:Jiwan,项目名称:Revise,代码行数:64,代码来源:EffectFile.cs

示例3: ReadMODD

        static void ReadMODD(BinaryReader br, WMORoot wmo, uint size)
        {
            // Why oh why is wmo.Header.DoodadCount wrong sometimes
            // 40 is the size of DoodadDefinition
            wmo.DoodadDefinitions = new DoodadDefinition[size / 40];

            for (var i = 0; i < wmo.DoodadDefinitions.Length; i++)
            {
                var dd = new DoodadDefinition
                             {
                                 NameIndex = br.ReadInt32(),
                                 Position = br.ReadVector3(),
                                 Rotation = br.ReadQuaternion(),
                                 Scale = br.ReadSingle(),
                                 Color = br.ReadColor4()
                             };

                if (dd.NameIndex != -1)
                {
                    if(!wmo.DoodadFiles.TryGetValue(dd.NameIndex, out dd.FilePath))
                    {
                        dd.FilePath = "";
                        log.Error(String.Format("Doodad File Path for index: {0} missing from the Dictionary!", dd.NameIndex));
                    }
                }

                wmo.DoodadDefinitions[i] = dd;
            }
        }
开发者ID:remixod,项目名称:netServer,代码行数:29,代码来源:WMOReader.cs

示例4: ReadMODD

        static void ReadMODD(BinaryReader br, WMORoot wmo, uint size)
        {
            // Why oh why is wmo.Header.DoodadCount wrong sometimes
            // 40 is the size of DoodadDefinition
            wmo.DoodadDefinitions = new DoodadDefinition[size / 40];

            for (var i = 0; i < wmo.DoodadDefinitions.Length; i++)
            {
                var dd = new DoodadDefinition
                             {
                                 NameIndex = br.ReadInt32(),
                                 Position = br.ReadWMOVector3(),
                                 Rotation = br.ReadQuaternion(),
                                 Scale = br.ReadSingle(),
                                 Color = br.ReadColor4()
                             };

                if (dd.NameIndex != -1)
                {
                    dd.FilePath = wmo.DoodadFiles[dd.NameIndex];
                }

                wmo.DoodadDefinitions[i] = dd;
            }
        }
开发者ID:ray2006,项目名称:WCell,代码行数:25,代码来源:WMORootParser.cs

示例5: Read

 /// <summary>
 /// Reads the block data from the underlying stream.
 /// </summary>
 /// <param name="reader">The reader.</param>
 public virtual void Read(BinaryReader reader)
 {
     Name = reader.ReadByteString();
     WarpID = reader.ReadInt16();
     EventID = reader.ReadInt16();
     ObjectType = reader.ReadInt32();
     ObjectID = reader.ReadInt32();
     MapPosition = new IntVector2(reader.ReadInt32(), reader.ReadInt32());
     Rotation = reader.ReadQuaternion();
     Position = reader.ReadVector3();
     Scale = reader.ReadVector3();
 }
开发者ID:osROSE,项目名称:UnityRose,代码行数:16,代码来源:MapBlock.cs

示例6: Load

        public void Load(Stream fs, bool leaveOpen)
        {
            // Reset whole world
            foreach (var block in blocks.ToArray())
            {
                this[block.X, block.Y, block.Z] = null;
            }

            Action<bool> assert = (b) => { if (!b) throw new InvalidDataException(); };
            using (var br = new BinaryReader(fs, Encoding.UTF8, leaveOpen))
            {
                assert(br.ReadString() == "BLOCKWORLD");
                int major = br.ReadByte();
                int minor = br.ReadByte();
                assert(major == 1);

                int typeCount = br.ReadInt32();
                Type[] types = new Type[typeCount];
                for (int i = 0; i < typeCount; i++)
                {
                    string typeName = br.ReadString();
                    types[i] = Type.GetType(typeName);
                    if (types[i] == null)
                        throw new TypeLoadException("Could not find type " + typeName);
                }

                long blockCount = br.ReadInt64();
                for (long i = 0; i < blockCount; i++)
                {
                    int x = br.ReadInt32();
                    int y = br.ReadInt32();
                    int z = br.ReadInt32();
                    Type type = types[br.ReadInt32()];

                    var block = Activator.CreateInstance(type) as Block;

                    block.Deserialize(br);

                    this[x, y, z] = block;
                }

                // Details are stored here as well
                if(minor == 1)
                {
                    int detailCount = br.ReadInt32();
                    for (int i = 0; i < detailCount; i++)
                    {
                        int id = br.ReadInt32();
                        string model = br.ReadString();
                        int parentID = br.ReadInt32();

                        var position = br.ReadVector3();
                        var rotation = br.ReadQuaternion();

                        Shape shape = null;

                        bool hasShape = br.ReadBoolean();
                        if (hasShape)
                        {
                            var size = br.ReadVector3();
                            shape = new BoxShape(size.Jitter());
                        }

                        DetailObject detail = new DetailObject(this.GetDetail(parentID), id, shape);

                        if (string.IsNullOrWhiteSpace(model) == false)
                            detail.Model = model;

                        detail.Position = position;
                        detail.Rotation = rotation;

                        this.RegisterDetail(detail);

                        int behaviourCount = br.ReadInt32();
                        for (int j = 0; j < behaviourCount; j++)
                        {
                            var typeName = br.ReadString();
                            var type = Type.GetType(typeName, true);

                            int behaviourID = br.ReadInt32();
                            bool isEnabled = br.ReadBoolean();

                            var behaviour = (Behaviour)Activator.CreateInstance(type);

                            detail.CreateBehaviour(behaviour, behaviourID, isEnabled);
                        }
                    }

                    int signalCount = br.ReadInt32();
                    for (int j = 0; j < signalCount; j++)
                    {
                        var signalDetailID = br.ReadInt32();
                        var signalBehaviourID = br.ReadInt32();
                        var signalName = br.ReadString();

                        var signal = this.GetDetail(signalDetailID).Behaviours[signalBehaviourID].Signals[signalName];

                        var slotCount = br.ReadInt32();
                        for (int k = 0; k < slotCount; k++)
                        {
//.........这里部分代码省略.........
开发者ID:MasterQ32,项目名称:BlocksWorld,代码行数:101,代码来源:World.IO.cs

示例7: StructureBspMarkerBlock

 public StructureBspMarkerBlock(BinaryReader binaryReader)
 {
     this.name = binaryReader.ReadString32();
     this.rotation = binaryReader.ReadQuaternion();
     this.position = binaryReader.ReadVector3();
 }
开发者ID:jacksoncougar,项目名称:Moonfish-Editor,代码行数:6,代码来源:StructureBinarySeperationPlane.cs

示例8: 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.ReadQuaternion();
 }
开发者ID:Jiwan,项目名称:Revise,代码行数:9,代码来源:RotationChannel.cs

示例9: RenderModelNodeBlock

 public RenderModelNodeBlock(BinaryReader binaryReader)
 {
     this.name = binaryReader.ReadStringID();
     this.parentNode = binaryReader.ReadShortBlockIndex1();
     this.firstChildNode = binaryReader.ReadShortBlockIndex1();
     this.nextSiblingNode = binaryReader.ReadShortBlockIndex1();
     this.importNodeIndex = binaryReader.ReadInt16();
     this.defaultTranslation = binaryReader.ReadVector3();
     this.defaultRotation = binaryReader.ReadQuaternion();
     this.inverseForward = binaryReader.ReadVector3();
     this.inverseLeft = binaryReader.ReadVector3();
     this.inverseUp = binaryReader.ReadVector3();
     this.inversePosition = binaryReader.ReadVector3();
     this.inverseScale = binaryReader.ReadSingle();
     this.distanceFromParent = binaryReader.ReadSingle();
 }
开发者ID:jacksoncougar,项目名称:Moonfish-Editor,代码行数:16,代码来源:RenderModel.cs

示例10: CreateDetail

		private void CreateDetail(BinaryReader reader)
		{
			int id = reader.ReadInt32();
			int parentID = reader.ReadInt32();

			string model = reader.ReadString();
			var pos = reader.ReadVector3();
			var rot = reader.ReadQuaternion();

			Shape shape = null;
			bool hasShape = reader.ReadBoolean();
			if (hasShape == true)
			{
				var shapeSize = reader.ReadVector3();
				shape = DetailHelper.CreateShape(shapeSize);
			}

			var parent = this.world.GetDetail(parentID);

			DetailObject obj = new DetailObject(parent, id, shape);
			obj.Position = pos;
			obj.Rotation = rot;
			obj.Model = model.Length > 0 ? model : null;

			this.world.RegisterDetail(obj);
		}
开发者ID:MasterQ32,项目名称:BlocksWorld,代码行数:26,代码来源:WorldScene.cs

示例11: UpdateDetail

		private void UpdateDetail(BinaryReader reader)
		{
			int id = reader.ReadInt32();
			var pos = reader.ReadVector3();
			var rot = reader.ReadQuaternion();

			DetailObject obj = this.world.GetDetail(id);
			if (obj == null)
				return;
			obj.Position = pos;
			obj.Rotation = rot;
		}
开发者ID:MasterQ32,项目名称:BlocksWorld,代码行数:12,代码来源:WorldScene.cs

示例12: HeiDeserialize

        GameObject HeiDeserialize(Transform parent, ref BinaryReader reader)
        {
            var id = reader.ReadInt32();
            var name = reader.ReadString();

            var gobj = new GameObject(name);
            var trans = gobj.transform;
            ReferenceMap[id] = trans;

            trans.parent = parent;

            trans.localPosition = reader.ReadVector3();
            trans.localRotation = reader.ReadQuaternion();
            trans.localScale = reader.ReadVector3();

            var childCount = reader.ReadInt32();
            //recurse to children
            for (int i = 0; i < childCount; i++)
            {
                HeiDeserialize(trans, ref reader);
            }
            return gobj;
        }
开发者ID:babon,项目名称:UnityMesh,代码行数:23,代码来源:SerializerFactory.cs

示例13: ReadMODD

        static void ReadMODD(BinaryReader br, WMORoot wmo, uint size)
        {
            // Why oh why is wmo.Header.DoodadCount wrong sometimes
            uint count = size / 40; // 40 is the size of DoodadDefinition
            wmo.DoodadDefinitions = new DoodadDefinition[count];

            for (int i = 0; i < wmo.DoodadDefinitions.Length; i++)
            {
                var dd = new DoodadDefinition
                {
                    NameIndex = br.ReadInt32(),
                    Position = br.ReadVector3(),
                    Rotation = br.ReadQuaternion(),
                    Scale = br.ReadSingle(),
                    Color = br.ReadUInt32()
                };

                if (dd.NameIndex != -1)
                {
                    if (!wmo.DoodadFiles.TryGetValue(dd.NameIndex, out dd.FilePath))
                    {
                        Console.WriteLine("Erroneous dd.NameIndex in WmoRoot: {0}", wmo.FilePath);
                    }
                }

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

示例14: StructureBspEnvironmentObjectBlock

 public StructureBspEnvironmentObjectBlock(BinaryReader binaryReader)
 {
     this.name = binaryReader.ReadString32();
     this.rotation = binaryReader.ReadQuaternion();
     this.translation = binaryReader.ReadVector3();
     this.paletteIndex = binaryReader.ReadShortBlockIndex1();
     this.padding = binaryReader.ReadBytes(2);
     this.uniqueID = binaryReader.ReadInt32();
     this.exportedObjectType = binaryReader.ReadTagClass();
     this.scenarioObjectName = binaryReader.ReadString32();
 }
开发者ID:jacksoncougar,项目名称:Moonfish-Editor,代码行数:11,代码来源:StructureBinarySeperationPlane.cs

示例15: ReadLights

        public static MapLights ReadLights(string path)
        {
            /*string assetPath = path.Replace(".ded", ".asset");*/
            GameObject subGO = Scene.BeginEditingPrefab(path, "Lights");

            try
            {
                MapLights lights = subGO.AddComponent<MapLights>();

                BinaryReader reader = new BinaryReader(new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read));

                reader.SkipInt16(); //Usually the area's code
                reader.SkipInt16(); //Usually 1, saw a 20
                short globalLightsCount = reader.ReadInt16();
                reader.SkipInt16(0);
                short globalLightsOffset = reader.ReadInt16();
                reader.SkipInt16(0);
                reader.SkipBytes(8, 0);

                short weirdLightsCount = reader.ReadInt16();
                reader.SkipInt16(0);
                short weirdLightsOffset = reader.ReadInt16();
                reader.SkipInt16(0);
                reader.SkipBytes(8, 0);
                
                short lightsCount = reader.ReadInt16();
                reader.SkipInt16(0);
                short lightsOffset = reader.ReadInt16();
                reader.SkipInt16(0);

                reader.SkipBytes(40, 0);
                short ambientOffset = reader.ReadInt16();
                reader.SkipBytes(24, 0);

                Matrix4x4 transMat = lights.GetComponentInParent<Scene>().GetSH3ToUnityMatrix();

                reader.BaseStream.Position = globalLightsOffset;
                for (int i = 0; i != globalLightsCount; i++)
                {
                    GlobalLight gl = new GlobalLight();
                    gl.rotation = reader.ReadQuaternion();
                    gl.Unknown1 = reader.ReadVector3();
                    reader.SkipInt16(0);
                    gl.Unknown2 = reader.ReadInt16();
                    lights.globalLights.Add(gl);
                }

                reader.BaseStream.Position = weirdLightsOffset;
                for (int i = 0; i != weirdLightsCount; i++)
                {
                    LocalLight ll = new LocalLight();
                    ll.color = reader.ReadColor();
                    ll.Unknown1 = reader.ReadSingle();
                    ll.Range = reader.ReadSingle();
                    reader.SkipBytes(8, 0);
                    ll.position = reader.ReadVector3YInverted();
                    reader.SkipInt16(0x0);
                    ll.Unknown2 = reader.ReadInt16();
                    lights.weirdLights.Add(ll);
                }

                reader.BaseStream.Position = lightsOffset;
                for (int i = 0; i != lightsCount; i++)
                {
                    LocalLight ll = new LocalLight();
                    ll.color = reader.ReadColor();
                    ll.Unknown1 = reader.ReadSingle();
                    ll.Range = reader.ReadSingle();
                    reader.SkipBytes(8, 0);
                    ll.position = reader.ReadVector3YInverted();
                    reader.SkipInt16(0x0);
                    ll.Unknown2 = reader.ReadInt16();
                    lights.localLights.Add(ll);

                    GameObject lightGO = new GameObject("Light " + i);
                    lightGO.transform.SetParent(subGO.transform);
                    lightGO.transform.localPosition = transMat.MultiplyPoint(ll.position);

                    Light light = lightGO.AddComponent<Light>();
                    light.type = LightType.Point;
                    light.range = ll.Range * Scene.GLOBAL_SCALE;
                    light.color = ll.color;
                    light.intensity = 8.0f;
                    light.bounceIntensity = 1.0f;
                }

                reader.BaseStream.Position = ambientOffset;
                lights.Unknown1 = reader.ReadVector4();
                lights.Unknown2 = reader.ReadVector4();
                lights.ambientColor = reader.ReadColor();
                lights.Unknown3 = reader.ReadVector4();

                reader.Close();

                Scene.FinishEditingPrefab(path, subGO);

                return lights;

            }
            catch (Exception e)
//.........这里部分代码省略.........
开发者ID:JokieW,项目名称:ShiningHill,代码行数:101,代码来源:MapLights.cs


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