Example #1
0
        public NiCamera(NiFile file, BinaryReader reader) : base(file, reader)
        {
            if (File.Header.Version >= eNifVersion.VER_10_1_0_0)
            {
                Unkown1 = reader.ReadUInt16();
            }

            FrustrumLeft   = reader.ReadSingle();
            FrustrumRight  = reader.ReadSingle();
            FrustrumTop    = reader.ReadSingle();
            FrustrumBottom = reader.ReadSingle();
            FrustrumNear   = reader.ReadSingle();
            FrustrumFar    = reader.ReadSingle();
            if (File.Header.Version >= eNifVersion.VER_10_1_0_0)
            {
                UseOrthographicsProjection = reader.ReadBoolean();
            }
            ViewportLeft   = reader.ReadSingle();
            ViewportRight  = reader.ReadSingle();
            ViewportTop    = reader.ReadSingle();
            ViewportBottom = reader.ReadSingle();
            LODAdjust      = reader.ReadSingle();
            UnkownLink     = new NiRef <NiObject>(reader);
            Unkown2        = reader.ReadUInt32();
            if (File.Header.Version >= eNifVersion.VER_4_2_1_0)
            {
                Unkown3 = reader.ReadUInt32();
            }
            if (File.Header.Version <= eNifVersion.VER_3_1)
            {
                Unkown4 = reader.ReadUInt32();
            }
        }
Example #2
0
        public NiObjectNET(NiFile file, BinaryReader reader)
            : base(file, reader)
        {
            Name = new NiString(file, reader);

            if (File.Header.Version <= eNifVersion.VER_2_3)
            {
                throw new Exception("Unsupported Version!");
            }

            if (File.Header.Version >= eNifVersion.VER_3_0 && File.Header.Version <= eNifVersion.VER_4_2_2_0)
            {
                ExtraData    = new NiRef <NiExtraData> [1];
                ExtraData[0] = new NiRef <NiExtraData>(reader.ReadUInt32());
            }

            if (File.Header.Version >= eNifVersion.VER_10_0_1_0)
            {
                var numExtraData = reader.ReadUInt32();
                ExtraData = new NiRef <NiExtraData> [numExtraData];
                for (var i = 0; i < numExtraData; i++)
                {
                    ExtraData[i] = new NiRef <NiExtraData>(reader.ReadUInt32());
                }
            }

            if (File.Header.Version >= eNifVersion.VER_3_0)
            {
                Controller = new NiRef <NiTimeController>(reader.ReadUInt32());
            }
        }
Example #3
0
        public NiSkinData(NiFile file, BinaryReader reader)
            : base(file, reader)
        {
            HasVertexWeights = true;
            Transform        = new SkinTransform(file, reader);
            var numBones = reader.ReadUInt32();

            if (Version >= eNifVersion.VER_4_0_0_2 && Version <= eNifVersion.VER_10_1_0_0)
            {
                Partition = new NiRef <NiSkinPartition>(reader);
            }
            if (Version >= eNifVersion.VER_4_2_1_0)
            {
                HasVertexWeights = reader.ReadBoolean();
            }

            if (HasVertexWeights)
            {
                BoneList = new SkinData[numBones];
                for (var i = 0; i < numBones; i++)
                {
                    BoneList[i] = new SkinData(file, reader, HasVertexWeights);
                }
            }
        }
Example #4
0
 public NiTextureEffect(NiFile file, BinaryReader reader)
     : base(file, reader)
 {
     ModelProjectionMatrix    = reader.ReadMatrix33();
     ModelProjectionTransform = reader.ReadVector3();
     TextureFiltering         = (eTexFilterMode)reader.ReadUInt32();
     TextureClamping          = (eTexClampMode)reader.ReadUInt32();
     EffectType   = (eEffectType)reader.ReadUInt32();
     CoordGenType = (eCoordGenType)reader.ReadUInt32();
     if (Version <= eNifVersion.VER_3_1)
     {
         throw new Exception("NOT SUPPORTED!");
         //Image = new NiRef<NiImage>(reader);
     }
     if (Version >= eNifVersion.VER_4_0_0_0)
     {
         SourceTexture = new NiRef <NiSourceTexture>(reader);
     }
     ClippingPlane = reader.ReadBoolean();
     unknownVector = new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle());
     Unknown2      = reader.ReadSingle();
     if (File.Header.Version <= eNifVersion.VER_10_2_0_0)
     {
         PS2L = reader.ReadInt16();
         PS2K = reader.ReadInt16();
     }
     if (File.Header.Version <= eNifVersion.VER_4_1_0_12)
     {
         Unknown3 = reader.ReadUInt16();
     }
 }
Example #5
0
 public NiAlphaController(NiFile file, BinaryReader reader)
     : base(file, reader)
 {
     if (File.Header.Version <= eNifVersion.VER_10_1_0_0)
     {
         Data = new NiRef <NiFloatData>(reader);
     }
 }
Example #6
0
 public NiVisController(NiFile file, BinaryReader reader)
     : base(file, reader)
 {
     if (Version <= eNifVersion.VER_10_1_0_0)
     {
         Data = new NiRef <NiVisData>(reader);
     }
 }
Example #7
0
 public NiSingleInterpController(NiFile file, BinaryReader reader)
     : base(file, reader)
 {
     if (Version >= eNifVersion.VER_10_2_0_0)
     {
         Interpolator = new NiRef <NiInterpolator>(reader);
     }
 }
Example #8
0
        public NiAVObject(NiFile file, BinaryReader reader)
            : base(file, reader)
        {
            if (File.Header.Version >= eNifVersion.VER_3_0)
            {
                Flags = reader.ReadUInt16();
            }

            if (File.Header.Version >= eNifVersion.VER_20_2_0_7 && File.Header.UserVersion == 11 && File.Header.UserVersion2 > 26)
            {
                UnkownShort1 = reader.ReadUInt16();
            }

            Translation = reader.ReadVector3();
            Rotation    = reader.ReadMatrix33();
            Scale       = reader.ReadSingle();

            if (File.Header.Version <= eNifVersion.VER_4_2_2_0)
            {
                Velocity = reader.ReadVector3();
            }

            if (File.Header.Version <= eNifVersion.VER_20_2_0_7 || File.Header.UserVersion <= 11)
            {
                var numProperties = reader.ReadUInt32();
                Properties = new NiRef <NiProperty> [numProperties];
                for (var i = 0; i < numProperties; i++)
                {
                    Properties[i] = new NiRef <NiProperty>(reader.ReadUInt32());
                }
            }

            if (File.Header.Version <= eNifVersion.VER_2_3)
            {
                UnkownInts1 = new uint[4];
                for (var i = 0; i < 4; i++)
                {
                    UnkownInts1[i] = reader.ReadUInt32();
                }

                UnkownByte = reader.ReadByte();
            }

            if (File.Header.Version >= eNifVersion.VER_3_0 && File.Header.Version <= eNifVersion.VER_4_2_2_0)
            {
                HasBoundingBox = reader.ReadBoolean();
                if (HasBoundingBox)
                {
                    throw new Exception("Cannot read BoundingBoxes yet");
                }
            }

            if (File.Header.Version >= eNifVersion.VER_10_0_1_0)
            {
                CollisionObject = new NiRef <NiCollisionObject>(reader.ReadUInt32());
            }
        }
Example #9
0
 public NiParticleModifier(NiFile file, BinaryReader reader)
     : base(file, reader)
 {
     Next = new NiRef <NiParticleModifier>(reader);
     if (File.Header.Version >= eNifVersion.VER_4_0_0_2)
     {
         Controller = new NiRef <NiParticleSystemController>(reader);
     }
 }
Example #10
0
        public NiParticleMeshModifier(NiFile file, BinaryReader reader)
            : base(file, reader)
        {
            ParticleMeshes = new NiRef <NiAVObject> [reader.ReadUInt32()];

            for (var i = 0; i < ParticleMeshes.Length; i++)
            {
                ParticleMeshes[i] = new NiRef <NiAVObject>(reader);
            }
        }
Example #11
0
        public NiLookAtController(NiFile file, BinaryReader reader)
            : base(file, reader)
        {
            if (File.Header.Version >= eNifVersion.VER_10_1_0_0)
            {
                Unknown1 = reader.ReadUInt16();
            }

            CameraTargetNode = new NiRef <NiNode>(reader);
        }
Example #12
0
        public NiTextureTransformController(NiFile file, BinaryReader reader)
            : base(file, reader)
        {
            Unkown2     = reader.ReadByte();
            TextureSlot = (eTexType)reader.ReadUInt32();
            Operation   = (eTexTransform)reader.ReadUInt32();

            if (Version <= eNifVersion.VER_10_1_0_0)
            {
                Data = new NiRef <NiFloatData>(reader);
            }
        }
Example #13
0
        public NiPoint3InterpController(NiFile file, BinaryReader reader) : base(file, reader)
        {
            if (Version >= eNifVersion.VER_10_1_0_0)
            {
                TargetColor = (eTargetColor)reader.ReadUInt16();
            }

            if (Version <= eNifVersion.VER_10_1_0_0)
            {
                Data = new NiRef <NiPosData>(reader);
            }
        }
Example #14
0
 public NiExtraData(NiFile file, BinaryReader reader)
     : base(file, reader)
 {
     if (File.Header.Version >= eNifVersion.VER_10_0_1_0)
     {
         Name = new NiString(file, reader);
     }
     if (File.Header.Version <= eNifVersion.VER_4_2_2_0)
     {
         NextExtraData = new NiRef <NiExtraData>(reader.ReadUInt32());
     }
 }
Example #15
0
        public NiFooter(NiFile file, BinaryReader reader)
        {
            if (file.Header.Version >= eNifVersion.VER_3_3_0_13)
            {
                var numRootNodes = reader.ReadUInt32();
                RootNodes = new NiRef <NiObject> [numRootNodes];

                for (var i = 0; i < numRootNodes; i++)
                {
                    RootNodes[i] = new NiRef <NiObject>(reader.ReadUInt32());
                }
            }
        }
Example #16
0
 public NiPathController(NiFile file, BinaryReader reader)
     : base(file, reader)
 {
     if (File.Header.Version >= eNifVersion.VER_10_1_0_0)
     {
         Unknown1 = reader.ReadUInt16();
     }
     Unknown2  = reader.ReadUInt32();
     Unknown3  = reader.ReadSingle();
     Unknown4  = reader.ReadSingle();
     Unknown5  = reader.ReadUInt16();
     PosData   = new NiRef <NiPosData>(reader);
     FloatData = new NiRef <NiFloatData>(reader);
 }
Example #17
0
 public NiNode(NiFile file, BinaryReader reader)
     : base(file, reader)
 {
     Children = new NiRef <NiAVObject> [reader.ReadUInt32()];
     for (var i = 0; i < Children.Length; i++)
     {
         Children[i] = new NiRef <NiAVObject>(reader.ReadUInt32());
     }
     Effects = new NiRef <NiDynamicEffect> [reader.ReadUInt32()];
     for (var i = 0; i < Effects.Length; i++)
     {
         Effects[i] = new NiRef <NiDynamicEffect>(reader.ReadUInt32());
     }
 }
Example #18
0
        public NiSourceTexture(NiFile file, BinaryReader reader)
            : base(file, reader)
        {
            IsStatic = true;

            UseExternal = reader.ReadBoolean();

            if (UseExternal)
            {
                FileName = new NiString(file, reader);

                if (Version >= eNifVersion.VER_10_1_0_0)
                {
                    reader.ReadUInt32();
                }
            }

            if (!UseExternal)
            {
                if (Version <= eNifVersion.VER_10_0_1_0)
                {
                    reader.ReadByte();
                }

                if (Version >= eNifVersion.VER_10_1_0_0)
                {
                    FileName = new NiString(file, reader);
                }

                InternalTexture = new NiRef <ATextureRenderData>(reader);
            }

            PixelLayout = (ePixelLayout)reader.ReadUInt32();
            UseMipmaps  = (eMipMapFormat)reader.ReadUInt32();
            AlphaFormat = (eAlphaFormat)reader.ReadUInt32();
            IsStatic    = reader.ReadBoolean();

            if (Version >= eNifVersion.VER_10_1_0_106)
            {
                DirectRender = reader.ReadBoolean();
            }

            if (Version >= eNifVersion.VER_20_2_0_7)
            {
                PersistentRenderData = reader.ReadBoolean();
            }
        }
Example #19
0
        public NiGeometry(NiFile file, BinaryReader reader)
            : base(file, reader)
        {
            Data = new NiRef <NiGeometryData>(reader);

            if (Version >= eNifVersion.VER_3_3_0_13)
            {
                SkinInstance = new NiRef <NiSkinInstance>(reader);
            }

            if (Version >= eNifVersion.VER_20_2_0_7)
            {
                MaterialNames = new NiString[reader.ReadUInt32()];
                for (var i = 0; i < MaterialNames.Length; i++)
                {
                    MaterialNames[i] = new NiString(file, reader);
                }
                MaterialExtraData = new int[MaterialNames.Length];
                for (var i = 0; i < MaterialNames.Length; i++)
                {
                    MaterialExtraData[i] = reader.ReadInt32();
                }

                ActiveMaterial = reader.ReadInt32();
            }

            if (Version >= eNifVersion.VER_10_0_1_0 &&
                Version <= eNifVersion.VER_20_1_0_3)
            {
                HasShader = reader.ReadBoolean();
                if (HasShader)
                {
                    ShaderName    = new string(reader.ReadChars(reader.ReadInt32()));
                    UnkownInteger = reader.ReadUInt32();
                }
            }

            if (Version == eNifVersion.VER_10_4_0_1)
            {
                reader.ReadUInt32(); //unkown
            }
            if (Version >= eNifVersion.VER_20_2_0_7)
            {
                throw new Exception("unspported data");
            }
        }
Example #20
0
 public NiTimeController(NiFile file, BinaryReader reader)
     : base(file, reader)
 {
     NextController = new NiRef <NiTimeController>(reader);
     Flags          = reader.ReadUInt16();
     Frequency      = reader.ReadSingle();
     Phase          = reader.ReadSingle();
     StartTime      = reader.ReadSingle();
     StopTime       = reader.ReadSingle();
     if (file.Header.Version >= eNifVersion.VER_3_3_0_13)
     {
         Target = new NiRef <NiObjectNET>(reader);
     }
     if (file.Header.Version <= eNifVersion.VER_3_1)
     {
         UnkownInt = reader.ReadUInt32();
     }
 }
Example #21
0
        public NiDynamicEffect(NiFile file, BinaryReader reader)
            : base(file, reader)
        {
            SwitchState = true;

            if (Version >= eNifVersion.VER_10_1_0_106)
            {
                SwitchState = reader.ReadBoolean();
            }

            if (Version <= eNifVersion.VER_4_0_0_2 ||
                Version >= eNifVersion.VER_10_0_1_0)
            {
                AffectedNodes = new NiRef <NiAVObject> [reader.ReadUInt32()];
                for (var i = 0; i < AffectedNodes.Length; i++)
                {
                    AffectedNodes[i] = new NiRef <NiAVObject>(reader);
                }
            }
        }
Example #22
0
        public NiSkinInstance(NiFile file, BinaryReader reader)
            : base(file, reader)
        {
            Data = new NiRef <NiSkinData>(reader);

            if (Version >= eNifVersion.VER_10_2_0_0)
            {
                Partition = new NiRef <NiSkinPartition>(reader);
            }

            SkeletonRoot = new NiRef <NiNode>(reader);

            var numBones = reader.ReadUInt32();

            Bones = new NiRef <NiNode> [numBones];
            for (var i = 0; i < numBones; i++)
            {
                Bones[i] = new NiRef <NiNode>(reader);
            }
        }
Example #23
0
        public TexDesc(NiFile file, BinaryReader reader)
        {
            Source = new NiRef <NiSourceTexture>(reader);

            if (file.Version <= eNifVersion.VER_20_0_0_5)
            {
                ClampMode  = (eTexClampMode)reader.ReadUInt32();
                FilterMode = (eTexFilterMode)reader.ReadUInt32();
            }
            if (file.Version >= eNifVersion.VER_20_1_0_3)
            {
                Flags = reader.ReadUInt16();
            }
            if (file.Version <= eNifVersion.VER_20_0_0_5)
            {
                UVSetIndex = reader.ReadUInt32();
            }
            if (file.Version <= eNifVersion.VER_10_4_0_1)
            {
                PS2L = reader.ReadInt16();
                PS2K = reader.ReadInt16();
            }

            if (file.Version <= eNifVersion.VER_4_1_0_12)
            {
                reader.ReadUInt16();
            }

            if (file.Version >= eNifVersion.VER_10_1_0_0)
            {
                HasTextureTransform = reader.ReadBoolean();
                if (HasTextureTransform)
                {
                    Translation   = reader.ReadVector2();
                    Tiling        = reader.ReadVector2();
                    WRotation     = reader.ReadSingle();
                    TransformType = reader.ReadUInt32();
                    CenterOffset  = reader.ReadVector2();
                }
            }
        }
Example #24
0
        public NiLODNode(NiFile file, BinaryReader reader)
            : base(file, reader)
        {
            if (Version >= eNifVersion.VER_4_0_0_2 &&
                Version <= eNifVersion.VER_10_0_1_0)
            {
                LODCenter = reader.ReadVector3();
            }

            if (Version <= eNifVersion.VER_10_0_1_0)
            {
                var numLODLevels = reader.ReadUInt32();
                LODLevels = new LODRange[numLODLevels];
                for (var i = 0; i < numLODLevels; i++)
                {
                    LODLevels[i] = new LODRange(file, reader);
                }
            }

            if (Version >= eNifVersion.VER_10_0_1_0)
            {
                LODLevelData = new NiRef <NiLODData>(reader);
            }
        }
Example #25
0
        public NiGeomMorpherController(NiFile file, BinaryReader reader)
            : base(file, reader)
        {
            if (Version >= eNifVersion.VER_10_0_1_2)
            {
                ExtraFlags = reader.ReadUInt16();
            }

            if (Version == eNifVersion.VER_10_1_0_106)
            {
                Unknown2 = reader.ReadByte();
            }

            Data         = new NiRef <NiMorphData>(reader);
            AlwaysUpdate = reader.ReadBoolean();

            if (Version >= eNifVersion.VER_10_1_0_106)
            {
                NumInterpolators = reader.ReadUInt32();
            }

            if (Version >= eNifVersion.VER_10_1_0_106 &&
                Version < eNifVersion.VER_20_2_0_7)
            {
                Interpolators = new NiRef <NiInterpolator> [NumInterpolators];
                for (var i = 0; i < NumInterpolators; i++)
                {
                    Interpolators[i] = new NiRef <NiInterpolator>(reader);
                }
            }

            if (Version >= eNifVersion.VER_20_0_0_4)
            {
                throw new Exception("Version too new!");
            }
        }
Example #26
0
 public NiParticleColorModifier(NiFile file, BinaryReader reader)
     : base(file, reader)
 {
     Data = new NiRef <NiColorData>(reader);
 }
Example #27
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);
            }
        }
Example #28
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);
            }
        }
Example #29
0
 public NiUVController(NiFile file, BinaryReader reader)
     : base(file, reader)
 {
     UnkownShort1 = reader.ReadUInt16();
     Data         = new NiRef <NiUVData>(reader);
 }
Example #30
0
 public NiCollisionObject(NiFile file, BinaryReader reader) : base(file, reader)
 {
     Target = new NiRef <NiAVObject>(reader);
 }