示例#1
0
 public unsafe DanmakuRenderer(Material material, Mesh mesh)
 {
     propertyBlock     = new MaterialPropertyBlock();
     StructuredBuffers = ComputeBufferPool.GetShared().CreateContext();
     ArgBuffers        = ComputeBufferPool.GetShared(ComputeBufferType.IndirectArguments).CreateContext();
     Material          = material;
     Mesh = mesh;
 }
示例#2
0
 /// <summary>
 /// This function is called when the MonoBehaviour will be destroyed.
 /// </summary>
 void OnDestroy()
 {
     Camera.onPreCull -= RenderBullets;
     foreach (var group in RendererGroups.Values)
     {
         group.Dispose();
     }
     ComputeBufferPool.DisposeShared();
 }
示例#3
0
        public static ComputeBufferPool GetShared(ComputeBufferType type = ComputeBufferType.Default)
        {
            Pools = Pools ?? new Dictionary <ComputeBufferType, ComputeBufferPool>();
            ComputeBufferPool pool;

            if (!Pools.TryGetValue(type, out pool))
            {
                pool = new ComputeBufferPool(type);
                Pools.Add(type, pool);
            }
            return(pool);
        }
示例#4
0
 public Context(ComputeBufferPool pool)
 {
     Pool        = pool;
     usedBuffers = new Queue <ComputeBuffer>();
 }