diff options
author | phil <[email protected]> | 2016-10-17 13:44:25 +1300 |
---|---|---|
committer | phil <[email protected]> | 2016-10-17 13:44:25 +1300 |
commit | 4ec9d51462930586ea29d040dd68c3e5b8de1847 (patch) | |
tree | bd84690125cb37d1b0d8b97140b6654330796e30 /src | |
parent | b0baf72761a6a517cc7916905051524d23c2a28d (diff) |
reversed out the SceneGraphObject package visibility for capabilities
This was a performance improvement for Android JVM, which is not
required for the core
Also removed the comments on how to convert from the jogl2es2context
class
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/jogamp/java3d/Jogl2es2Context.java | 31 | ||||
-rw-r--r-- | src/main/java/org/jogamp/java3d/Jogl2es2Pipeline.java | 36 | ||||
-rw-r--r-- | src/main/java/org/jogamp/java3d/SceneGraphObject.java | 2 |
3 files changed, 16 insertions, 53 deletions
diff --git a/src/main/java/org/jogamp/java3d/Jogl2es2Context.java b/src/main/java/org/jogamp/java3d/Jogl2es2Context.java index cc8bdce..27da8df 100644 --- a/src/main/java/org/jogamp/java3d/Jogl2es2Context.java +++ b/src/main/java/org/jogamp/java3d/Jogl2es2Context.java @@ -15,37 +15,6 @@ import com.jogamp.opengl.GLContext; public class Jogl2es2Context extends JoglContext
{
- /*NOTES
- * must carefully respond to deprecated methods with a detailed unsupported method
- * must comment heavily in GeometryArrayRetained regarding the new use of buffers and contexts
- * consider SceneGraphObject capabilitybits change
- * SceneGraphObject setDefaultReadCapabilities significant change, what to do?
- *
- *
- * consider that asking for a certain pipeline on command line, so get that prop in along with the default read!
- * default pipeline is the new jogles
- *
- * Need to document the full range of options in a special default shader based on zz_default but possibly just in a java class
- *
- *
- */
-
- // Step to convert
- // 1. replace all SpareArray< with HashMap<Integer, JoglesContext and JoglesPipeline
- // 2. GeometryArrayRetained must add context tracking for buffers
- // 3. remove all blocks relating to ATTEMPT_UBO
- // 4. remove all calls relating to ATTEMPT_OPTIMIZED_VERTICES
- // 5. swap tcBufIds.keyAt(i) for a key foreach of hashmap vaBufIds
- // 6. update Pipeline to include the new type
- // 7. update MasterControl to include jogles pipeline
- // 8. JoglContext ctx = new JoglContext(glContext); in createNewContext becomes JoglesContext ctx = new JoglesContext(glContext);
- // 9. and again for createQueryContext
- // 10. rename jogles* to jogl2es2* and delete the triangle array
- //
- // 99. rename the classes Jogl2es3... remember to search cause of comments, and the Pipeline reflection call
- //
- //
-
//pre-casting for speed
public GL2ES2 gl2es2 = null;
public GL2ES3 gl2es3 = null;
diff --git a/src/main/java/org/jogamp/java3d/Jogl2es2Pipeline.java b/src/main/java/org/jogamp/java3d/Jogl2es2Pipeline.java index 8034317..930f4ef 100644 --- a/src/main/java/org/jogamp/java3d/Jogl2es2Pipeline.java +++ b/src/main/java/org/jogamp/java3d/Jogl2es2Pipeline.java @@ -32,7 +32,6 @@ import org.jogamp.java3d.Jogl2es2Context.LightData; import org.jogamp.java3d.Jogl2es2Context.LocationData; import org.jogamp.java3d.Jogl2es2Context.ProgramData; import org.jogamp.vecmath.SingularMatrixException; -import org.jogamp.vecmath.Vector3f; import org.jogamp.vecmath.Vector4f; import com.jogamp.common.nio.Buffers; @@ -421,8 +420,8 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline boolean textureDefined = ((vdefined & GeometryArrayRetained.TEXCOORD_FLOAT) != 0); // can it change ever? (GeometryArray.ALLOW_REF_DATA_WRITE is just my indicator of this feature) - boolean morphable = (((GeometryArray) geo.source).capabilityBits & (1L << GeometryArray.ALLOW_REF_DATA_WRITE)) != 0L - || (((GeometryArray) geo.source).capabilityBits & (1L << GeometryArray.ALLOW_COORDINATE_WRITE)) != 0L; + boolean morphable = geo.source.getCapability(GeometryArray.ALLOW_REF_DATA_WRITE) + || geo.source.getCapability(GeometryArray.ALLOW_COORDINATE_WRITE); // not required second time around for VAO (except morphable coords) boolean bindingRequired = true; @@ -561,7 +560,7 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline if (floatColorsDefined && locs.glColor != -1 && !ignoreVertexColors) { // if ((cDirty & GeometryArrayRetained.COLOR_CHANGED) != 0) - boolean changable = (((GeometryArray) geo.source).capabilityBits & (1L << GeometryArray.ALLOW_COLOR_WRITE)) != 0L; + boolean changable = geo.source.getCapability(GeometryArray.ALLOW_COLOR_WRITE); if (changable) { fclrs.position(0); @@ -572,7 +571,7 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline if (normalsDefined && locs.glNormal != -1) { // if ((cDirty & GeometryArrayRetained.NORMAL_CHANGED) != 0) - boolean changable = (((GeometryArray) geo.source).capabilityBits & (1L << GeometryArray.ALLOW_NORMAL_WRITE)) != 0L; + boolean changable = geo.source.getCapability(GeometryArray.ALLOW_NORMAL_WRITE); if (changable) { norms.position(0); @@ -589,8 +588,7 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline if (attribLoc != null && attribLoc.intValue() != -1) { // if ((cDirty & GeometryArrayRetained.VATTR_CHANGED) != 0) - boolean changable = (((GeometryArray) geo.source).capabilityBits - & (1L << GeometryArray.ALLOW_VERTEX_ATTR_WRITE)) != 0L; + boolean changable = geo.source.getCapability(GeometryArray.ALLOW_VERTEX_ATTR_WRITE); if (changable) { FloatBuffer vertexAttrs = vertexAttrBufs[index]; @@ -612,8 +610,7 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline int texSet = texCoordSetMap[texUnit]; if (texSet != -1 && locs.glMultiTexCoord[texSet] != -1 && !texSetsBound[texSet]) { - boolean changable = (((GeometryArray) geo.source).capabilityBits - & (1L << GeometryArray.ALLOW_TEXCOORD_WRITE)) != 0L; + boolean changable = geo.source.getCapability(GeometryArray.ALLOW_TEXCOORD_WRITE); if (changable) { FloatBuffer buf = (FloatBuffer) texCoords[texSet]; @@ -1140,8 +1137,8 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline boolean textureDefined = ((vdefined & GeometryArrayRetained.TEXCOORD_FLOAT) != 0); //can it change ever? (GeometryArray.ALLOW_REF_DATA_WRITE is just my indicator of this feature) - boolean morphable = (((GeometryArray) geo.source).capabilityBits & (1L << GeometryArray.ALLOW_REF_DATA_WRITE)) != 0L - || (((GeometryArray) geo.source).capabilityBits & (1L << GeometryArray.ALLOW_COORDINATE_WRITE)) != 0L; + boolean morphable = geo.source.getCapability(GeometryArray.ALLOW_REF_DATA_WRITE) + || geo.source.getCapability(GeometryArray.ALLOW_COORDINATE_WRITE); // not required second time around for VAO // however as morphables coords are swapped they always get rebound each draw @@ -1279,7 +1276,7 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline if (floatColorsDefined && locs.glColor != -1 && !ignoreVertexColors) { // if ((cDirty & GeometryArrayRetained.COLOR_CHANGED) != 0) - boolean changable = (((GeometryArray) geo.source).capabilityBits & (1L << GeometryArray.ALLOW_COLOR_WRITE)) != 0L; + boolean changable = geo.source.getCapability(GeometryArray.ALLOW_COLOR_WRITE); if (changable) { fclrs.position(0); @@ -1290,7 +1287,7 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline if (normalsDefined && locs.glNormal != -1) { // if ((cDirty & GeometryArrayRetained.NORMAL_CHANGED) != 0) - boolean changable = (((GeometryArray) geo.source).capabilityBits & (1L << GeometryArray.ALLOW_NORMAL_WRITE)) != 0L; + boolean changable = geo.source.getCapability(GeometryArray.ALLOW_NORMAL_WRITE); if (changable) { norms.position(0); @@ -1307,8 +1304,7 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline if (attribLoc != null && attribLoc.intValue() != -1) { // if ((cDirty & GeometryArrayRetained.VATTR_CHANGED) != 0) - boolean changable = (((GeometryArray) geo.source).capabilityBits - & (1L << GeometryArray.ALLOW_VERTEX_ATTR_WRITE)) != 0L; + boolean changable = geo.source.getCapability(GeometryArray.ALLOW_VERTEX_ATTR_WRITE); if (changable) { FloatBuffer vertexAttrs = vertexAttrBufs[index]; @@ -1330,8 +1326,7 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline int texSet = texCoordSetMap[texUnit]; if (texSet != -1 && locs.glMultiTexCoord[texSet] != -1 && !texSetsBound[texSet]) { - boolean changable = (((GeometryArray) geo.source).capabilityBits - & (1L << GeometryArray.ALLOW_TEXCOORD_WRITE)) != 0L; + boolean changable = geo.source.getCapability(GeometryArray.ALLOW_TEXCOORD_WRITE); if (changable) { FloatBuffer buf = (FloatBuffer) texCoords[texSet]; @@ -2316,8 +2311,8 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline if (gd.geoToCoordBuf == -1) { // can it change ever? (GeometryArray.ALLOW_REF_DATA_WRITE is just my indicator of this feature) - boolean morphable = (((GeometryArray) geo.source).capabilityBits & (1L << GeometryArray.ALLOW_REF_DATA_WRITE)) != 0L - || (((GeometryArray) geo.source).capabilityBits & (1L << GeometryArray.ALLOW_COORDINATE_WRITE)) != 0L; + boolean morphable = geo.source.getCapability(GeometryArray.ALLOW_REF_DATA_WRITE) + || geo.source.getCapability(GeometryArray.ALLOW_COORDINATE_WRITE); fverts.position(0); @@ -6175,8 +6170,6 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline private Object mainThreadContext; // Fix for Bug 983 - - // Fix for Bug 983 private void checkAppContext() { @@ -6604,6 +6597,7 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline surface.unlockSurface(); } } + // This is the native for creating an offscreen buffer @Override Drawable createOffScreenBuffer(Canvas3D cv, Context ctx, int width, int height) diff --git a/src/main/java/org/jogamp/java3d/SceneGraphObject.java b/src/main/java/org/jogamp/java3d/SceneGraphObject.java index 9a4b341..8755fb3 100644 --- a/src/main/java/org/jogamp/java3d/SceneGraphObject.java +++ b/src/main/java/org/jogamp/java3d/SceneGraphObject.java @@ -72,7 +72,7 @@ public abstract class SceneGraphObject extends Object { SceneGraphObjectRetained retained; // This object's capability bits - long capabilityBits = 0L; + private long capabilityBits = 0L; // This object's capabilityIsFrequent bits private long capabilityIsFrequentBits = ~0L; |