Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NiSkinData"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiSkinData(NiFile file, BinaryReader reader) : base(file, reader)
        {
            this.HasVertexWeights = true;
            this.Transform        = new SkinTransform(file, reader);
            uint num = reader.ReadUInt32();

            if (base.Version >= eNifVersion.VER_4_0_0_2 && base.Version <= eNifVersion.VER_10_1_0_0)
            {
                this.Partition = new NiRef <NiSkinPartition>(reader);
            }
            if (base.Version >= eNifVersion.VER_4_2_1_0)
            {
                this.HasVertexWeights = reader.ReadBoolean(Version);
            }
            if (this.HasVertexWeights)
            {
                this.BoneList = new SkinData[num];
                int num2 = 0;
                while ((long)num2 < (long)((ulong)num))
                {
                    this.BoneList[num2] = new SkinData(file, reader, this.HasVertexWeights);
                    num2++;
                }
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SkinData"/> class.
 /// </summary>
 /// <param name="file">The file.</param>
 /// <param name="reader">The reader.</param>
 /// <param name="hasVertexWeights">if set to <c>true</c> [has vertex weights].</param>
 public SkinData(NiFile file, BinaryReader reader, bool hasVertexWeights)
 {
     this.Transform            = new SkinTransform(file, reader);
     this.BoundingSphereOffset = reader.ReadVector3();
     this.BoundingSphereRadius = reader.ReadSingle();
     if (file.Version == eNifVersion.VER_20_3_0_9 && file.Header.UserVersion == 131072u)
     {
         this.Unkown13Shorts = new ushort[13];
         for (int i = 0; i < 13; i++)
         {
             this.Unkown13Shorts[i] = reader.ReadUInt16();
         }
     }
     this.NumVertices = reader.ReadUInt16();
     if (hasVertexWeights)
     {
         this.VertexWeights = new SkinWeight[(int)this.NumVertices];
         for (int j = 0; j < (int)this.NumVertices; j++)
         {
             this.VertexWeights[j] = new SkinWeight(file, reader);
         }
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SkinData"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        /// <param name="hasVertexWeights">if set to <c>true</c> [has vertex weights].</param>
        public SkinData(NiFile file, BinaryReader reader, bool hasVertexWeights)
		{
			this.Transform = new SkinTransform(file, reader);
			this.BoundingSphereOffset = reader.ReadVector3();
			this.BoundingSphereRadius = reader.ReadSingle();
			if (file.Version == eNifVersion.VER_20_3_0_9 && file.Header.UserVersion == 131072u)
			{
				this.Unkown13Shorts = new ushort[13];
				for (int i = 0; i < 13; i++)
				{
					this.Unkown13Shorts[i] = reader.ReadUInt16();
				}
			}
			this.NumVertices = reader.ReadUInt16();
			if (hasVertexWeights)
			{
				this.VertexWeights = new SkinWeight[(int)this.NumVertices];
				for (int j = 0; j < (int)this.NumVertices; j++)
				{
					this.VertexWeights[j] = new SkinWeight(file, reader);
				}
			}
		}
Esempio n. 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NiSkinData"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiSkinData(NiFile file, BinaryReader reader) : base(file, reader)
		{
			this.HasVertexWeights = true;
			this.Transform = new SkinTransform(file, reader);
			uint num = reader.ReadUInt32();
			if (base.Version >= eNifVersion.VER_4_0_0_2 && base.Version <= eNifVersion.VER_10_1_0_0)
			{
				this.Partition = new NiRef<NiSkinPartition>(reader);
			}
			if (base.Version >= eNifVersion.VER_4_2_1_0)
			{
				this.HasVertexWeights = reader.ReadBoolean(Version);
			}
			if (this.HasVertexWeights)
			{
				this.BoneList = new SkinData[num];
				int num2 = 0;
				while ((long)num2 < (long)((ulong)num))
				{
					this.BoneList[num2] = new SkinData(file, reader, this.HasVertexWeights);
					num2++;
				}
			}
		}