예제 #1
0
        public NiAVObject(BinaryReader reader, NiFile file) : base(reader, file)
        {
            Flags = reader.ReadInt16();

            //
            //    Get position
            //
            Position = new NiVector3(reader, file);

            //
            //    Get rotation
            //
            Rotation = new NiMatrix3X3(reader, file);

            //
            //    Get scale
            //
            UniformScale = reader.ReadSingle();

            //
            //    Get properties
            //
            Properties = new int[reader.ReadInt32()];
            for (var i = 0; i < Properties.Length; i++)
            {
                Properties[i] = reader.ReadInt32();
            }

            //
            //    Get collition object
            //
            CollitionObject = reader.ReadUInt32();
        }
예제 #2
0
        public NiQuatTransform(BinaryReader reader, NiFile niFile) : base(reader, niFile)
        {
            Translation = new NiVector3(reader, niFile);

            Rotation = new NiQuaternion(reader, niFile);

            Scale = reader.ReadSingle();
        }
예제 #3
0
        public NiRangeLODData(BinaryReader reader, NiFile niFile) : base(reader, niFile)
        {
            Center = new NiVector3(reader, niFile);

            LevelCount = reader.ReadUInt32();

            Ranges = new NiLODRange[LevelCount];
            for (var i = 0; i < LevelCount; i++)
            {
                Ranges[i] = new NiLODRange(reader, niFile);
            }
        }
예제 #4
0
        public NiBoneData(BinaryReader reader, NiFile niFile, bool hasVertexWeights) : base(reader, niFile)
        {
            Transform = new NiTransform(reader, niFile);

            BoundingSphereOffset = new NiVector3(reader, niFile);

            BoundingSphereRadius = reader.ReadSingle();

            VertexCount = reader.ReadUInt16();

            if (!hasVertexWeights)
            {
                return;
            }
            Weights = new NiBoneVertData[VertexCount];
            for (var i = 0; i < VertexCount; i++)
            {
                Weights[i] = new NiBoneVertData(reader, niFile);
            }
        }
예제 #5
0
        public NiGeometryData(BinaryReader reader, NiFile niFile) : base(reader, niFile)
        {
            if ((int)niFile.Header.NifVersion >= 0x0A020000)
            {
                GroupId = reader.ReadInt32();
            }

            VerticesCount = reader.ReadUInt16();

            if ((int)niFile.Header.NifVersion >= 0x0A010000)
            {
                KeepFlags     = reader.ReadByte();
                CompressFlags = reader.ReadByte();
            }

            HasVertices = new NiBoolean(reader);
            if (HasVertices)
            {
                Vertices = new NiVector3[VerticesCount];
                for (uint i = 0; i < VerticesCount; i++)
                {
                    Vertices[i] = new NiVector3(reader, niFile);
                }
            }

            if ((int)niFile.Header.NifVersion >= 0x0A000100 &&
                !((int)niFile.Header.NifVersion >= 0x14020007 && niFile.Header.UserVersion >= 11))
            {
                NumUvSets = reader.ReadUInt16();
            }

            HasNormals = new NiBoolean(reader);
            if (HasNormals)
            {
                Normals = new NiVector3[VerticesCount];
                for (uint i = 0; i < VerticesCount; i++)
                {
                    Normals[i] = new NiVector3(reader, niFile);
                }
            }

            if ((int)niFile.Header.NifVersion >= 0x0A010000)
            {
                if (HasNormals && (NumUvSets & 61440) != 0)
                {
                    Tangents = new NiVector3[VerticesCount];
                    for (uint i = 0; i < VerticesCount; i++)
                    {
                        Tangents[i] = new NiVector3(reader, niFile);
                    }

                    BitTangents = new NiVector3[VerticesCount];
                    for (uint i = 0; i < VerticesCount; i++)
                    {
                        BitTangents[i] = new NiVector3(reader, niFile);
                    }
                }
            }

            Center = new NiVector3(reader, niFile);
            Radius = reader.ReadSingle();

            HasVertexColors = new NiBoolean(reader);
            if (HasVertexColors)
            {
                VertexColors = new NiColor4[VerticesCount];
                for (uint i = 0; i < VerticesCount; i++)
                {
                    VertexColors[i] = new NiColor4(reader, niFile);
                }
            }

            if ((int)niFile.Header.NifVersion <= 0x04020200)
            {
                NumUvSets = reader.ReadUInt16();
            }

            if ((int)niFile.Header.NifVersion <= 0x04000002)
            {
                HasUv = new NiBoolean(reader);
            }

            Uv = new NiTexCoord[(NumUvSets & 63) | (0 & 1)][];
            for (uint i = 0; i < Uv.Length; i++)
            {
                Uv[i] = new NiTexCoord[VerticesCount];
                for (uint j = 0; j < VerticesCount; j++)
                {
                    Uv[i][j] = new NiTexCoord(reader, niFile);
                }
            }

            if ((int)niFile.Header.NifVersion >= 0x0A000100 && niFile.Header.UserVersion < 12)
            {
                Consistency = (ConsistencyType)reader.ReadUInt16();
            }

            if ((int)niFile.Header.NifVersion >= 0x14000004 && niFile.Header.UserVersion < 12)
            {
                var blockNum = reader.ReadUInt32();
                AdditionData = new NiRef <AbstractAdditionalGeometryData>(niFile, (int)blockNum);
            }
        }
예제 #6
0
        public NiBound(BinaryReader reader, NiFile niFile) : base(reader, niFile)
        {
            Center = new NiVector3(reader, niFile);

            Radius = reader.ReadSingle();
        }
예제 #7
0
        public NiPoint3Interpolator(BinaryReader reader, NiFile niFile) : base(reader, niFile)
        {
            Value = new NiVector3(reader, niFile);

            Data = new NiRef <NiPosData>(niFile, reader.ReadInt32());
        }
예제 #8
0
 public NiTransform(BinaryReader reader, NiFile niFile) : base(reader, niFile)
 {
     Rotation = new NiMatrix3X3(reader, niFile);
     Position = new NiVector3(reader, niFile);
     Scale    = reader.ReadSingle();
 }