Skip to content

Commit af0ca64

Browse files
christopherreddenEvergreen
authored andcommitted
Light GI EntityId changes from U7
1 parent 723f945 commit af0ca64

2 files changed

Lines changed: 25 additions & 25 deletions

File tree

Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/GlobalIlluminationUtils.cs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public static bool LightDataGIExtract(Light light, ref LightDataGI lightDataGI)
1515

1616
Cookie cookie;
1717
LightmapperUtils.Extract(light, out cookie);
18-
lightDataGI.cookieID = cookie.instanceID;
18+
lightDataGI.cookieTextureEntityId = cookie.entityId;
1919
lightDataGI.cookieScale = cookie.scale;
2020

2121
Color cct = new Color(1.0f, 1.0f, 1.0f);
@@ -34,7 +34,7 @@ public static bool LightDataGIExtract(Light light, ref LightDataGI lightDataGI)
3434
if (lightMode == LightMode.Realtime || lightMode == LightMode.Mixed)
3535
lightDimmer = add.lightDimmer;
3636

37-
lightDataGI.instanceID = light.GetInstanceID();
37+
lightDataGI.entityId = light.GetEntityId();
3838
LinearColor directColor, indirectColor;
3939
directColor = add.affectDiffuse ? LinearColor.Convert(light.color, light.intensity) : LinearColor.Black();
4040
directColor.red *= cct.r;
@@ -112,7 +112,7 @@ public static bool LightDataGIExtract(Light light, ref LightDataGI lightDataGI)
112112
case LightType.Spot:
113113
{
114114
SpotLight spot;
115-
spot.instanceID = light.GetInstanceID();
115+
spot.entityId = light.GetEntityId();
116116
spot.shadow = light.shadows != LightShadows.None;
117117
spot.mode = lightMode;
118118
#if UNITY_EDITOR
@@ -132,18 +132,18 @@ public static bool LightDataGIExtract(Light light, ref LightDataGI lightDataGI)
132132
lightDataGI.Init(ref spot, ref cookie);
133133
lightDataGI.shape1 = (float)AngularFalloffType.AnalyticAndInnerAngle;
134134
if (light.cookie != null)
135-
lightDataGI.cookieID = light.cookie.GetInstanceID();
135+
lightDataGI.cookieTextureEntityId = light.cookie.GetEntityId();
136136
else if (add.IESSpot != null)
137-
lightDataGI.cookieID = add.IESSpot.GetInstanceID();
137+
lightDataGI.cookieTextureEntityId = add.IESSpot.GetEntityId();
138138
else
139-
lightDataGI.cookieID = 0;
139+
lightDataGI.cookieTextureEntityId = EntityId.None;
140140
}
141141
break;
142142

143143
case LightType.Pyramid:
144144
{
145145
SpotLightPyramidShape pyramid;
146-
pyramid.instanceID = light.GetInstanceID();
146+
pyramid.entityId = light.GetEntityId();
147147
pyramid.shadow = light.shadows != LightShadows.None;
148148
pyramid.mode = lightMode;
149149
pyramid.position = light.transform.position;
@@ -156,18 +156,18 @@ public static bool LightDataGIExtract(Light light, ref LightDataGI lightDataGI)
156156
pyramid.falloff = add.applyRangeAttenuation ? FalloffType.InverseSquared : FalloffType.InverseSquaredNoRangeAttenuation;
157157
lightDataGI.Init(ref pyramid, ref cookie);
158158
if (light.cookie != null)
159-
lightDataGI.cookieID = light.cookie.GetInstanceID();
159+
lightDataGI.cookieTextureEntityId = light.cookie.GetEntityId();
160160
else if (add.IESSpot != null)
161-
lightDataGI.cookieID = add.IESSpot.GetInstanceID();
161+
lightDataGI.cookieTextureEntityId = add.IESSpot.GetEntityId();
162162
else
163-
lightDataGI.cookieID = 0;
163+
lightDataGI.cookieTextureEntityId = EntityId.None;
164164
}
165165
break;
166166

167167
case LightType.Box:
168168
{
169169
SpotLightBoxShape box;
170-
box.instanceID = light.GetInstanceID();
170+
box.entityId = light.GetEntityId();
171171
box.shadow = light.shadows != LightShadows.None;
172172
box.mode = lightMode;
173173
box.position = light.transform.position;
@@ -179,11 +179,11 @@ public static bool LightDataGIExtract(Light light, ref LightDataGI lightDataGI)
179179
box.height = add.shapeHeight;
180180
lightDataGI.Init(ref box, ref cookie);
181181
if (light.cookie != null)
182-
lightDataGI.cookieID = light.cookie.GetInstanceID();
182+
lightDataGI.cookieTextureEntityId = light.cookie.GetEntityId();
183183
else if (add.IESSpot != null)
184-
lightDataGI.cookieID = add.IESSpot.GetInstanceID();
184+
lightDataGI.cookieTextureEntityId = add.IESSpot.GetEntityId();
185185
else
186-
lightDataGI.cookieID = 0;
186+
lightDataGI.cookieTextureEntityId = EntityId.None;
187187
}
188188
break;
189189

@@ -222,17 +222,17 @@ public static bool LightDataGIExtract(Light light, ref LightDataGI lightDataGI)
222222
lightDataGI.type = UnityEngine.Experimental.GlobalIllumination.LightType.Rectangle;
223223
lightDataGI.falloff = add.applyRangeAttenuation ? FalloffType.InverseSquared : FalloffType.InverseSquaredNoRangeAttenuation;
224224
if (add.areaLightCookie != null)
225-
lightDataGI.cookieID = add.areaLightCookie.GetInstanceID();
225+
lightDataGI.cookieTextureEntityId = add.areaLightCookie.GetEntityId();
226226
else if (add.IESSpot != null)
227-
lightDataGI.cookieID = add.IESSpot.GetInstanceID();
227+
lightDataGI.cookieTextureEntityId = add.IESSpot.GetEntityId();
228228
else
229-
lightDataGI.cookieID = 0;
229+
lightDataGI.cookieTextureEntityId = EntityId.None;
230230
}
231231
break;
232232

233233
case LightType.Tube:
234234
{
235-
lightDataGI.InitNoBake(lightDataGI.instanceID);
235+
lightDataGI.InitNoBake(lightDataGI.entityId);
236236
}
237237
break;
238238

@@ -249,7 +249,7 @@ public static bool LightDataGIExtract(Light light, ref LightDataGI lightDataGI)
249249
// TEMP: for now, if we bake a rectangle type this will disable the light for runtime, need to speak with GI team about it!
250250
lightDataGI.type = UnityEngine.Experimental.GlobalIllumination.LightType.Disc;
251251
lightDataGI.falloff = add.applyRangeAttenuation ? FalloffType.InverseSquared : FalloffType.InverseSquaredNoRangeAttenuation;
252-
lightDataGI.cookieID = add.areaLightCookie ? add.areaLightCookie.GetInstanceID() : 0;
252+
lightDataGI.cookieTextureEntityId = add.areaLightCookie ? add.areaLightCookie.GetEntityId() : EntityId.None;
253253
}
254254
break;
255255

@@ -280,7 +280,7 @@ public static bool LightDataGIExtract(Light light, ref LightDataGI lightDataGI)
280280
if (LightmapperUtils.Extract(light.bakingOutput.lightmapBakeType) == LightMode.Realtime)
281281
LightDataGIExtract(light, ref lightDataGI);
282282
else
283-
lightDataGI.InitNoBake(light.GetInstanceID());
283+
lightDataGI.InitNoBake(light.GetEntityId());
284284
#endif
285285

286286
lightsOutput[i] = lightDataGI;

Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipelineCore.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,7 +1676,7 @@ internal static RenderTextureDescriptor CreateRenderTextureDescriptor(Camera cam
16761676
lightData.Init(ref discLight);
16771677
break;
16781678
default:
1679-
lightData.InitNoBake(light.GetInstanceID());
1679+
lightData.InitNoBake(light.GetEntityId());
16801680
break;
16811681
}
16821682

@@ -1690,7 +1690,7 @@ internal static RenderTextureDescriptor CreateRenderTextureDescriptor(Camera cam
16901690
for (int i = 0; i < requests.Length; i++)
16911691
{
16921692
Light light = requests[i];
1693-
lightData.InitNoBake(light.GetInstanceID());
1693+
lightData.InitNoBake(light.GetEntityId());
16941694
lightsOutput[i] = lightData;
16951695
}
16961696
}
@@ -1720,14 +1720,14 @@ internal static RenderTextureDescriptor CreateRenderTextureDescriptor(Camera cam
17201720
break;
17211721
case LightType.Rectangle:
17221722
// Rect area light is baked only in URP.
1723-
lightData.InitNoBake(light.GetInstanceID());
1723+
lightData.InitNoBake(light.GetEntityId());
17241724
break;
17251725
case LightType.Disc:
17261726
// Disc light is baked only.
1727-
lightData.InitNoBake(light.GetInstanceID());
1727+
lightData.InitNoBake(light.GetEntityId());
17281728
break;
17291729
default:
1730-
lightData.InitNoBake(light.GetInstanceID());
1730+
lightData.InitNoBake(light.GetEntityId());
17311731
break;
17321732
}
17331733
lightData.falloff = FalloffType.InverseSquared;

0 commit comments

Comments
 (0)