Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NiLight"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiLight(NiFile file, BinaryReader reader) : base(file, reader)
		{
			this.Dimmer = reader.ReadSingle();
			this.AmbientColor = reader.ReadColor3();
			this.DiffuseColor = reader.ReadColor3();
			this.SpecularColor = reader.ReadColor3();
		}
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NiBillboardNode" /> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiBillboardNode(NiFile file, BinaryReader reader) : base(file, reader)
		{
			if (this.File.Header.Version >= eNifVersion.VER_10_1_0_0)
			{
				this.BillboardMode = (eBillboardMode)reader.ReadUInt16();
			}
		}
        /// <summary>
        /// Initializes a new instance of the <see cref="NiSingleInterpController"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiSingleInterpController(NiFile file, BinaryReader reader) : base(file, reader)
		{
			if (base.Version >= eNifVersion.VER_10_2_0_0)
			{
				this.Interpolator = new NiRef<NiInterpolator>(reader);
			}
		}
Пример #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NiTriStripsData"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiTriStripsData(NiFile file, BinaryReader reader) : base(file, reader)
		{
			ushort[] array = new ushort[(int)reader.ReadUInt16()];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = reader.ReadUInt16();
			}
			if (base.Version >= eNifVersion.VER_10_0_1_3)
			{
				this.HasPoints = reader.ReadBoolean(Version);
			}
			else
			{
				this.HasPoints = array.Length > 0;
			}
			
			if (base.Version < eNifVersion.VER_10_0_1_3 || this.HasPoints)
			{
				this.Points = new ushort[array.Length][];
				for (int j = 0; j < array.Length; j++)
				{
					this.Points[j] = new ushort[(int)array[j]];
					for (ushort num = 0; num < array[j]; num++)
					{
						this.Points[j][(int)num] = reader.ReadUInt16();
					}
				}
			}
		}
Пример #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NiVisController"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiVisController(NiFile file, BinaryReader reader) : base(file, reader)
		{
			if (base.Version <= eNifVersion.VER_10_1_0_0)
			{
				this.Data = new NiRef<NiVisData>(reader);
			}
		}
Пример #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ChannelData"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public ChannelData(NiFile file, BinaryReader reader)
		{
			this.Type = (eChannelType)reader.ReadUInt32();
			this.Convention = (eChannelConvention)reader.ReadUInt32();
			this.BitsPerChannel = reader.ReadByte();
			this.UnkownByte = reader.ReadByte();
		}
Пример #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NiKeyframeData" /> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiKeyframeData(NiFile file, BinaryReader reader) : base(file, reader)
		{
			uint num = reader.ReadUInt32();
			if (num != 0u)
			{
				this.KeyType = (eKeyType)reader.ReadUInt32();
			}
			if (this.KeyType != eKeyType.XYZ_ROTATION_KEY)
			{
				this.QuaternionKeys = new QuatKey[num];
				int num2 = 0;
				while ((long)num2 < (long)((ulong)num))
				{
					this.QuaternionKeys[num2] = new QuatKey(reader, this.KeyType);
					num2++;
				}
			}
			if (base.Version <= eNifVersion.VER_10_1_0_0 && this.KeyType == eKeyType.XYZ_ROTATION_KEY)
			{
				this.UnkownFloat = reader.ReadSingle();
			}
			if (this.KeyType == eKeyType.XYZ_ROTATION_KEY)
			{
				this.Rotations = new KeyGroup<FloatKey>[3];
				for (int i = 0; i < 3; i++)
				{
					this.Rotations[i] = new KeyGroup<FloatKey>(reader);
				}
			}
			this.Translations = new KeyGroup<VecKey>(reader);
			this.Scales = new KeyGroup<FloatKey>(reader);
		}
Пример #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NiUVData"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiUVData(NiFile file, BinaryReader reader) : base(file, reader)
		{
			this.UTranslation = new KeyGroup<FloatKey>(reader);
			this.VTranslation = new KeyGroup<FloatKey>(reader);
			this.UScalingAndTiling = new KeyGroup<FloatKey>(reader);
			this.VScalingAndTiling = new KeyGroup<FloatKey>(reader);
		}
        /// <summary>
        /// Initializes a new instance of the <see cref="NiGeomMorpherController" /> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        /// <exception cref="Exception">Version too new!</exception>
        public NiGeomMorpherController(NiFile file, BinaryReader reader) : base(file, reader)
		{
			if (base.Version >= eNifVersion.VER_10_0_1_2)
			{
				this.ExtraFlags = reader.ReadUInt16();
			}
			if (base.Version == eNifVersion.VER_10_1_0_106)
			{
				this.Unknown2 = reader.ReadByte();
			}
			this.Data = new NiRef<NiMorphData>(reader);
			this.AlwaysUpdate = reader.ReadBoolean(Version);
			if (base.Version >= eNifVersion.VER_10_1_0_106)
			{
				this.NumInterpolators = reader.ReadUInt32();
			}
			if (base.Version >= eNifVersion.VER_10_1_0_106 && base.Version < eNifVersion.VER_20_2_0_7)
			{
				this.Interpolators = new NiRef<NiInterpolator>[this.NumInterpolators];
				int num = 0;
				while ((long)num < (long)((ulong)this.NumInterpolators))
				{
					this.Interpolators[num] = new NiRef<NiInterpolator>(reader);
					num++;
				}
			}
			if (base.Version >= eNifVersion.VER_20_0_0_4)
			{
				throw new Exception("Version too new!");
			}
		}
Пример #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NiAlphaController" /> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiAlphaController(NiFile file, BinaryReader reader) : base(file, reader)
		{
			if (this.File.Header.Version <= eNifVersion.VER_10_1_0_0)
			{
				this.Data = new NiRef<NiFloatData>(reader);
			}
		}
Пример #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NiTriShapeData"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiTriShapeData(NiFile file, BinaryReader reader) : base(file, reader)
		{
			this.NumTrianglePoints = reader.ReadUInt32();
			if (base.Version >= eNifVersion.VER_10_1_0_0)
			{
				this.HasTriangles = reader.ReadBoolean(Version);
			}
			if (base.Version <= eNifVersion.VER_10_0_1_2 || this.HasTriangles || base.Version >= eNifVersion.VER_10_0_1_3)
			{
				this.Triangles = new Triangle[(int)this.NumTriangles];
				this.HasTriangles = this.Triangles.Length > 0;
				for (int i = 0; i < (int)this.NumTriangles; i++)
				{
					this.Triangles[i] = new Triangle(reader);
				}
			}
			if (base.Version >= eNifVersion.VER_3_1)
			{
				ushort num = reader.ReadUInt16();
				this.MatchGroups = new ushort[(int)num][];
				for (int j = 0; j < (int)num; j++)
				{
					ushort num2 = reader.ReadUInt16();
					this.MatchGroups[j] = new ushort[(int)num2];
					for (int k = 0; k < (int)num2; k++)
					{
						this.MatchGroups[j][k] = reader.ReadUInt16();
					}
				}
			}
		}
Пример #12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NiString"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiString(NiFile file, BinaryReader reader)
		{
        	var count = reader.ReadUInt32();
        	if (count > 16384)
        		throw new NotSupportedException("String too long. Not a NIF file or unsupported format?");
        	this.Value = new string(reader.ReadChars((int)count));
		}
Пример #13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NiObjectNET" /> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        /// <exception cref="Exception">Unsupported Version!</exception>
        public NiObjectNET(NiFile file, BinaryReader reader) : base(file, reader)
		{
			this.Name = new NiString(file, reader);
			if (this.File.Header.Version <= eNifVersion.VER_2_3)
			{
				throw new Exception("Unsupported Version!");
			}
			if (this.File.Header.Version >= eNifVersion.VER_3_0 && this.File.Header.Version <= eNifVersion.VER_4_2_2_0)
			{
				this.ExtraData = new NiRef<NiExtraData>[1];
				this.ExtraData[0] = new NiRef<NiExtraData>(reader.ReadUInt32());
			}
			if (this.File.Header.Version >= eNifVersion.VER_10_0_1_0)
			{
				uint num = reader.ReadUInt32();
				this.ExtraData = new NiRef<NiExtraData>[num];
				int num2 = 0;
				while ((long)num2 < (long)((ulong)num))
				{
					this.ExtraData[num2] = new NiRef<NiExtraData>(reader.ReadUInt32());
					num2++;
				}
			}
			if (this.File.Header.Version >= eNifVersion.VER_3_0)
			{
				this.Controller = new NiRef<NiTimeController>(reader.ReadUInt32());
			}
		}
Пример #14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Morph"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        /// <param name="numVertices">The number vertices.</param>
        public Morph(NiFile file, BinaryReader reader, uint numVertices)
		{
			if (file.Version >= eNifVersion.VER_10_1_0_106)
			{
				this.FrameName = new NiString(file, reader);
			}
			if (file.Version <= eNifVersion.VER_10_1_0_0)
			{
				this.Keys = new KeyGroup<FloatKey>(reader);
			}
			if (file.Version >= eNifVersion.VER_10_1_0_106 && file.Version <= eNifVersion.VER_10_2_0_0)
			{
				this.UnkownInt = reader.ReadUInt32();
			}
			if (file.Version >= eNifVersion.VER_20_0_0_4 && file.Version <= eNifVersion.VER_20_1_0_3)
			{
				this.UnkownInt = reader.ReadUInt32();
			}
			this.Vectors = new Vector3[numVertices];
			int num = 0;
			while ((long)num < (long)((ulong)numVertices))
			{
				this.Vectors[num] = reader.ReadVector3();
				num++;
			}
		}
Пример #15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NiLookAtController" /> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiLookAtController(NiFile file, BinaryReader reader) : base(file, reader)
		{
			if (this.File.Header.Version >= eNifVersion.VER_10_1_0_0)
			{
				this.Unknown1 = reader.ReadUInt16();
			}
			this.CameraTargetNode = new NiRef<NiNode>(reader);
		}
Пример #16
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NiSwitchNode"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiSwitchNode(NiFile file, BinaryReader reader) : base(file, reader)
		{
			if (this.File.Header.Version >= eNifVersion.VER_10_0_1_0)
			{
				this.UnkownFlags = reader.ReadUInt16();
			}
			this.UnkownInt = reader.ReadInt32();
		}
Пример #17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NiStringExtraData"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiStringExtraData(NiFile file, BinaryReader reader) : base(file, reader)
		{
			if (base.Version <= eNifVersion.VER_4_2_2_0)
			{
				this.BytesRemaining = reader.ReadUInt32();
			}
			this.StringData = new NiString(file, reader);
		}
Пример #18
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NiStringsExtraData"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiStringsExtraData(NiFile file, BinaryReader reader) : base(file, reader)
		{
			this.ExtraStringData = new NiString[reader.ReadUInt32()];
			for (int i = 0; i < this.ExtraStringData.Length; i++)
			{
				this.ExtraStringData[i] = new NiString(file, reader);
			}
		}
Пример #19
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NiZBufferProperty"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiZBufferProperty(NiFile file, BinaryReader reader) : base(file, reader)
		{
			this.Flags = reader.ReadUInt16();
			if (base.Version >= eNifVersion.VER_4_1_0_12 && base.Version <= eNifVersion.VER_20_0_0_5)
			{
				this.ZCompareMode = reader.ReadUInt32();
			}
		}
        /// <summary>
        /// Initializes a new instance of the <see cref="NiParticleMeshModifier" /> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiParticleMeshModifier(NiFile file, BinaryReader reader) : base(file, reader)
		{
			this.ParticleMeshes = new NiRef<NiAVObject>[reader.ReadUInt32()];
			for (int i = 0; i < this.ParticleMeshes.Length; i++)
			{
				this.ParticleMeshes[i] = new NiRef<NiAVObject>(reader);
			}
		}
Пример #21
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NiParticleModifier"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiParticleModifier(NiFile file, BinaryReader reader) : base(file, reader)
		{
			this.Next = new NiRef<NiParticleModifier>(reader);
			if (this.File.Header.Version >= eNifVersion.VER_4_0_0_2)
			{
				this.Controller = new NiRef<NiParticleSystemController>(reader);
			}
		}
Пример #22
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NiIntegersExtraData"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiIntegersExtraData(NiFile file, BinaryReader reader) : base(file, reader)
		{
			this.ExtraIntData = new uint[reader.ReadUInt32()];
			for (int i = 0; i < this.ExtraIntData.Length; i++)
			{
				this.ExtraIntData[i] = reader.ReadUInt32();
			}
		}
Пример #23
0
        public ConvertWavefront(NiFile file)
            : base(file)
        {
            Export.Add("# Build with NifParser by Merec");
            Export.Add("# special thanks to Schaf");
            Export.Add("");

            WalkNodes(file.FindRoot());
        }
Пример #24
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NiPalette"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiPalette(NiFile file, BinaryReader reader) : base(file, reader)
		{
			this.UnkownByte = reader.ReadByte();
			this.Palette = new Color4[reader.ReadUInt32()];
			for (int i = 0; i < this.Palette.Length; i++)
			{
				this.Palette[i] = reader.ReadColor4Byte();
			}
		}
Пример #25
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NiSpotLight"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiSpotLight(NiFile file, BinaryReader reader) : base(file, reader)
		{
			this.CutoffAngle = reader.ReadSingle();
			if (base.Version >= eNifVersion.VER_20_2_0_7)
			{
				this.UnkownFloat = reader.ReadSingle();
			}
			this.Exponent = reader.ReadSingle();
		}
        /// <summary>
        /// Initializes a new instance of the <see cref="SkinPartitionUnkownItem1"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public SkinPartitionUnkownItem1(NiFile file, BinaryReader reader)
		{
			this.Flags = reader.ReadUInt32();
			this.Unkown1 = reader.ReadSingle();
			this.Unkown2 = reader.ReadSingle();
			this.Unkown3 = reader.ReadSingle();
			this.Unkown4 = reader.ReadSingle();
			this.Unkown5 = reader.ReadSingle();
		}
Пример #27
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NiVisData"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiVisData(NiFile file, BinaryReader reader) : base(file, reader)
		{
			uint num = reader.ReadUInt32();
			this.Keys = new ByteKey[num];
			for (int i = 0; i < this.Keys.Length; i++)
			{
				this.Keys[i] = new ByteKey(reader, eKeyType.LINEAR_KEY);
			}
		}
        /// <summary>
        /// Initializes a new instance of the <see cref="NiVertexColorProperty"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        /// <exception cref="Exception">unsupported data!</exception>
        public NiVertexColorProperty(NiFile file, BinaryReader reader) : base(file, reader)
		{
			this.Flags = reader.ReadUInt16();
			if (base.Version > eNifVersion.VER_20_0_0_5)
			{
				throw new Exception("unsupported data!");
			}
			this.VertexMode = reader.ReadUInt32();
			this.LightingMode = reader.ReadUInt32();
		}
        /// <summary>
        /// Initializes a new instance of the <see cref="NiTextureTransformController"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiTextureTransformController(NiFile file, BinaryReader reader) : base(file, reader)
		{
			this.Unkown2 = reader.ReadByte();
			this.TextureSlot = (eTexType)reader.ReadUInt32();
			this.Operation = (eTexTransform)reader.ReadUInt32();
			if (base.Version <= eNifVersion.VER_10_1_0_0)
			{
				this.Data = new NiRef<NiFloatData>(reader);
			}
		}
Пример #30
0
        /// <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();
		}
Пример #31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NiColorExtraData" /> class.
 /// </summary>
 /// <param name="file">The file.</param>
 /// <param name="reader">The reader.</param>
 public NiColorExtraData(NiFile file, BinaryReader reader) : base(file, reader)
 {
     this.Data = reader.ReadColor4();
 }
Пример #32
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NiTriShape"/> class.
 /// </summary>
 /// <param name="file">The file.</param>
 /// <param name="reader">The reader.</param>
 public NiTriShape(NiFile file, BinaryReader reader) : base(file, reader)
 {
 }
Пример #33
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NiBooleanExtraData" /> class.
 /// </summary>
 /// <param name="file">The file.</param>
 /// <param name="reader">The reader.</param>
 public NiBooleanExtraData(NiFile file, BinaryReader reader) : base(file, reader)
 {
     this.Data = reader.ReadBoolean(Version);
 }
Пример #34
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NiDirectionalLight" /> class.
 /// </summary>
 /// <param name="file">The file.</param>
 /// <param name="reader">The reader.</param>
 public NiDirectionalLight(NiFile file, BinaryReader reader) : base(file, reader)
 {
 }
Пример #35
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NiVectorExtraData"/> class.
 /// </summary>
 /// <param name="file">The file.</param>
 /// <param name="reader">The reader.</param>
 public NiVectorExtraData(NiFile file, BinaryReader reader) : base(file, reader)
 {
     this.Data        = reader.ReadVector3();
     this.UnkownFloat = reader.ReadSingle();
 }
Пример #36
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NiColorData" /> class.
 /// </summary>
 /// <param name="file">The file.</param>
 /// <param name="reader">The reader.</param>
 public NiColorData(NiFile file, BinaryReader reader) : base(file, reader)
 {
     this.Data = new KeyGroup <Color4Key>(reader);
 }
Пример #37
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NiSpecularProperty"/> class.
 /// </summary>
 /// <param name="file">The file.</param>
 /// <param name="reader">The reader.</param>
 public NiSpecularProperty(NiFile file, BinaryReader reader) : base(file, reader)
 {
     this.Flags = reader.ReadUInt16();
 }
Пример #38
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NiGeometryData" /> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiGeometryData(NiFile file, BinaryReader reader) : base(file, reader)
        {
            if (base.Version >= eNifVersion.VER_10_2_0_0)
            {
                this.Unkown1 = reader.ReadUInt32();
            }

            this.NumVertices = (uint)reader.ReadUInt16();
            if (base.Version >= eNifVersion.VER_10_1_0_0)
            {
                this.KeepFlags     = reader.ReadByte();
                this.CompressFlags = reader.ReadByte();
            }

            this.HasVertices = reader.ReadBoolean(Version);
            if (this.HasVertices)
            {
                this.Vertices = new Vector3[this.NumVertices];
                int num = 0;
                while ((long)num < (long)((ulong)this.NumVertices))
                {
                    this.Vertices[num] = reader.ReadVector3();
                    num++;
                }
            }

            int numUvSets = 0;

            if (base.Version >= eNifVersion.VER_10_0_1_0)
            {
                numUvSets       = (int)reader.ReadByte();
                this.TSpaceFlag = reader.ReadByte();
            }

            this.HasNormals = reader.ReadBoolean(Version);
            if (this.HasNormals)
            {
                this.Normals = new Vector3[this.NumVertices];
                int num3 = 0;
                while ((long)num3 < (long)((ulong)this.NumVertices))
                {
                    this.Normals[num3] = reader.ReadVector3();
                    num3++;
                }
            }
            if (base.Version >= eNifVersion.VER_10_1_0_0)
            {
                this.Binormals = new Vector3[this.NumVertices];
                this.Tangents  = new Vector3[this.NumVertices];
                if (this.HasNormals && (this.TSpaceFlag & 240) != 0)
                {
                    int num4 = 0;
                    while ((long)num4 < (long)((ulong)this.NumVertices))
                    {
                        this.Binormals[num4] = reader.ReadVector3();
                        num4++;
                    }
                    int num5 = 0;
                    while ((long)num5 < (long)((ulong)this.NumVertices))
                    {
                        this.Tangents[num5] = reader.ReadVector3();
                        num5++;
                    }
                }
            }

            this.Center = reader.ReadVector3();
            this.Radius = reader.ReadSingle();

            this.HasVertexColors = reader.ReadBoolean(Version);
            if (this.HasVertexColors)
            {
                this.VertexColors = new Color4[this.NumVertices];
                int num6 = 0;
                while ((long)num6 < (long)((ulong)this.NumVertices))
                {
                    this.VertexColors[num6] = reader.ReadColor4();
                    num6++;
                }
            }
            if (base.Version <= eNifVersion.VER_4_2_2_0)
            {
                numUvSets       = (int)reader.ReadByte();
                this.TSpaceFlag = reader.ReadByte();
            }
            if (base.Version <= eNifVersion.VER_4_0_0_2)
            {
                this.HasUV = reader.ReadBoolean(Version);
            }
            int num7;

            if (base.Version < eNifVersion.VER_20_2_0_7 || this.File.Header.UserVersion != 1u)
            {
                num7 = (numUvSets & 63);
            }
            else
            {
                num7 = (numUvSets & 1);
            }
            this.UVSets = new Vector2[num7][];
            for (int i = 0; i < num7; i++)
            {
                this.UVSets[i] = new Vector2[this.NumVertices];
                int num8 = 0;
                while ((long)num8 < (long)((ulong)this.NumVertices))
                {
                    this.UVSets[i][num8] = reader.ReadVector2();
                    num8++;
                }
            }
            if (base.Version >= eNifVersion.VER_10_0_1_0)
            {
                this.ConsistencyFlags = reader.ReadUInt16();
            }
            if (base.Version >= eNifVersion.VER_20_0_0_4)
            {
                this.AdditionalDataID = reader.ReadUInt32();
            }
        }
Пример #39
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NiFloatData" /> class.
 /// </summary>
 /// <param name="file">The file.</param>
 /// <param name="reader">The reader.</param>
 public NiFloatData(NiFile file, BinaryReader reader) : base(file, reader)
 {
     this.Data = new KeyGroup <FloatKey>(reader);
 }
Пример #40
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SkinPartition"/> class.
 /// </summary>
 /// <param name="file">The file.</param>
 /// <param name="reader">The reader.</param>
 public SkinPartition(NiFile file, BinaryReader reader)
 {
     this.NumVertices         = reader.ReadUInt16();
     this.NumTriangles        = reader.ReadUInt16();
     this.NumBones            = reader.ReadUInt16();
     this.NumStrips           = reader.ReadUInt16();
     this.NumWeightsPerVertex = reader.ReadUInt16();
     this.Bones            = reader.ReadUInt16Array((int)this.NumBones);
     this.HasVertexMap     = true;
     this.HasVertexWeights = true;
     this.HasFaces         = true;
     if (file.Version >= eNifVersion.VER_10_1_0_0)
     {
         this.HasVertexMap = reader.ReadBoolean(file.Version);
     }
     if (this.HasVertexMap)
     {
         this.VertexMap = reader.ReadUInt16Array((int)this.NumVertices);
     }
     if (file.Version >= eNifVersion.VER_10_1_0_0)
     {
         this.HasVertexWeights = reader.ReadBoolean(file.Version);
     }
     if (this.HasVertexWeights)
     {
         this.VertexWeights = new float[(int)this.NumVertices][];
         for (int i = 0; i < (int)this.NumVertices; i++)
         {
             this.VertexWeights[i] = reader.ReadFloatArray((int)this.NumWeightsPerVertex);
         }
     }
     this.StripLengths = reader.ReadUInt16Array((int)this.NumStrips);
     if (file.Version >= eNifVersion.VER_10_1_0_0)
     {
         this.HasFaces = reader.ReadBoolean(file.Version);
     }
     if (this.HasFaces && this.NumStrips != 0)
     {
         this.Strips = new ushort[(int)this.NumStrips][];
         for (int j = 0; j < (int)this.NumStrips; j++)
         {
             this.Strips[j] = reader.ReadUInt16Array((int)this.StripLengths[j]);
         }
     }
     else if (this.HasFaces && this.NumStrips == 0)
     {
         this.Triangles = new Triangle[(int)this.NumTriangles];
         for (int k = 0; k < this.Triangles.Length; k++)
         {
             this.Triangles[k] = new Triangle(reader);
         }
     }
     this.HasBoneIndicies = reader.ReadBoolean(file.Version);
     if (this.HasBoneIndicies)
     {
         this.BoneIndicies = new byte[(int)this.NumVertices][];
         for (int l = 0; l < this.BoneIndicies.Length; l++)
         {
             this.BoneIndicies[l] = new byte[(int)this.NumWeightsPerVertex];
             for (int m = 0; m < (int)this.NumWeightsPerVertex; m++)
             {
                 this.BoneIndicies[l][m] = reader.ReadByte();
             }
         }
     }
     if (file.Header.UserVersion >= 12u)
     {
         this.UnkownShort = reader.ReadUInt16();
     }
     if (file.Version == eNifVersion.VER_10_2_0_0 && file.Header.UserVersion == 1u)
     {
         this.UnkownShort2 = reader.ReadUInt16();
         this.UnkownShort3 = reader.ReadUInt16();
         this.NumVertices2 = reader.ReadUInt16();
         this.UnkownShort4 = reader.ReadUInt16();
         this.UnkownShort5 = reader.ReadUInt16();
         this.UnkownShort6 = reader.ReadUInt16();
         this.UnkownArr    = new SkinPartitionUnkownItem1[(int)this.NumVertices2];
         for (int n = 0; n < (int)this.NumVertices2; n++)
         {
             this.UnkownArr[n] = new SkinPartitionUnkownItem1(file, reader);
         }
     }
 }
Пример #41
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NiTexture"/> class.
 /// </summary>
 /// <param name="file">The file.</param>
 /// <param name="reader">The reader.</param>
 public NiTexture(NiFile file, BinaryReader reader) : base(file, reader)
 {
 }
Пример #42
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NiObject"/> class.
 /// </summary>
 /// <param name="file">The file.</param>
 /// <param name="reader">The reader.</param>
 public NiObject(NiFile file, BinaryReader reader)
 {
     this.File = file;
 }