예제 #1
0
        public override void parse(NIFFile file, NIFObject baseo, BinaryReader dis)
        {
            base.parse(file, baseo, dis);
            streamSize  = dis.readInt();
            streamClone = dis.readInt();

            int numRegions = dis.readInt();

            streamRegions = new List <StreamRegion>(numRegions);
            for (int i = 0; i < numRegions; i++)
            {
                streamRegions.Add(new StreamRegion(dis.readInt(), dis.readInt()));
            }
            int numElements = dis.readInt();

            streamElems = new List <NifStreamElement>(numElements);
            elemStride  = 0;
            for (int i = 0; i < numElements; i++)
            {
                int elemData          = dis.readInt();
                NifStreamElement elem = new NifStreamElement((elemData & 0xFF0000) >> 16, (elemData & 0xFF00) >> 8,
                                                             elemData & 0xFF, elemStride);
                elemStride += elem.count * elem.size;
                streamElems.Add(elem);
            }

            streamData = dis.ReadBytes(streamSize);
            streamable = dis.ReadByte() > 0;
        }
예제 #2
0
        public override void parse(NIFFile file, NIFObject baseo, BinaryReader ds)
        {
            base.parse(file, baseo, ds);

            this.flags          = ds.readUnsignedShort();
            this.rootBoneLinkID = loadLinkID(ds);

            m_kRootBoneParentToSkinTransform = NITransform.parse(ds);

            this.m_uiBoneCount = ds.readInt();
            for (int i = 0; i < m_uiBoneCount; i++)
            {
                boneLinkIDs.Add(loadLinkID(ds));
            }
            for (int i = 0; i < m_uiBoneCount; i++)
            {
                m_pkSkinToBoneTransforms.Add(NITransform.parse(ds));
            }
            if ((flags & 2) == 0)
            {
                for (int i = 0; i < m_uiBoneCount; i++)
                {
                    Vector3 center = new Vector3(ds.readFloat(), ds.readFloat(), ds.readFloat());
                    float   rad    = ds.readFloat();
                }
            }
        }
예제 #3
0
        public override void parse(NIFFile file, NIFObject baseo, BinaryReader ds)
        {
            base.parse(file, baseo, ds);

            loadExtraData(file, ds);
            booleanData = ds.ReadBoolean();
        }
예제 #4
0
        public override void parse(NIFFile file, NIFObject baseo, BinaryReader ds)
        {
            base.parse(file, baseo, ds);

            loadExtraData(file, ds);
            intExtraData = ds.readInt();
        }
예제 #5
0
        public override void parse(NIFFile file, NIFObject baseo, BinaryReader ds)
        {
            base.parse(file, baseo, ds);

            m_afValue        = new float[DEGREE + 1];
            this.m_iQuantity = (int)ds.readUInt();
        }
예제 #6
0
        public override void parse(NIFFile file, NIFObject baseo, BinaryReader ds)
        {
            base.parse(file, baseo, ds);

            loadExtraData(file, ds);
            stringExtraData = file.loadString(ds);
        }
예제 #7
0
        public override void parse(NIFFile file, NIFObject baseo, BinaryReader ds)
        {
            base.parse(file, baseo, ds);
            loadAVObject(file, ds);
            childLinks = loadLinkIDs(ds);

            loadLinkIDs(ds);
        }
 public override void parse(NIFFile file, NIFObject baseo, BinaryReader ds)
 {
     base.parse(file, baseo, ds);
     for (int i = 0; i < m_afCompScalars.Length; i++)
     {
         m_afCompScalars[i] = ds.readFloat();
     }
 }
 public override void parse(NIFFile file, NIFObject baseo, BinaryReader ds)
 {
     base.parse(file, baseo, ds);
     this.m_fStartTime    = ds.readFloat();
     this.m_fEndTime      = ds.readFloat();
     this.splineDataIndex = ds.readInt();
     this.basisDataIndex  = ds.readInt();
 }
예제 #10
0
        public override void parse(NIFFile file, NIFObject baseo, BinaryReader ds)
        {
            base.parse(file, baseo, ds);

            loadExtraData(file, ds);
            r = ds.ReadSingle();
            g = ds.ReadSingle();
            b = ds.ReadSingle();
            a = ds.ReadSingle();
        }
예제 #11
0
        public override void parse(NIFFile file, NIFObject baseo, BinaryReader ds)
        {
            base.parse(file, baseo, ds);

            matAmbient       = new Point4f(ds.readFloat(), ds.readFloat(), ds.readFloat(), 1.0f);
            matDiffuse       = new Point4f(ds.readFloat(), ds.readFloat(), ds.readFloat(), 1.0f);
            matSpecular      = new Point4f(ds.readFloat(), ds.readFloat(), ds.readFloat(), 1.0f);
            matEmit          = new Point4f(ds.readFloat(), ds.readFloat(), ds.readFloat(), 1.0f);
            matShine         = ds.readFloat();
            matAlpha         = ds.readFloat();
            hasMaterialProps = true;
        }
        public override void parse(NIFFile file, NIFObject baseo, BinaryReader ds)
        {
            base.parse(file, baseo, ds);
            this.translate = new Vector3(ds.readFloat(), ds.readFloat(), ds.readFloat());
            this.rotate    = new Quaternion(ds.readFloat(), ds.readFloat(), ds.readFloat(), ds.readFloat());
            this.scale     = ds.readFloat();

            // Handles into the NiBSplineData for access to control points
            this.m_kTransCPHandle = ds.readInt();
            this.m_kRotCPHandle   = ds.readInt();
            this.m_kScaleCPHandle = ds.readInt();
        }
예제 #13
0
        public override void parse(NIFFile file, NIFObject baseo, BinaryReader ds)
        {
            base.parse(file, baseo, ds);
            base.loadObjectNET(file, ds);

            texPropFlags = ds.readUnsignedShort();

            int texListSize = ds.readInt();

            texList = new List <NifTexMap>(texListSize);
            for (int i = 0; i < texListSize; i++)
            {
                NifTexMap tex    = null;
                bool      hasMap = ds.readUnsignedByte() > 0;
                if (hasMap)
                {
                    tex = new NifTexMap();
                    tex.parse(file, baseo, ds);
                    if (i == 5)
                    {
                        tex.bumpLumaScale  = ds.readFloat();
                        tex.bumpLumaOffset = ds.readFloat();
                        tex.bumpMap        = new Point4f(ds.readFloat(), ds.readFloat(), ds.readFloat(), ds.readFloat());
                    }
                    else if (i == 7)
                    {
                        tex.offsetMapOfs = ds.readFloat();
                    }
                }
                else
                {
                    tex = null;
                }
                texList.Add(tex);
            }

            int shaderMapListSize = ds.readInt();

            shaderMapList = new List <NifTexMap>(shaderMapListSize);
            for (int i = 0; i < shaderMapListSize; i++)
            {
                NifTexMap tex    = null;
                bool      hasMap = ds.readUnsignedByte() > 0;
                if (hasMap)
                {
                    tex = new NifTexMap();
                    tex.parse(file, baseo, ds);
                    tex.uniqueID = ds.readInt();
                }
                shaderMapList.Add(tex);
            }
        }
        public override void parse(NIFFile file, NIFObject baseo, BinaryReader ds)
        {
            base.parse(file, baseo, ds);

            this.m_kAVObjectName = ds.readInt();
            this.m_kPropertyType = ds.readInt();
            this.m_kCtlrType     = ds.readInt();
            this.m_kCtlrID       = ds.readInt();
            this.m_kEvaluatorID  = ds.readInt();

            this.m_usSmallHashTableValue = ds.readUnsignedShort();
            this.m_usLargeHashTableValue = ds.readUnsignedShort();
        }
예제 #15
0
        public override void parse(NIFFile file, NIFObject baseo, BinaryReader ds)
        {
            base.parse(file, baseo, ds);
            this.seqName = file.loadString(ds);
            var numEval = ds.readUInt();

            this.seqEvalIDList = new List <uint>();
            for (int i = 0; i < numEval; i++)
            {
                this.seqEvalIDList.Add(ds.readUInt());
            }
            file.addSequence(this);
        }
예제 #16
0
        public override void parse(NIFFile file, NIFObject baseo, BinaryReader ds)
        {
            base.parse(file, baseo, ds);

            loadExtraData(file, ds);

            int floats = ds.readInt();

            floatData = new float[floats];
            for (int i = 0; i < floats; i++)
            {
                floatData[i] = ds.readFloat();
            }
        }
예제 #17
0
        public override void parse(NIFFile file, NIFObject baseo, BinaryReader ds)
        {
            base.parse(file, baseo, ds);

            loadExtraData(file, ds);
            binaryDataSize = ds.readInt();
            if (binaryDataSize > 0)
            {
                extraData = ds.ReadBytes(binaryDataSize);

                loadThread          = new System.Threading.Thread(new System.Threading.ThreadStart(tryDecompress));
                loadThread.Priority = System.Threading.ThreadPriority.Lowest;
                loadThread.Start();
            }
        }
예제 #18
0
        public override void parse(NIFFile file, NIFObject baseo, BinaryReader ds)
        {
            base.parse(file, baseo, ds);
            uint uiSyncCount = ds.readUInt();

            for (int i = 0; i < uiSyncCount; i++)
            {
                m_kSubmitPoints.Add(ds.readUnsignedShort());
            }
            uiSyncCount = ds.readUInt();
            for (int i = 0; i < uiSyncCount; i++)
            {
                m_kCompletePoints.Add(ds.readUnsignedShort());
            }
        }
예제 #19
0
        internal NiTexturingProperty getTexturingProperty(NIFFile nf)
        {
            List <int> propIDs = nodePropertyIDs;

            foreach (int propID in propIDs)
            {
                NIFObject obj = nf.getObject(propID);
                if (obj is NiTexturingProperty)
                {
                    NiTexturingProperty propObj = (NiTexturingProperty)obj;
                    return(propObj);
                }
            }
            return(null);
        }
예제 #20
0
        //C5.HashDictionary<int, List<NIFObject>> childrenLists = new C5.HashDictionary<int, List<NIFObject>>();

        /*
         * void prepChildrenLists()
         * {
         *  foreach(NIFObject obj in getObjects())
         *  {
         *      int p = obj.parentIndex;
         *      List<NIFObject> children;
         *      if (!childrenLists.Contains(p))
         *      {
         *          children = new List<NIFObject>();
         *          childrenLists.Add(p, children);
         *      }
         *      else
         *          children = childrenLists[p];
         *      children.Add(obj);
         *  }
         * }
         */
        public void forEachChildNode(int parentIndex, Action <NiNode> action)
        {
            if (objCache == null)
            {
                getObjects();
            }

            for (int i = 0; i < objCache.Count; i++)
            {
                NIFObject obj = objCache[i];
                if (obj.parentIndex == parentIndex && obj is NiNode)
                {
                    action.Invoke((NiNode)obj);
                }
            }
        }
예제 #21
0
        public void parse(NIFFile file, NIFObject baseo, BinaryReader ds)
        {
            sourceTexLinkID = ds.readInt();
            flags           = ds.readUnsignedShort();
            maxAniso        = ds.readUnsignedShort();
            hasTransform    = ds.readUnsignedByte() > 0;
            if (hasTransform)

            {
                translation = new Point3f(ds.readFloat(), ds.readFloat(), ds.readFloat());
                scale       = ds.readFloat();
                rotate      = ds.readFloat();
                method      = ds.readInt();
                center      = new Point2f(ds.readFloat(), ds.readFloat());
            }
        }
예제 #22
0
        public override void parse(NIFFile file, NIFObject baseo, BinaryReader ds)
        {
            base.parse(file, baseo, ds);

            this.controlPointCount = ds.readUInt();
            this.controlPoints     = new float[this.controlPointCount];

            for (int i = 0; i < controlPointCount; i++)
            {
                controlPoints[i] = ds.readFloat();
            }

            this.compactControlPointCount = ds.readUInt();
            this.compactControlPoints     = new short[compactControlPointCount];
            for (int i = 0; i < compactControlPointCount; i++)
            {
                compactControlPoints[i] = ds.ReadInt16();
            }
        }
예제 #23
0
        public override void parse(NIFFile file, NIFObject baseo, BinaryReader ds)
        {
            base.parse(file, baseo, ds);

            loadObjectNET(file, ds);

            externalTex = ds.readUnsignedByte() > 0;
            texFilename = file.loadString(ds);
            pixLinkID   = ds.readInt();
            mipMapped   = ds.readInt();
            alphaFormat = ds.readInt();
            texStatic   = ds.readUnsignedByte() > 0;

            int unk1 = ds.readUnsignedByte();
            int unk2 = ds.readUnsignedByte();

            texIndex = -1;
            file.addTexture(this);
        }
예제 #24
0
        public override void parse(NIFFile file, NIFObject baseo, BinaryReader ds)
        {
            base.parse(file, baseo, ds);

            loadRenderable(file, ds);
            meshPrimType  = ds.readInt();
            numSubMeshes  = ds.readUnsignedShort();
            isInstanced   = ds.readUnsignedByte() > 0;
            boundsCenter  = new Point3f(ds.readFloat(), ds.readFloat(), ds.readFloat());
            boundsRad     = ds.readFloat();
            numStreamRefs = ds.readInt();
            streamRefs    = new List <NifMeshStream>();

            for (int i = 0; i < numStreamRefs; i++)
            {
                NifMeshStream meshStream = new NifMeshStream();
                meshStream.parse(file, baseo, ds);
                streamRefs.Add(meshStream);
            }

            modLinks = loadLinkIDs(ds);
            file.addMesh(this);
        }
예제 #25
0
        public void parse(NIFFile file, NIFObject baseo, BinaryReader ds)
        {
            streamLinkID = ds.readInt();
            instanced    = ds.readUnsignedByte() > 0;

            int numStreamSubmeshRegionMapEntries = ds.readUnsignedShort();

            submeshRegionMap = new List <int>(numStreamSubmeshRegionMapEntries);
            for (int i = 0; i < numStreamSubmeshRegionMapEntries; i++)
            {
                submeshRegionMap.Add(ds.readUnsignedShort());
            }
            int numElementDescs = ds.readInt();

            elementDescs = new List <Pair <String, int> >(numElementDescs);
            for (int i = 0; i < numElementDescs; i++)
            {
                int    descNameIndex = ds.readInt();
                String descName      = file.getStringFromTable(descNameIndex);
                int    descIndex     = ds.readInt();
                elementDescs.Add(NIF.Pair <String, int> .of(descName, descIndex));
            }
        }
예제 #26
0
        private void loadObjects(BinaryReader dis)
        {
            for (int i = 0; i < numObjects; i++)
            {
                NIFObject obj = objects[i];
                obj.index = i;
                String typeName = obj.typeName;
                int    size     = obj.nifSize;
                byte[] data;
                String cName = "Assets.NIF." + typeName;

                try
                {
                    long pos = dis.BaseStream.Position;
                    data = dis.ReadBytes(size);

                    if (notImplementedMap.ContainsKey(typeName))
                    {
                        continue;
                    }

                    using (BinaryReader ds = new BinaryReader(new MemoryStream(data, false)))
                    {
                        if (typeName.StartsWith("NiDataStream"))
                        {
                            NiDataStream newObj = new NiDataStream();
                            newObj.parse(this, obj, ds);
                            objects[i] = newObj;
                        }
                        else
                        {
                            NIFObject newObj;

                            //if (typeName.Contains("Eval"))
                            //Debug.Log("[" + i + "]: type[" + typeName + "] @ " + pos);
                            if (typeCacheC.ContainsKey(typeName))
                            {
                                newObj = (NIFObject)typeCacheC[typeName].Invoke();
                            }
                            else
                            {
                                // Debug.LogWarning("[PERFORMANCE WARNING] using activator for " + typeName);
                                Type t = Type.GetType(cName);
                                if (t == null)
                                {
                                    notImplementedMap[typeName] = true;
                                    continue;
                                }
                                else
                                {
                                    newObj = (NIFObject)Activator.CreateInstance(t);
                                }
                            }

                            objects[i] = newObj;

                            try
                            {
                                newObj.parse(this, obj, ds);
                            }
                            catch (Exception ex)
                            {
                                Debug.Log(ex);
                            }
                        }
                    }
                    //Debug.Log("[" + i + "]: " + objects[i].GetType());
                } catch (Exception ex)
                {
                    Debug.Log(typeName + ":" + ex);
                    //Debug.Log("Unhandled nif type:" + typeName + " due to exception:" + ex.Message + " :data size:" + obj.nifSize);
                    notImplementedMap[typeName] = true;
                    continue;
                }
            }

            setParents();
        }
예제 #27
0
 public virtual void parse(NIFFile file, NIFObject baseo, BinaryReader dis)
 {
     nifSize  = baseo.nifSize;
     typeName = baseo.typeName;
     index    = baseo.index;
 }
예제 #28
0
 internal void addChild(NIFObject nIFObject)
 {
     children.Add(nIFObject);
 }
예제 #29
0
 public override void parse(NIFFile file, NIFObject baseo, BinaryReader ds)
 {
     base.parse(file, baseo, ds);
 }