Exemple #1
0
        public void UpdatePointLights(List <PointLight> lights)
        {
            var lightData = _lightDataMapper.GetPointLightData(lights, maxNumOfPointLights);

            if (lightsBuffer.Size < lightData.TotalSizeInBytes)
            {
                lightsBuffer.Resize(lightData.TotalSizeInBytes);
            }

            lightsBuffer.UpdateData(0, Marshal.SizeOf <LightAdditionalInfo>(), ref lightData.AdditionalInfo);
            lightsBuffer.UpdateData(Marshal.OffsetOf(typeof(CompletePointLightData), "LightData").ToInt32(), Marshal.SizeOf <PointLightData>() * lightData.LightData.Length, lightData.LightData);
            lightsBuffer.Bind();
        }