Exemplo n.º 1
0
    void DispatchTrailKernel(int i)
    {
        if (!enabled || !m_pw.enabled || Time.deltaTime == 0.0f)
        {
            return;
        }

        m_tmp_params[0].delta_time      = Time.deltaTime;
        m_tmp_params[0].max_entities    = m_max_entities;
        m_tmp_params[0].max_history     = m_trail_max_history;
        m_tmp_params[0].camera_position = Camera.current != null ? Camera.current.transform.position : Vector3.zero;
        m_tmp_params[0].width           = m_width;
        m_buf_trail_params.SetData(m_tmp_params);

        m_cs_trail.SetBuffer(i, "particles", m_pw.GetParticleBuffer());
        m_cs_trail.SetBuffer(i, "params", m_buf_trail_params);
        m_cs_trail.SetBuffer(i, "entities", m_buf_trail_entities);
        m_cs_trail.SetBuffer(i, "history", m_buf_trail_history);
        m_cs_trail.SetBuffer(i, "vertices", m_buf_trail_vertices);
        m_cs_trail.Dispatch(i, m_pw.m_max_particles / BLOCK_SIZE, 1, 1);
    }