diff options
Diffstat (limited to 'src/classes')
-rw-r--r-- | src/classes/share/javax/media/j3d/JoglPipeline.java | 252 |
1 files changed, 0 insertions, 252 deletions
diff --git a/src/classes/share/javax/media/j3d/JoglPipeline.java b/src/classes/share/javax/media/j3d/JoglPipeline.java index d7f54c1..4e69655 100644 --- a/src/classes/share/javax/media/j3d/JoglPipeline.java +++ b/src/classes/share/javax/media/j3d/JoglPipeline.java @@ -8972,256 +8972,4 @@ static boolean hasFBObjectSizeChanged(JoglDrawable jdraw, int width, int height) return bufs; } - - private static final class J3DCapsChooser implements GLCapabilitiesChooser { - - private GraphicsConfigTemplate3D gct3D = null; - - private boolean called = false; - - private J3DCapsChooser(GraphicsConfigTemplate3D gct) { - gct3D = gct; - } - - private boolean isCalled() { - return called; - } - - // Interface GLCapabilitiesChooser - - // javadoc : "Some of the entries in the available array may be null;" - - @Override - public int chooseCapabilities(final CapabilitiesImmutable desiredCaps, - final List<? extends CapabilitiesImmutable> availableCapsList, - final int windowSystemRecommendedChoice) { - called = true; - - final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable)desiredCaps; - - List<GLCapabilitiesImmutable> capsList = new ArrayList<GLCapabilitiesImmutable>(availableCapsList.size()); - for (CapabilitiesImmutable availableCaps : availableCapsList) { - if (availableCaps != null) - capsList.add((GLCapabilitiesImmutable)availableCaps); - } - - List<GLCapabilitiesImmutable> potentialCapsList = new ArrayList<GLCapabilitiesImmutable>(); - - int capsListLength = capsList.size(); - - int chosenIndex = -1; - - // I. minimum requirements - - // I.a red - int num = gct3D.getRedSize(); - for (int i=capsListLength-1; i >= 0; i--) { - if (capsList.get(i).getRedBits() < num) { - capsList.remove(i); - } - } - capsListLength = capsList.size(); - // I.b green - num = gct3D.getGreenSize(); - for (int i=capsListLength-1; i >= 0; i--) { - if (capsList.get(i).getGreenBits() < num) { - capsList.remove(i); - } - } - capsListLength = capsList.size(); - // I.c blue - num = gct3D.getBlueSize(); - for (int i=capsListLength-1; i >= 0; i--) { - if (capsList.get(i).getBlueBits() < num) { - capsList.remove(i); - } - } - capsListLength = capsList.size(); - - // I.d depth - num = gct3D.getDepthSize(); - for (int i=capsListLength-1; i >= 0; i--) { - if (capsList.get(i).getDepthBits() < num) { - capsList.remove(i); - } - } - capsListLength = capsList.size(); - // I.e stencil - num = gct3D.getStencilSize(); - for (int i=capsListLength-1; i >= 0; i--) { - if (capsList.get(i).getStencilBits() < num) { - capsList.remove(i); - } - } - capsListLength = capsList.size(); - - if (capsListLength < 1) - return chosenIndex; - - // II. REQUIRED - - // II.a stereo - if (gct3D.getStereo() == GraphicsConfigTemplate3D.REQUIRED) { - for (int i=capsListLength-1; i >= 0; i--) { - if (capsList.get(i).getStereo() == false) { - capsList.remove(i); - } - } - capsListLength = capsList.size(); - } - - // II.b double buffering - if (gct3D.getDoubleBuffer() == GraphicsConfigTemplate3D.REQUIRED) { - for (int i=capsListLength-1; i >= 0; i--) { - if (capsList.get(i).getDoubleBuffered() == false) { - capsList.remove(i); - } - } - capsListLength = capsList.size(); - } - - // II.c scene antialiasing (implicitly double buffered !) - if (gct3D.getSceneAntialiasing() == GraphicsConfigTemplate3D.REQUIRED) { - for (int i=capsListLength-1; i >= 0; i--) { - if (capsList.get(i).getSampleBuffers() == false) { - capsList.remove(i); - } - } - capsListLength = capsList.size(); - - // Check num samples - if (capsListLength > 0) { - - selectNumSamples(capsList); - // capsList now contains only caps with num samples >= min(required number, max supported number) - - capsListLength = capsList.size(); - } - } - - if (capsListLength < 1) - return chosenIndex; - - // All remaining member of capsList fulfill the min requirements - - // III. PREFERRED priority : 1. scene antialiasing, 2. db buff, 3. stereo - - // fill potentialCapsList with caps from capsList - - // III.a scene antialiasing (implicitly double buffered !) - if (gct3D.getSceneAntialiasing() == GraphicsConfigTemplate3D.PREFERRED && - gct3D.getDoubleBuffer() != GraphicsConfigTemplate3D.UNNECESSARY) { - for (GLCapabilitiesImmutable potCaps : capsList) { - if (potCaps.getSampleBuffers() && potCaps.getDoubleBuffered()) { - potentialCapsList.add(potCaps); - } - } - // Check num samples - if (potentialCapsList.size() > 0) { - selectNumSamples(potentialCapsList); - // potentialCapsList now contains only caps with num samples >= min(required number, max supported number) - } - // Check stereo - if (potentialCapsList.size() > 0 && gct3D.getStereo() == GraphicsConfigTemplate3D.PREFERRED) { - selectStereo(potentialCapsList); - // potentialCapsList now contains only caps with stereo or is unchanged - } - - // if potentialCapsList.size() > 0 => done - } - - // potentialCapsList.size() > 0 ??? - - // III.b double buffering - if (potentialCapsList.isEmpty() && gct3D.getDoubleBuffer() == GraphicsConfigTemplate3D.PREFERRED) { - for (GLCapabilitiesImmutable potCaps : capsList) { - if (potCaps.getDoubleBuffered()) { - potentialCapsList.add(potCaps); - } - } - // Check stereo - if (potentialCapsList.size() > 0 && gct3D.getStereo() == GraphicsConfigTemplate3D.PREFERRED) { - selectStereo(potentialCapsList); - // potentialCapsList now contains only caps with stereo or is unchanged - } - - // if potentialCapsList.size() > 0 => done - } - - // potentialCapsList.size() > 0 ??? - - // III.c stereo - if (potentialCapsList.isEmpty() && gct3D.getStereo() == GraphicsConfigTemplate3D.PREFERRED) { - for (GLCapabilitiesImmutable potCaps : capsList) { - if (potCaps.getStereo()) { - potentialCapsList.add(potCaps); - } - } - - // if potentialCapsList.size() > 0 => done - } - - // If no PREFERRED capability exists or no supporting caps were found - if (potentialCapsList.isEmpty()) { - potentialCapsList.addAll(capsList); - } - - capsListLength = potentialCapsList.size(); - - // IV. UNNECESSARY - TODO remove those caps ???? - - - // Now choose a caps in potentialCapsList and determine its index in availableCapsList - - if (!potentialCapsList.isEmpty()) { - // TODO take the first one - chosenIndex = availableCapsList.indexOf(potentialCapsList.get(0)); - } - - return chosenIndex; - } - - // If one caps supports stereo, remove all caps with no stereo support - private void selectStereo(List<GLCapabilitiesImmutable> capsList) { - boolean isStereoSupported = false; - for (GLCapabilitiesImmutable caps : capsList) { - if (caps.getStereo()) { - isStereoSupported = true; - break; - } - } - // Kepp all caps with stereo support - if (isStereoSupported) { - for (int i=capsList.size()-1; i >= 0; i--) { - if (capsList.get(i).getStereo() == false) { - capsList.remove(i); - } - } - } - } - - // Search for best caps if supported number of samples ( >=0 ) is less than the requested number - private void selectNumSamples(List<GLCapabilitiesImmutable> msaaCapsList) { - // required number - int reqNumSamples = 4; // TODO - // Maximum available - int maxNumSamples = 0; - - for (GLCapabilitiesImmutable msaaCaps : msaaCapsList) { - if (msaaCaps.getNumSamples() > maxNumSamples) { - maxNumSamples = msaaCaps.getNumSamples(); - } - } - - // The required number might not be supported - reqNumSamples = Math.min(reqNumSamples, maxNumSamples); - - // Kepp all caps with num samples >= reqNumSamples - for (int i=msaaCapsList.size()-1; i >= 0; i--) { - if (msaaCapsList.get(i).getNumSamples() < reqNumSamples) { - msaaCapsList.remove(i); - } - } - } - } } |