Skip to content

Commit 6ddd5a6

Browse files
Bursted shadow request fixes and changes from trunk (#106)
* Some changes from trunk PR * Change mathematics package ref back to what it was
1 parent 5a29009 commit 6ddd5a6

17 files changed

+1514
-1803
lines changed

com.unity.render-pipelines.high-definition/Runtime/Lighting/Light/HDAdditionalLightData.Types.cs

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -214,13 +214,7 @@ internal enum PointLightHDType
214214
internal PointLightHDType pointLightHDType
215215
{
216216
get => m_PointlightHDType;
217-
set
218-
{
219-
if (lightEntity.valid)
220-
{
221-
HDLightRenderDatabase.instance.GetShadowRequestUpdateInfoAsRef(lightEntity).pointLightHDType = m_PointlightHDType;
222-
}
223-
}
217+
set => HDLightRenderDatabase.instance.SetPointLightType(lightEntity, m_PointlightHDType);
224218
}
225219

226220
// Only for Spotlight, should be hide for other light
@@ -256,17 +250,17 @@ public HDLightType type
256250
case HDLightType.Directional:
257251
legacyLight.type = LightType.Directional;
258252
m_PointlightHDType = PointLightHDType.Punctual;
259-
HDLightRenderDatabase.instance.EditLightDataAsRef(lightEntity).pointLightType = m_PointlightHDType;
253+
HDLightRenderDatabase.instance.SetPointLightType(lightEntity, m_PointlightHDType);
260254
break;
261255
case HDLightType.Spot:
262256
legacyLight.type = LightType.Spot;
263257
m_PointlightHDType = PointLightHDType.Punctual;
264-
HDLightRenderDatabase.instance.EditLightDataAsRef(lightEntity).pointLightType = m_PointlightHDType;
258+
HDLightRenderDatabase.instance.SetPointLightType(lightEntity, m_PointlightHDType);
265259
break;
266260
case HDLightType.Point:
267261
legacyLight.type = LightType.Point;
268262
m_PointlightHDType = PointLightHDType.Punctual;
269-
HDLightRenderDatabase.instance.EditLightDataAsRef(lightEntity).pointLightType = m_PointlightHDType;
263+
HDLightRenderDatabase.instance.SetPointLightType(lightEntity, m_PointlightHDType);
270264
break;
271265
case HDLightType.Area:
272266
ResolveAreaShape();
@@ -302,15 +296,13 @@ public SpotLightShape spotLightShape
302296
return;
303297

304298
m_SpotLightShape = value;
305-
HDLightRenderDatabase.instance.EditLightDataAsRef(lightEntity).spotLightShape = m_SpotLightShape;
299+
HDLightRenderDatabase.instance.SetSpotLightShape(lightEntity, m_SpotLightShape);
306300

307301
// If the current light unit is not supported by this spot light shape, we change it
308302
var supportedUnits = GetSupportedLightUnits(type, value);
309303
if (!supportedUnits.Any(u => u == lightUnit))
310304
lightUnit = supportedUnits.First();
311305
UpdateAllLightValues();
312-
313-
HDLightRenderDatabase.instance.GetShadowRequestUpdateInfoAsRef(lightEntity).spotLightShape = m_SpotLightShape;
314306
}
315307
}
316308

@@ -326,20 +318,21 @@ public AreaLightShape areaLightShape
326318
return;
327319

328320
m_AreaLightShape = value;
329-
HDLightRenderDatabase.instance.EditLightDataAsRef(lightEntity).areaLightShape = m_AreaLightShape;
321+
HDLightRenderDatabase.instance.SetAreaLightShape(lightEntity, m_AreaLightShape);
330322

331323
if (type == HDLightType.Area)
332324
ResolveAreaShape();
333325
UpdateAllLightValues();
334326

335-
HDLightRenderDatabase.instance.GetShadowRequestUpdateInfoAsRef(lightEntity).areaLightShape = m_AreaLightShape;
327+
336328
}
337329
}
338330

339331
void ResolveAreaShape()
340332
{
341333
m_PointlightHDType = PointLightHDType.Area;
342-
HDLightRenderDatabase.instance.EditLightDataAsRef(lightEntity).pointLightType = m_PointlightHDType;
334+
HDLightRenderDatabase.instance.SetPointLightType(lightEntity, m_PointlightHDType);
335+
343336
if (areaLightShape == AreaLightShape.Disc)
344337
{
345338
legacyLight.type = LightType.Disc;
@@ -526,7 +519,7 @@ internal HDLightType ComputeLightType(Light attachedLight)
526519
{
527520
legacyLight.type = LightType.Point;
528521
m_PointlightHDType = PointLightHDType.Area;
529-
HDLightRenderDatabase.instance.EditLightDataAsRef(lightEntity).pointLightType = m_PointlightHDType;
522+
HDLightRenderDatabase.instance.SetPointLightType(lightEntity, m_PointlightHDType);
530523

531524
m_AreaLightShape = AreaLightShape.Rectangle;
532525

0 commit comments

Comments
 (0)