Beispiel #1
0
        private bool LoadBatches(BinaryReader reader, int size)
        {
            var numBatches = size / SizeCache <Moba> .Size;

            if (numBatches != (mHeader.numBatchesA + mHeader.numBatchesB + mHeader.numBatchesC))
            {
                Log.Error("Group has inconsistent amount of batches.");
                return(false);
            }

            WmoRoot parent;

            if (!mParent.TryGetTarget(out parent))
            {
                Log.Fatal("FATAL ERROR! Parent of WMO group is null!!");
                return(false);
            }

            var batches = reader.ReadArray <Moba>(numBatches);

            for (var i = 0; i < numBatches; ++i)
            {
                var b     = batches[i];
                var batch = new WmoBatch
                {
                    NumIndices = b.numFaces,
                    StartIndex = b.firstFace,
                    MaterialId = b.material,
                    BlendMode  = parent.GetMaterial(b.material).BlendMode,
                };

                mBatches.Add(batch);
            }

            Batches = mBatches.OrderBy(b => b.BlendMode).ToList().AsReadOnly();

            return(true);
        }
Beispiel #2
0
        private bool LoadBatches(BinaryReader reader, int size)
        {
            var numBatches = size / SizeCache<Moba>.Size;
            if (numBatches != (mHeader.numBatchesA + mHeader.numBatchesB + mHeader.numBatchesC))
            {
                Log.Error("Group has inconsistent amount of batches.");
                return false;
            }

            WmoRoot parent;
            if (!mParent.TryGetTarget(out parent))
            {
                Log.Fatal("FATAL ERROR! Parent of WMO group is null!!");
                return false;
            }

            var batches = reader.ReadArray<Moba>(numBatches);
            for (var i = 0; i < numBatches; ++i)
            {
                var b = batches[i];
                var batch = new WmoBatch
                {
                    NumIndices = b.numFaces,
                    StartIndex = b.firstFace,
                    MaterialId = b.material,
                    BlendMode = parent.GetMaterial(b.material).BlendMode,
                };

                mBatches.Add(batch);
            }

            Batches = mBatches.OrderBy(b => b.BlendMode).ToList().AsReadOnly();

            return true;
        }