示例#1
0
 public NiPosData(NiFile file, BinaryReader reader) : base(file, reader)
 {
     Data = new KeyGroup <VecKey>(reader);
 }
示例#2
0
 public NiObject(NiFile file, BinaryReader reader)
 {
     File = file;
 }
示例#3
0
 public NiIntegerExtraData(NiFile file, BinaryReader reader)
     : base(file, reader)
 {
     Data = reader.ReadUInt32();
 }
示例#4
0
 public NiAmbientLight(NiFile file, BinaryReader reader)
     : base(file, reader)
 {
 }
示例#5
0
 public NiVectorExtraData(NiFile file, BinaryReader reader)
     : base(file, reader)
 {
     Data        = reader.ReadVector3();
     UnkownFloat = reader.ReadSingle();
 }
示例#6
0
 public NiBinaryExtraData(NiFile file, BinaryReader reader)
     : base(file, reader)
 {
     Data = reader.ReadBytes((int)reader.ReadUInt32());
 }
示例#7
0
 public NiUVController(NiFile file, BinaryReader reader)
     : base(file, reader)
 {
     UnkownShort1 = reader.ReadUInt16();
     Data         = new NiRef <NiUVData>(reader);
 }
示例#8
0
        public NiTexturingProperty(NiFile file, BinaryReader reader) : base(file, reader)
        {
            if (Version <= eNifVersion.VER_10_0_1_2 ||
                Version >= eNifVersion.VER_20_1_0_3)
            {
                Flags = reader.ReadUInt16();
            }


            if (Version <= eNifVersion.VER_20_0_0_5)
            {
                ApplyMode = reader.ReadUInt32();
            }

            TextureCount = reader.ReadUInt32();

            if (reader.ReadBoolean())
            {
                BaseTexture = new TexDesc(file, reader);
            }

            if (reader.ReadBoolean())
            {
                DarkTexture = new TexDesc(file, reader);
            }

            if (reader.ReadBoolean())
            {
                DetailTexture = new TexDesc(file, reader);
            }

            if (reader.ReadBoolean())
            {
                GlossTexture = new TexDesc(file, reader);
            }

            if (reader.ReadBoolean())
            {
                GlowTexture = new TexDesc(file, reader);
            }

            if (reader.ReadBoolean())
            {
                BumpMapTexture = new TexDesc(file, reader);

                BumpMapLumaScale  = reader.ReadSingle();
                BumpMapLumaOffset = reader.ReadSingle();
                BumpMapMatrix     = new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle());
                reader.ReadSingle(); //its a 2x2 matrix
            }
            if (reader.ReadBoolean())
            {
                Decal0Texture = new TexDesc(file, reader);
            }

            /*if (HasDecal1Texture)
             * {
             *  Decal1Texture = new TextureHelper();
             *  Decal1Texture.Read(reader, File, "Decal1Texture");
             * }
             * if (HasDecal2Texture)
             * {
             *  Decal2Texture = new TextureHelper();
             *  Decal2Texture.Read(reader, File, "Decal2Texture");
             * }
             * if (HasDecal3Texture)
             * {
             *  Decal3Texture = new TextureHelper();
             *  Decal3Texture.Read(reader, File, "Decal3Texture");
             * }*/

            if (Version >= eNifVersion.VER_10_0_1_0)
            {
                NumShaderTextures = reader.ReadUInt32();
                for (var i = 0; i < NumShaderTextures; i++)
                {
                    bool isUsed = reader.ReadBoolean();
                    if (isUsed)
                    {
                        var shaderTex = new TexDesc(file, reader);
                        reader.ReadUInt32(); // MapID
                    }
                }
            }
        }
示例#9
0
 public NiTriBasedGeomData(NiFile file, BinaryReader reader)
     : base(file, reader)
 {
     NumTriangles = reader.ReadUInt16();
 }
示例#10
0
        public NiGeometryData(NiFile file, BinaryReader reader)
            : base(file, reader)
        {
            if (Version >= eNifVersion.VER_10_2_0_0)
            {
                Unkown1 = reader.ReadUInt32();
            }

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

            HasVertices = reader.ReadBoolean();

            if (HasVertices)
            {
                Vertices = new Vector3[NumVertices];
                for (var i = 0; i < NumVertices; i++)
                {
                    Vertices[i] = reader.ReadVector3();
                }
            }

            var numUVSets = 0;

            if (Version >= eNifVersion.VER_10_0_1_0)
            {
                numUVSets  = reader.ReadByte();
                TSpaceFlag = reader.ReadByte();
            }
            HasNormals = reader.ReadBoolean();

            if (HasNormals)
            {
                Normals = new Vector3[NumVertices];
                for (var i = 0; i < NumVertices; i++)
                {
                    Normals[i] = reader.ReadVector3();
                }
            }

            if (Version >= eNifVersion.VER_10_1_0_0)
            {
                Binormals = new Vector3[NumVertices];
                Tangents  = new Vector3[NumVertices];
                if (HasNormals && (TSpaceFlag & 240) != 0)
                {
                    for (var i = 0; i < NumVertices; i++)
                    {
                        Binormals[i] = reader.ReadVector3();
                    }

                    for (var i = 0; i < NumVertices; i++)
                    {
                        Tangents[i] = reader.ReadVector3();
                    }
                }
            }

            Center          = reader.ReadVector3();
            Radius          = reader.ReadSingle();
            HasVertexColors = reader.ReadBoolean();
            if (HasVertexColors)
            {
                VertexColors = new Color4[NumVertices];
                for (var i = 0; i < NumVertices; i++)
                {
                    VertexColors[i] = reader.ReadColor4();
                }
            }

            if (Version <= eNifVersion.VER_4_2_2_0)
            {
                numUVSets  = reader.ReadByte();
                TSpaceFlag = reader.ReadByte();
            }

            if (Version <= eNifVersion.VER_4_0_0_2)
            {
                HasUV = reader.ReadBoolean();
            }

            var lnumUVSets = 0;

            if (!(Version >= eNifVersion.VER_20_2_0_7 &&
                  File.Header.UserVersion == 1))
            {
                lnumUVSets = numUVSets & 63;
            }
            else
            {
                lnumUVSets = numUVSets & 1;
            }

            UVSets = new Vector2[lnumUVSets][];
            for (var i = 0; i < lnumUVSets; i++)
            {
                UVSets[i] = new Vector2[NumVertices];
                for (var c = 0; c < NumVertices; c++)
                {
                    UVSets[i][c] = reader.ReadVector2();
                }
            }

            if (Version >= eNifVersion.VER_10_0_1_0)
            {
                ConsistencyFlags = reader.ReadUInt16();
            }

            if (Version >= eNifVersion.VER_20_0_0_4)
            {
                AdditionalDataID = reader.ReadUInt32();
            }
        }
示例#11
0
 public NiColorData(NiFile file, BinaryReader reader)
     : base(file, reader)
 {
     Data = new KeyGroup <Color4Key>(reader);
 }
示例#12
0
        public ATextureRenderData(NiFile file, BinaryReader reader) : base(file, reader)
        {
            PixelFormat = (ePixelFormat)reader.ReadUInt32();

            if (Version <= eNifVersion.VER_10_2_0_0)
            {
                RedMask      = reader.ReadUInt32();
                GreenMask    = reader.ReadUInt32();
                BlueMask     = reader.ReadUInt32();
                AlphaMask    = reader.ReadUInt32();
                BitsPerPixel = reader.ReadByte();
                Unkown3Bytes = new byte[3];
                for (var i = 0; i < Unkown3Bytes.Length; i++)
                {
                    Unkown3Bytes[i] = reader.ReadByte();
                }
                Unkown8Bytes = new byte[8];
                for (var i = 0; i < Unkown8Bytes.Length; i++)
                {
                    Unkown8Bytes[i] = reader.ReadByte();
                }
            }

            if (Version >= eNifVersion.VER_10_0_1_0 &&
                Version <= eNifVersion.VER_10_2_0_0)
            {
                UnkownInt = reader.ReadUInt32();
            }

            if (Version >= eNifVersion.VER_20_0_0_4)
            {
                BitsPerPixel = reader.ReadByte();
                UnkownInt2   = reader.ReadUInt32();
                UnkownInt3   = reader.ReadUInt32();
                Flags        = reader.ReadByte();
                UnkownInt4   = reader.ReadUInt32();
            }

            if (Version >= eNifVersion.VER_20_3_0_6)
            {
                UnkownByte1 = reader.ReadByte();
            }

            if (Version >= eNifVersion.VER_20_0_0_4)
            {
                ChannelData = new ChannelData[4];
                for (var i = 0; i < 4; i++)
                {
                    ChannelData[i] = new ChannelData(file, reader);
                }
            }

            Palette       = new NiRef <NiPalette>(reader);
            NumMipMaps    = reader.ReadUInt32();
            BytesPerPixel = reader.ReadUInt32();
            MipMaps       = new MipMap[NumMipMaps];
            for (var i = 0; i < NumMipMaps; i++)
            {
                MipMaps[i] = new MipMap(file, reader);
            }
        }
示例#13
0
 public NiAlphaProperty(NiFile file, BinaryReader reader) : base(file, reader)
 {
     Flags     = reader.ReadUInt16();
     Threshold = reader.ReadByte();
 }
示例#14
0
 public NiFloatExtraData(NiFile file, BinaryReader reader)
     : base(file, reader)
 {
     Data = reader.ReadSingle();
 }
示例#15
0
 public MipMap(NiFile file, BinaryReader reader)
 {
     Width  = reader.ReadUInt32();
     Height = reader.ReadUInt32();
     Offset = reader.ReadUInt32();
 }
示例#16
0
        public NiParticlesData(NiFile file, BinaryReader reader)
            : base(file, reader)
        {
            /*if (File.Header.Version >= eNifVersion.VER_10_2_0_0)
             * {
             * Name = new NiString(file, reader);
             * }
             *
             * NumVertices = reader.ReadUInt16();
             * if (File.Header.Version >= eNifVersion.VER_10_1_0_0)
             * {
             *  KeepFlags = reader.ReadByte();
             *  CompressFlags = reader.ReadByte();
             * }
             * HasVertices = reader.ReadBoolean();
             * if (HasVertices)
             * {
             *  Vertices = new Vector3[NumVertices];
             *  for (var i = 0; i < NumVertices; i++)
             *  {
             *      Vertices[i] = reader.ReadVector3();
             *  }
             * }
             * if (File.Header.Version >= eNifVersion.VER_10_0_1_0)
             * {
             *  NumUVSets = reader.ReadByte();
             *  TSpaceFlag = reader.ReadByte();
             * }
             *
             * HasNormals = reader.ReadBoolean();
             * if (HasNormals)
             * {
             *  Normals = new Vector3[NumVertices];
             *  for (var i = 0; i < NumVertices; i++)
             *  {
             *      Normals[i] = reader.ReadVector3();
             *  }
             * }
             *
             * if (File.Header.Version >= eNifVersion.VER_10_1_0_0)
             * {
             *  if (HasNormals && (TSpaceFlag & 240) != 0)
             *  {
             *      Binormals = new Vector3[NumVertices];
             *      Tangents = new Vector3[NumVertices];
             *      for (var i = 0; i < NumVertices; i++)
             *      {
             *          Binormals[i] = reader.ReadVector3();
             *      }
             *
             *      for (var i = 0; i < NumVertices; i++)
             *      {
             *          Tangents[i] = reader.ReadVector3();
             *      }
             *  }
             * }
             *
             * Center = reader.ReadVector3();
             * Radius = reader.ReadSingle();
             * HasVertexColors = reader.ReadBoolean();
             * if (HasVertexColors)
             * {
             *  VertexColors = new Color4[NumVertices];
             *  for (var i = 0; i < NumVertices; i++)
             *      VertexColors[i] = reader.ReadColor4();
             * }
             *
             * if (File.Header.Version <= eNifVersion.VER_4_2_2_0)
             * {
             *  NumUVSets = reader.ReadByte();
             *  TSpaceFlag = reader.ReadByte();
             * }
             *
             * if (File.Header.Version <= eNifVersion.VER_4_0_0_2)
             * {
             *  HasUV = reader.ReadBoolean();
             * }
             *
             * if (!(File.Header.Version >= eNifVersion.VER_20_2_0_7 && File.Header.UserVersion == 1))
             * {
             *  var uvsize = NumUVSets & 63;
             *
             *  UVSets = new Vector2[uvsize][];
             *  for (var i = 0; i < uvsize; i++)
             *  {
             *      UVSets[i] = new Vector2[NumVertices];
             *      for (int c = 0; c < NumVertices; c++)
             *          UVSets[i][c] = reader.ReadVector2();
             *  }
             *
             * }
             *
             * if (File.Header.Version >= eNifVersion.VER_10_0_1_0)
             *  ConsistencyFlags = reader.ReadUInt16();
             *
             * if (File.Header.Version >= eNifVersion.VER_20_0_0_4)
             * {
             *  AdditionalDataID = reader.ReadUInt32();
             * }
             */
            if (File.Header.Version <= eNifVersion.VER_4_0_0_2)
            {
                NumParticles = reader.ReadUInt16();
            }

            if (File.Header.Version <= eNifVersion.VER_10_0_1_0)
            {
                ParticleRadius = reader.ReadSingle();
            }

            if (File.Header.Version >= eNifVersion.VER_10_1_0_0)
            {
                HasRadii = reader.ReadBoolean();
                if (HasRadii)
                {
                    Radii = reader.ReadFloatArray((int)(NumVertices));
                }
            }
            NumActive = reader.ReadUInt16();
            HasSizes  = reader.ReadBoolean();
            if (HasSizes)
            {
                Sizes = reader.ReadFloatArray((int)NumVertices);
            }
            if (File.Header.Version >= eNifVersion.VER_10_0_1_0)
            {
                HasRotations = reader.ReadBoolean();

                if (HasRotations)
                {
                    Rotations = new Vector4[NumVertices];
                    for (var i = 0; i < NumVertices; i++)
                    {
                        Rotations[i] = reader.ReadVector4();
                    }
                }
            }
        }
 public NiParticleMeshesData(NiFile file, BinaryReader reader) : base(file, reader)
 {
     UnkownLink = new NiRef <NiAVObject>(reader);
 }
示例#18
0
        public NiParticleSystemController(NiFile file, BinaryReader reader)
            : base(file, reader)
        {
            if (Version <= eNifVersion.VER_3_1)
            {
                OldSpeed = reader.ReadUInt32();
            }

            if (Version >= eNifVersion.VER_3_3_0_13)
            {
                Speed = reader.ReadSingle();
            }

            RandomSpeed         = reader.ReadSingle();
            VerticalDirection   = reader.ReadSingle();
            VerticalAngle       = reader.ReadSingle();
            HorizontalDirection = reader.ReadSingle();
            HorizontalAngle     = reader.ReadSingle();
            UnkownNormal        = reader.ReadVector3();
            UnkownColor         = reader.ReadColor4();
            Size          = reader.ReadSingle();
            EmitStartTime = reader.ReadSingle();
            EmitStopTime  = reader.ReadSingle();

            if (Version >= eNifVersion.VER_4_0_0_2)
            {
                UnkownByte = reader.ReadByte();
            }

            if (Version <= eNifVersion.VER_3_1)
            {
                OldEmitRate = reader.ReadUInt32();
            }

            if (Version >= eNifVersion.VER_3_3_0_13)
            {
                EmitRate = reader.ReadSingle();
            }

            Lifetime       = reader.ReadSingle();
            LifetimeRandom = reader.ReadSingle();

            if (Version >= eNifVersion.VER_4_0_0_2)
            {
                EmitFlags = reader.ReadUInt16();
            }

            StartRandom = new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle());
            Emitter     = new NiRef <NiObject>(reader);

            if (Version >= eNifVersion.VER_4_0_0_2)
            {
                reader.ReadUInt16();
                reader.ReadSingle();
                reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt16();
            }

            if (Version <= eNifVersion.VER_3_1)
            {
                ParticleVelocity     = reader.ReadVector3();
                ParticleUnkownVector = reader.ReadVector3();
                ParticleLifeTime     = reader.ReadSingle();
                ParticleLink         = new NiRef <NiObject>(reader);
                ParticleTimestamp    = reader.ReadUInt32();
                ParticleUnkownShort  = reader.ReadUInt16();
                ParticleVertexId     = reader.ReadUInt16();
            }

            if (Version >= eNifVersion.VER_4_0_0_2)
            {
                NumParticles = reader.ReadUInt16();
                NumValid     = reader.ReadUInt16();
                Particles    = new Particle[NumParticles];
                for (var i = 0; i < NumParticles; i++)
                {
                    Particles[i] = new Particle(file, reader);
                }
                UnkownRef = new NiRef <NiObject>(reader);
            }

            ParticleExtra = new NiRef <NiParticleModifier>(reader);
            UnkownRef2    = new NiRef <NiObject>(reader);
            if (Version >= eNifVersion.VER_4_0_0_2)
            {
                Trailer = reader.ReadByte();
            }

            if (Version <= eNifVersion.VER_3_1)
            {
                ColorData     = new NiRef <NiColorData>(reader);
                UnkownFloat1  = reader.ReadSingle();
                UnkownFloats2 = reader.ReadFloatArray(ParticleUnkownShort);
            }
        }
示例#19
0
 public NiParticleColorModifier(NiFile file, BinaryReader reader)
     : base(file, reader)
 {
     Data = new NiRef <NiColorData>(reader);
 }
示例#20
0
 public NiParticles(NiFile file, BinaryReader reader)
     : base(file, reader)
 {
 }
 public SkinWeight(NiFile file, BinaryReader reader)
 {
     Index  = reader.ReadUInt16();
     Weight = reader.ReadSingle();
 }