aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes
diff options
context:
space:
mode:
authorChien Yang <[email protected]>2004-12-07 00:27:03 +0000
committerChien Yang <[email protected]>2004-12-07 00:27:03 +0000
commit0ca87453d48a8593ab0598994a5ced64f76ee1e2 (patch)
treec56157510e0e72b8a3cb4f6c4f605f66f98ac44a /src/classes
parent88f4841f2ef76098454605b44d2ff7945b917091 (diff)
Fixed issues :
15 - Model Clip planes not correctly set when view changes. 88 - Ambient Lighting corrupted by Mixed-Mode rendering... git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@86 ba19aa83-45c5-6ac9-afd3-db810772062c
Diffstat (limited to 'src/classes')
-rw-r--r--src/classes/share/javax/media/j3d/EnvironmentSet.java123
-rw-r--r--src/classes/share/javax/media/j3d/GraphicsContext3D.java4
2 files changed, 62 insertions, 65 deletions
diff --git a/src/classes/share/javax/media/j3d/EnvironmentSet.java b/src/classes/share/javax/media/j3d/EnvironmentSet.java
index 2083927..309d909 100644
--- a/src/classes/share/javax/media/j3d/EnvironmentSet.java
+++ b/src/classes/share/javax/media/j3d/EnvironmentSet.java
@@ -445,7 +445,6 @@ class EnvironmentSet extends Object implements ObjectUpdate{
if (cv.sceneAmbient.x != sceneAmbient.x ||
cv.sceneAmbient.y != sceneAmbient.y ||
cv.sceneAmbient.z != sceneAmbient.z ) {
-
cv.setSceneAmbient(cv.ctx,
sceneAmbient.x, sceneAmbient.y, sceneAmbient.z);
@@ -483,81 +482,77 @@ class EnvironmentSet extends Object implements ObjectUpdate{
Canvas3D.MODELCLIP_DIRTY);
}
- // across frames
- else if ((cv.canvasDirty & (Canvas3D.LIGHTENABLES_DIRTY|
+ else {
+ // across frames
+ if ((cv.canvasDirty & (Canvas3D.LIGHTENABLES_DIRTY|
Canvas3D.AMBIENTLIGHT_DIRTY|
Canvas3D.FOG_DIRTY|
Canvas3D.MODELCLIP_DIRTY)) != 0) {
+ if ((cv.canvasDirty & Canvas3D.LIGHTENABLES_DIRTY) != 0) {
+ cv.setLightEnables(cv.ctx, enableMask, renderBin.maxLights);
+ cv.enableMask = enableMask;
+ }
- if ((cv.canvasDirty & Canvas3D.LIGHTENABLES_DIRTY) != 0) {
- cv.setLightEnables(cv.ctx, enableMask, renderBin.maxLights);
- cv.enableMask = enableMask;
- }
-
- if ((cv.canvasDirty & Canvas3D.AMBIENTLIGHT_DIRTY) != 0) {
- cv.setSceneAmbient(cv.ctx, sceneAmbient.x,
- sceneAmbient.y,
- sceneAmbient.z);
- cv.sceneAmbient.x = sceneAmbient.x;
- cv.sceneAmbient.y = sceneAmbient.y;
- cv.sceneAmbient.z = sceneAmbient.z;
- }
+ if ((cv.canvasDirty & Canvas3D.AMBIENTLIGHT_DIRTY) != 0) {
+ cv.setSceneAmbient(cv.ctx, sceneAmbient.x,
+ sceneAmbient.y,
+ sceneAmbient.z);
+ cv.sceneAmbient.x = sceneAmbient.x;
+ cv.sceneAmbient.y = sceneAmbient.y;
+ cv.sceneAmbient.z = sceneAmbient.z;
+ }
- if ((cv.canvasDirty & Canvas3D.FOG_DIRTY) != 0) {
- if (fog != null) {
- scale = lightBin.geometryBackground == null?
- cv.canvasViewCache.getVworldToCoexistenceScale():
- cv.canvasViewCache.getInfVworldToCoexistenceScale();
- fog.update(cv.ctx, scale);
- } else {
- cv.disableFog(cv.ctx);
+ if ((cv.canvasDirty & Canvas3D.FOG_DIRTY) != 0) {
+ if (fog != null) {
+ scale = lightBin.geometryBackground == null?
+ cv.canvasViewCache.getVworldToCoexistenceScale():
+ cv.canvasViewCache.getInfVworldToCoexistenceScale();
+ fog.update(cv.ctx, scale);
+ } else {
+ cv.disableFog(cv.ctx);
+ }
+ cv.fog = fog;
}
- cv.fog = fog;
- }
- if ((cv.canvasDirty & Canvas3D.MODELCLIP_DIRTY) != 0) {
- if (modelClip != null) {
- modelClip.update(cv, enableMCMask);
- } else {
- cv.disableModelClip(cv.ctx);
+ if ((cv.canvasDirty & Canvas3D.MODELCLIP_DIRTY) != 0) {
+ if (modelClip != null) {
+ modelClip.update(cv, enableMCMask);
+ } else {
+ cv.disableModelClip(cv.ctx);
+ }
+ cv.modelClip = modelClip;
}
- cv.modelClip = modelClip;
- }
- cv.canvasDirty &= ~(Canvas3D.LIGHTENABLES_DIRTY|
- Canvas3D.AMBIENTLIGHT_DIRTY |
- Canvas3D.FOG_DIRTY |
- Canvas3D.MODELCLIP_DIRTY);
- }
- else if ((cv.canvasDirty & Canvas3D.VWORLD_SCALE_DIRTY) != 0) {
- if (fog instanceof LinearFogRetained) {
- if (fog != null) {
- scale = lightBin.geometryBackground == null?
- cv.canvasViewCache.getVworldToCoexistenceScale():
- cv.canvasViewCache.getInfVworldToCoexistenceScale();
- fog.update(cv.ctx, scale);
- } else {
- cv.disableFog(cv.ctx);
- }
- cv.fog = fog;
+ cv.canvasDirty &= ~(Canvas3D.LIGHTENABLES_DIRTY|
+ Canvas3D.AMBIENTLIGHT_DIRTY |
+ Canvas3D.FOG_DIRTY |
+ Canvas3D.MODELCLIP_DIRTY);
}
- if (modelClip != null) {
- modelClip.update(cv, enableMCMask);
- cv.modelClip = modelClip;
- }
- }
- else if (cv.useStereo) {
-
- // if using stereo, the vworldToEc matrix will be different
+ // Update modelClip and fog if view matrix changed.
+ // Note : If using stereo, the vworldToEc matrix will be different
// for each stereo pass, in this case, we will need to
- // update modelClip
+ // update modelClip and fog.
+
+ if (((cv.canvasDirty & Canvas3D.VWORLD_SCALE_DIRTY) != 0) ||
+ cv.useStereo) {
+ if (fog instanceof LinearFogRetained) {
+ if (fog != null) {
+ scale = lightBin.geometryBackground == null?
+ cv.canvasViewCache.getVworldToCoexistenceScale():
+ cv.canvasViewCache.getInfVworldToCoexistenceScale();
+ fog.update(cv.ctx, scale);
+ } else {
+ cv.disableFog(cv.ctx);
+ }
+ cv.fog = fog;
+ }
- if (modelClip != null) {
- modelClip.update(cv, enableMCMask);
- cv.modelClip = modelClip;
- }
+ if (modelClip != null) {
+ modelClip.update(cv, enableMCMask);
+ cv.modelClip = modelClip;
+ }
+ }
}
- }
-
+ }
}
diff --git a/src/classes/share/javax/media/j3d/GraphicsContext3D.java b/src/classes/share/javax/media/j3d/GraphicsContext3D.java
index e56d0ce..32754ed 100644
--- a/src/classes/share/javax/media/j3d/GraphicsContext3D.java
+++ b/src/classes/share/javax/media/j3d/GraphicsContext3D.java
@@ -2411,10 +2411,12 @@ public class GraphicsContext3D extends Object {
sceneAmbient.z = 1.0f;
}
- canvas3d.canvasDirty |= Canvas3D.AMBIENTLIGHT_DIRTY;
canvas3d.setSceneAmbient(canvas3d.ctx, sceneAmbient.x,
sceneAmbient.y, sceneAmbient.z);
+ canvas3d.canvasDirty |= Canvas3D.AMBIENTLIGHT_DIRTY;
+ canvas3d.sceneAmbient.set(sceneAmbient);
+
if (canvas3d.enableMask != enableMask) {
canvas3d.canvasDirty |= Canvas3D.LIGHTENABLES_DIRTY;
// TODO: 32 => renderBin.maxLights