diff options
author | Kevin Rushforth <[email protected]> | 2007-04-27 15:27:24 +0000 |
---|---|---|
committer | Kevin Rushforth <[email protected]> | 2007-04-27 15:27:24 +0000 |
commit | 4cf7ada56c34832874e12a552df260cd56a0dca2 (patch) | |
tree | 2717b9b4b6fb8279cea1647d32db676bde700b41 /src/classes | |
parent | 2b0c77ca91fb1ed929ed02609855ab1b655d2310 (diff) |
Fixed issue 485: ClassCastException when switching shaders in PhongShadingGLSL example
git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@834 ba19aa83-45c5-6ac9-afd3-db810772062c
Diffstat (limited to 'src/classes')
3 files changed, 18 insertions, 17 deletions
diff --git a/src/classes/share/javax/media/j3d/RenderBin.java b/src/classes/share/javax/media/j3d/RenderBin.java index de373b7..bb17ac8 100644 --- a/src/classes/share/javax/media/j3d/RenderBin.java +++ b/src/classes/share/javax/media/j3d/RenderBin.java @@ -2410,9 +2410,9 @@ class RenderBin extends J3dStructure implements ObjectUpdate { // Issue 471 - Don't check ATTRIBUTE_VALUE_UPDATE, there is no need // to do anything to the shader bins when a value changes. boolean spUpdate = - ((component & ShaderConstants.SHADER_PROGRAM) != 0); + ((component & ShaderAppearanceRetained.SHADER_PROGRAM) != 0); boolean sasUpdate = - (((component & ShaderConstants.SHADER_ATTRIBUTE_SET) != 0) || + (((component & ShaderAppearanceRetained.SHADER_ATTRIBUTE_SET) != 0) || ((component & ShaderConstants.ATTRIBUTE_SET_PUT) != 0) || ((component & ShaderConstants.ATTRIBUTE_SET_REMOVE) != 0) || ((component & ShaderConstants.ATTRIBUTE_SET_CLEAR) != 0)); diff --git a/src/classes/share/javax/media/j3d/ShaderAppearanceRetained.java b/src/classes/share/javax/media/j3d/ShaderAppearanceRetained.java index 992a93c..058a8c8 100644 --- a/src/classes/share/javax/media/j3d/ShaderAppearanceRetained.java +++ b/src/classes/share/javax/media/j3d/ShaderAppearanceRetained.java @@ -23,6 +23,10 @@ import java.util.ArrayList; */ class ShaderAppearanceRetained extends AppearanceRetained { + // Issue 485 - these values must start after the last value in Appearance + static final int SHADER_PROGRAM = 0x0800; + static final int SHADER_ATTRIBUTE_SET = 0x1000; + // // State variables: these should all be initialized to approproate // Java 3D defaults. @@ -53,7 +57,7 @@ class ShaderAppearanceRetained extends AppearanceRetained { ((ShaderProgramRetained)sp.retained).copyMirrorUsers(this); } - sendMessage(ShaderConstants.SHADER_PROGRAM, + sendMessage(SHADER_PROGRAM, (sp != null ? ((ShaderProgramRetained)sp.retained).mirror : null)); } @@ -99,7 +103,7 @@ class ShaderAppearanceRetained extends AppearanceRetained { } // System.err.println(" -- testing needed!"); - sendMessage(ShaderConstants.SHADER_ATTRIBUTE_SET, + sendMessage(SHADER_ATTRIBUTE_SET, (sas != null ? ((ShaderAttributeSetRetained)sas.retained).mirror : null)); @@ -202,13 +206,14 @@ class ShaderAppearanceRetained extends AppearanceRetained { */ synchronized void updateMirrorObject(int component, Object value) { - // System.err.println("ShaderAppearanceRetained : updateMirrorObject() this " + this); +// System.err.println("ShaderAppearanceRetained : updateMirrorObject(): " + +// "this = " + this + " component = " + component + " value = " + value); super.updateMirrorObject(component, value); ShaderAppearanceRetained mirrorApp = (ShaderAppearanceRetained)mirror; - if ((component & ShaderConstants.SHADER_PROGRAM) != 0) { + if ((component & SHADER_PROGRAM) != 0) { mirrorApp.shaderProgram = (ShaderProgramRetained)value; } - else if ((component & ShaderConstants.SHADER_ATTRIBUTE_SET) != 0) { + else if ((component & SHADER_ATTRIBUTE_SET) != 0) { mirrorApp.shaderAttributeSet = (ShaderAttributeSetRetained)value; } @@ -355,9 +360,9 @@ class ShaderAppearanceRetained extends AppearanceRetained { int mask = 0; if (bit == ShaderAppearance.ALLOW_SHADER_PROGRAM_WRITE) - mask = ShaderConstants.SHADER_PROGRAM; + mask = SHADER_PROGRAM; else if (bit == ShaderAppearance.ALLOW_SHADER_ATTRIBUTE_SET_WRITE) - mask = ShaderConstants.SHADER_ATTRIBUTE_SET; + mask = SHADER_ATTRIBUTE_SET; if (mask != 0) diff --git a/src/classes/share/javax/media/j3d/ShaderConstants.java b/src/classes/share/javax/media/j3d/ShaderConstants.java index 7c4a7e4..6abea61 100644 --- a/src/classes/share/javax/media/j3d/ShaderConstants.java +++ b/src/classes/share/javax/media/j3d/ShaderConstants.java @@ -22,17 +22,13 @@ class ShaderConstants extends Object { // The following bits are used in the messages for various Shader objects. // - // ShaderAppearance bits - static final int SHADER_PROGRAM = 0x0001; - static final int SHADER_ATTRIBUTE_SET = 0x0002; - // ShaderAttributeSet bits -- indicates which attribute // operation in this ShaderAttributeSet object is needed. - static final int ATTRIBUTE_SET_PUT = 0x0004; - static final int ATTRIBUTE_SET_REMOVE = 0x0008; - static final int ATTRIBUTE_SET_CLEAR = 0x0010; + static final int ATTRIBUTE_SET_PUT = 0x0001; + static final int ATTRIBUTE_SET_REMOVE = 0x0002; + static final int ATTRIBUTE_SET_CLEAR = 0x0004; // ShaderAttribute bits - static final int ATTRIBUTE_VALUE_UPDATE = 0x0020; + static final int ATTRIBUTE_VALUE_UPDATE = 0x0008; } |