Exemple #1
0
 BatchPool GetPool(Guid brushGuid)
 {
     try {
         return(m_BrushToPool[brushGuid]);
     } catch (KeyNotFoundException) {
         BatchPool rNewPool = new BatchPool(this);
         rNewPool.m_BrushGuid = brushGuid;
         rNewPool.m_Batches   = new List <Batch>();
         Batch b = Batch.Create(rNewPool, m_ParentTransform, m_MeshBounds);
         sm_BatchMap.Add(b.BatchId, b);
         m_Pools.Add(rNewPool);
         m_BrushToPool[rNewPool.m_BrushGuid] = rNewPool;
         foreach (string keyword in m_MaterialKeywords)
         {
             b.InstantiatedMaterial.EnableKeyword(keyword);
         }
         return(rNewPool);
     }
 }
Exemple #2
0
        // Returns a batch such that it has space for at least nVerts
        Batch GetBatch(BatchPool pool, int nVerts)
        {
            if (pool.m_Batches.Count > 0)
            {
                var batch = pool.m_Batches[pool.m_Batches.Count - 1];
                if (batch.HasSpaceFor(nVerts))
                {
                    return(batch);
                }
            }

            {
                Batch b = Batch.Create(pool, m_ParentTransform, m_MeshBounds);
                sm_BatchMap.Add(b.BatchId, b);
                foreach (string keyword in m_MaterialKeywords)
                {
                    b.InstantiatedMaterial.EnableKeyword(keyword);
                }
                Debug.Assert(pool.m_Batches[pool.m_Batches.Count - 1] == b);
                return(b);
            }
        }