Skip to content

Commit a0e160c

Browse files
committed
Fix Cycle crash for light cones
1 parent a687981 commit a0e160c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Source/RunActivity/Viewer3D/Lights.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,12 @@ public override void Draw(GraphicsDevice graphicsDevice)
891891

892892
protected override void UpdateStates(int stateIndex1, int stateIndex2)
893893
{
894+
// Cycling light: state index will be set above actual number of states
895+
if (stateIndex1 >= Light.States.Count)
896+
stateIndex1 = StateCount - stateIndex1;
897+
if (stateIndex2 >= Light.States.Count)
898+
stateIndex2 = StateCount - stateIndex2;
899+
894900
var state1 = Light.States[stateIndex1];
895901
var state2 = Light.States[stateIndex2];
896902

0 commit comments

Comments
 (0)