示例#1
0
    protected override void CreateData()
    {
        var data = new ParticleData[Count];

        if (_pastData != null)
        {
            if (Count <= _pastData.Length)
            {
                System.Array.Copy(_pastData, 0, data, 0, data.Length);
            }
            else
            {
                System.Array.Copy(_pastData, 0, data, 0, _pastData.Length);
                for (var i = _pastData.Length; i < data.Length; i++)
                {
                    data[i] = _defaultData;
                }
                _pastData = data;
            }
        }
        else
        {
            for (var i = 0; i < data.Length; i++)
            {
                data[i] = _defaultData;
            }
            _pastData = data;
        }

        MyGpuBuffer.SetData(data);
    }
示例#2
0
    protected override void CreateData()
    {
        DistanceData[] DistanceData = new DistanceData[Count];
        for (int i = 0; i < DistanceData.Length; i++)
        {
            DistanceData[i]          = new DistanceData();
            DistanceData[i].Index    = i;
            DistanceData[i].Distance = 0f;
        }

        MyGpuBuffer.SetData(DistanceData);
    }