aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Rushforth <[email protected]>2007-03-16 17:39:46 +0000
committerKevin Rushforth <[email protected]>2007-03-16 17:39:46 +0000
commita6cd0ac1ac0e96d99c6216d1a3450c8e365ceda7 (patch)
tree5d0909ed700af5c67fd4286567a03dda6c160448
parent7cf07413d825903f5c3f3c20858fe0432f89c88b (diff)
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
-rw-r--r--src/classes/share/javax/media/j3d/EnvironmentSet.java26
1 files changed, 18 insertions, 8 deletions
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<lightList.length; i++) {
+ lightList[i].environmentSets.add(this);
+ }
+ }
+
+ if (fog != null) {
+ fog.environmentSets.add(this);
+ }
+
+ if (modelClip != null) {
+ modelClip.environmentSets.add(this);
+ }
}
/**