diff options
author | Chien Yang <[email protected]> | 2004-11-04 02:30:39 +0000 |
---|---|---|
committer | Chien Yang <[email protected]> | 2004-11-04 02:30:39 +0000 |
commit | ea6311a5ff3ccc1acfab62b8a76868c1c5e0c67f (patch) | |
tree | bdf88c1cab129e0127a58803bb9c0cd495918e63 /src | |
parent | 7b97aa387b8933c7e0ba61256fe3b11b1b8b189b (diff) |
Added in a new property, j3d.viewFrustumCulling, to disable
view frustum culling in the renderer.
This will be the workaround for issue 27 until it is fixed.
git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@69 ba19aa83-45c5-6ac9-afd3-db810772062c
Diffstat (limited to 'src')
8 files changed, 34 insertions, 13 deletions
diff --git a/src/classes/share/javax/media/j3d/CompressedGeometryRenderMethod.java b/src/classes/share/javax/media/j3d/CompressedGeometryRenderMethod.java index 0080ca1..5e1e892 100644 --- a/src/classes/share/javax/media/j3d/CompressedGeometryRenderMethod.java +++ b/src/classes/share/javax/media/j3d/CompressedGeometryRenderMethod.java @@ -48,7 +48,8 @@ class CompressedGeometryRenderMethod implements RenderMethod { } } else { - if (ra.renderAtom.localeVwcBounds.intersect(cv.viewFrustum)) { + if (!VirtualUniverse.mc.viewFrustumCulling || + ra.renderAtom.localeVwcBounds.intersect(cv.viewFrustum)) { cv.updateState(pass, dirtyBits); cv.raIsVisible = true; renderCompressedGeo(ra, rm, cv); diff --git a/src/classes/share/javax/media/j3d/DefaultRenderMethod.java b/src/classes/share/javax/media/j3d/DefaultRenderMethod.java index 6a6f95b..b7b8121 100644 --- a/src/classes/share/javax/media/j3d/DefaultRenderMethod.java +++ b/src/classes/share/javax/media/j3d/DefaultRenderMethod.java @@ -45,7 +45,8 @@ class DefaultRenderMethod implements RenderMethod { } } else { - if (ra.renderAtom.localeVwcBounds.intersect(cv.viewFrustum)) { + if (!VirtualUniverse.mc.viewFrustumCulling || + ra.renderAtom.localeVwcBounds.intersect(cv.viewFrustum)) { cv.raIsVisible = true; cv.updateState(pass, dirtyBits); ra.geometry().execute(cv, ra.renderAtom, rm.isNonUniformScale, diff --git a/src/classes/share/javax/media/j3d/DisplayListRenderMethod.java b/src/classes/share/javax/media/j3d/DisplayListRenderMethod.java index c593567..b7f442e 100644 --- a/src/classes/share/javax/media/j3d/DisplayListRenderMethod.java +++ b/src/classes/share/javax/media/j3d/DisplayListRenderMethod.java @@ -37,13 +37,15 @@ class DisplayListRenderMethod implements RenderMethod { public boolean render(RenderMolecule rm, Canvas3D cv, int pass, RenderAtomListInfo ra, int dirtyBits) { - - if (rm.doInfinite || rm.vwcBounds.intersect(cv.viewFrustum)) { + + if (rm.doInfinite || + !VirtualUniverse.mc.viewFrustumCulling || + rm.vwcBounds.intersect(cv.viewFrustum)) { cv.updateState(pass, dirtyBits); cv.callDisplayList(cv.ctx, rm.displayListId, rm.isNonUniformScale); return true; - } + } return false; } diff --git a/src/classes/share/javax/media/j3d/MasterControl.java b/src/classes/share/javax/media/j3d/MasterControl.java index e6ddcc3..6f2b105 100644 --- a/src/classes/share/javax/media/j3d/MasterControl.java +++ b/src/classes/share/javax/media/j3d/MasterControl.java @@ -96,6 +96,17 @@ class MasterControl { boolean transparentOffScreen = false; + + + /** + * the flag to indicate whether should renderer view frustum culling be true. + * true by default. + */ + // Set by the -Dj3d.viewFrustumCulling property, When this flag is + // set to false, the renderer view frustum culling is turned off. + + boolean viewFrustumCulling = true; + /** * the flag to indicate whether the geometry should be locked or not */ @@ -467,6 +478,7 @@ class MasterControl { // by MIK OF CLASSX transparentOffScreen = getBooleanProperty("j3d.transparentOffScreen", transparentOffScreen,"transparent OffScreen"); + viewFrustumCulling = getBooleanProperty("j3d.viewFrustumCulling", viewFrustumCulling,"View frustum culling in the renderer is"); sortShape3DBounds = getBooleanProperty("j3d.sortShape3DBounds", sortShape3DBounds, diff --git a/src/classes/share/javax/media/j3d/OrientedShape3DRenderMethod.java b/src/classes/share/javax/media/j3d/OrientedShape3DRenderMethod.java index bfffdd3..ce93f2b 100644 --- a/src/classes/share/javax/media/j3d/OrientedShape3DRenderMethod.java +++ b/src/classes/share/javax/media/j3d/OrientedShape3DRenderMethod.java @@ -74,7 +74,8 @@ class OrientedShape3DRenderMethod implements RenderMethod { } } else { - if (ra.renderAtom.localeVwcBounds.intersect(cv.viewFrustum)) { + if (!VirtualUniverse.mc.viewFrustumCulling || + ra.renderAtom.localeVwcBounds.intersect(cv.viewFrustum)) { cv.updateState(pass, dirtyBits); cv.raIsVisible = true; trans = ra.localToVworld; diff --git a/src/classes/share/javax/media/j3d/RenderMolecule.java b/src/classes/share/javax/media/j3d/RenderMolecule.java index 7812862..acf5655 100644 --- a/src/classes/share/javax/media/j3d/RenderMolecule.java +++ b/src/classes/share/javax/media/j3d/RenderMolecule.java @@ -1868,11 +1868,13 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen */ // Send down the model view only once, if its not of type text if ((primaryMoleculeType & (TEXT3D_MOLECULE| ORIENTEDSHAPE3D_MOLECULE)) == 0) { + if (primaryRenderAtomList != null) { if ((primaryRenderMethod != VirtualUniverse.mc.getDisplayListRenderMethod()) || modeSupportDL) { if (primaryMoleculeType != SEPARATE_DLIST_PER_RINFO_MOLECULE) { + if ((primaryRenderMethod != VirtualUniverse.mc.getDisplayListRenderMethod()) && (pass == TextureBin.USE_DISPLAYLIST)) { pass = TextureBin.USE_VERTEXARRAY; @@ -1898,6 +1900,7 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen } } else { // TEXT3D or ORIENTEDSHAPE3D + if (primaryRenderAtomList != null) { if (pass == TextureBin.USE_DISPLAYLIST) { pass = TextureBin.USE_VERTEXARRAY; @@ -1957,11 +1960,6 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen int bitMask = geometryType | Canvas3D.MATERIAL_DIRTY| Canvas3D.COLORINGATTRS_DIRTY| Canvas3D.TRANSPARENCYATTRS_DIRTY; - - /* - System.out.println("RM : updateAttributes " + this + - " dirtyBits is " + dirtyBits); - */ // If beginning of a frame then reload all the attributes if ((cv.canvasDirty & bitMask) != 0) { @@ -2132,10 +2130,14 @@ class RenderMolecule extends IndexedObject implements ObjectUpdate, NodeComponen } if ((primaryMoleculeType & (TEXT3D_MOLECULE| ORIENTEDSHAPE3D_MOLECULE)) == 0) { + /* System.out.println("updateAttributes setModelViewMatrix (1)"); */ + Transform3D modelMatrix = trans[localToVworldIndex[NodeRetained.LAST_LOCAL_TO_VWORLD]]; if (cv.modelMatrix != modelMatrix) { + /* System.out.println("updateAttributes setModelViewMatrix (2)"); */ + cv.setModelViewMatrix(cv.ctx, cv.vworldToEc.mat, modelMatrix); } diff --git a/src/classes/share/javax/media/j3d/Text3DRenderMethod.java b/src/classes/share/javax/media/j3d/Text3DRenderMethod.java index 8ff96a3..e967b45 100644 --- a/src/classes/share/javax/media/j3d/Text3DRenderMethod.java +++ b/src/classes/share/javax/media/j3d/Text3DRenderMethod.java @@ -72,7 +72,8 @@ class Text3DRenderMethod implements RenderMethod { } } else { - if (ra.renderAtom.localeVwcBounds.intersect(cv.viewFrustum)) { + if (!VirtualUniverse.mc.viewFrustumCulling || + ra.renderAtom.localeVwcBounds.intersect(cv.viewFrustum)) { cv.updateState(pass, dirtyBits); cv.raIsVisible = true; trans = ra.localToVworld; diff --git a/src/classes/share/javax/media/j3d/VertexArrayRenderMethod.java b/src/classes/share/javax/media/j3d/VertexArrayRenderMethod.java index 759b6fd..e2d72d7 100644 --- a/src/classes/share/javax/media/j3d/VertexArrayRenderMethod.java +++ b/src/classes/share/javax/media/j3d/VertexArrayRenderMethod.java @@ -47,7 +47,8 @@ class VertexArrayRenderMethod implements RenderMethod { } } else { - if (ra.renderAtom.localeVwcBounds.intersect(cv.viewFrustum)) { + if (!VirtualUniverse.mc.viewFrustumCulling || + ra.renderAtom.localeVwcBounds.intersect(cv.viewFrustum)) { cv.updateState(pass, dirtyBits); cv.raIsVisible = true; renderGeo(ra, rm, pass, cv); |