From a6cd0ac1ac0e96d99c6216d1a3450c8e365ceda7 Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Fri, 16 Mar 2007 17:39:46 +0000 Subject: Fixed issue 466: NPE when updating lights with multiple views git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@797 ba19aa83-45c5-6ac9-afd3-db810772062c --- .../share/javax/media/j3d/EnvironmentSet.java | 26 +++++++++++++++------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/classes/share/javax/media/j3d/EnvironmentSet.java b/src/classes/share/javax/media/j3d/EnvironmentSet.java index fedc708..de87968 100644 --- a/src/classes/share/javax/media/j3d/EnvironmentSet.java +++ b/src/classes/share/javax/media/j3d/EnvironmentSet.java @@ -124,7 +124,7 @@ class EnvironmentSet extends Object implements ObjectUpdate{ reset(ra, lightList, fog, modelClip); } - void reset(RenderAtom ra, LightRetained[] lightList, FogRetained fog, + private void reset(RenderAtom ra, LightRetained[] lightList, FogRetained fog, ModelClipRetained modelClip) { int i; LightRetained light; @@ -150,8 +150,6 @@ class EnvironmentSet extends Object implements ObjectUpdate{ else { lights.add(light); } - - light.environmentSets.add(this); } if (sceneAmbient.x > 1.0f) { sceneAmbient.x = 1.0f; @@ -163,16 +161,12 @@ class EnvironmentSet extends Object implements ObjectUpdate{ sceneAmbient.z = 1.0f; } } + this.fog = fog; - if (fog != null) { - fog.environmentSets.add(this); - } this.modelClip = modelClip; enableMCMaskCache = 0; if (modelClip != null) { - modelClip.environmentSets.add(this); - for (i = 0; i < 6; i++) { if (modelClip.enables[i]) enableMCMaskCache |= 1 << i; @@ -183,6 +177,22 @@ class EnvironmentSet extends Object implements ObjectUpdate{ // Allocate the ltPos array ltPos = new int[lights.size()]; enableMask = 0; + + // Issue 466 : add the env set to the light, fog, and model clip + // lists only after the newly constructed env set is initialized + if (lightList != null) { + for (i=0; i