javauis/m3g_qt/javasrc/javax/microedition/m3g/Graphics3D.java
branchRCL_3
changeset 19 04becd199f91
child 40 c6043ea9b06a
equal deleted inserted replaced
16:f5050f1da672 19:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 package javax.microedition.m3g;
       
    20 
       
    21 import javax.microedition.lcdui.Graphics;
       
    22 import java.util.Hashtable;
       
    23 import java.util.Vector;
       
    24 import org.eclipse.swt.widgets.*;
       
    25 import org.eclipse.swt.graphics.*;
       
    26 import org.eclipse.swt.internal.qt.graphics.*;
       
    27 import com.nokia.mj.impl.rt.support.ShutdownListener;
       
    28 import com.nokia.mj.impl.rt.support.ApplicationUtils;
       
    29 import com.nokia.mj.impl.nokialcdui.LCDUIInvoker;
       
    30 
       
    31 
       
    32 public class Graphics3D
       
    33 {
       
    34     //------------------------------------------------------------------
       
    35     // Static data
       
    36     //------------------------------------------------------------------
       
    37 
       
    38     public static final int ANTIALIAS   = 2;
       
    39     public static final int DITHER      = 4;
       
    40     public static final int TRUE_COLOR  = 8;
       
    41 
       
    42     // M3G 1.1
       
    43     public static final int OVERWRITE   = 16;
       
    44 
       
    45     // Singleton instances
       
    46     static Graphics3D s_instance = null;
       
    47 
       
    48     //------------------------------------------------------------------
       
    49     // Instance data
       
    50     //------------------------------------------------------------------
       
    51 
       
    52     int handle;
       
    53     int iSurfaceHandle;
       
    54 
       
    55     private Camera camera = null;
       
    56     private Vector lights = new Vector();
       
    57 
       
    58     private java.lang.Object currentTarget = null;
       
    59     private int offsetX, offsetY, hints = 0;
       
    60     private boolean depthEnabled = true;
       
    61     private Destroyer destroyer;
       
    62     private Interface iInterface;
       
    63 
       
    64     // this flag is for identification of image target types
       
    65     // - True for mutable off-screen images
       
    66     // - False for canvas/GameCanvas framebuffer
       
    67     private boolean iIsImageTarget;
       
    68 
       
    69     // this flag is for identification if MBX HW accelerator is present
       
    70     // - True - MBX is NOT present
       
    71     // - False - MBX is present
       
    72     private boolean iIsProperRenderer;
       
    73 
       
    74     private boolean iNativeInitialized = false;
       
    75 
       
    76     // Shutdown listener
       
    77     private class Destroyer implements ShutdownListener
       
    78     {
       
    79         Graphics3D target;
       
    80 
       
    81         Destroyer(Graphics3D g3d)
       
    82         {
       
    83             target = g3d;
       
    84             ApplicationUtils appUtils = ApplicationUtils.getInstance();
       
    85             appUtils.addShutdownListener(this);
       
    86         }
       
    87 
       
    88         // This method gets called when application is shuttingdown
       
    89         public void shuttingDown()
       
    90         {
       
    91 
       
    92             // Finalize native peer
       
    93             Platform.finalizeObject(target.handle, target.iInterface);
       
    94 
       
    95             // signal shutdown (set shutdown flag)
       
    96             // and remove references
       
    97             target.iInterface.signalShutdown();
       
    98             target.iInterface = null;
       
    99             target.camera = null;
       
   100             //target.s_instance = null;
       
   101 
       
   102             // All done, Call gc() and finalization to collect
       
   103             // remaining objects, thus zeroying liveObjects count
       
   104             // in interface instance
       
   105 
       
   106         }
       
   107     }
       
   108 
       
   109     //------------------------------------------------------------------
       
   110     // Constructor(s)
       
   111     //------------------------------------------------------------------
       
   112     public static final Graphics3D getInstance()
       
   113     {
       
   114 
       
   115         if (s_instance == null)
       
   116         {
       
   117             s_instance = new Graphics3D();
       
   118         }
       
   119         return s_instance;
       
   120     }
       
   121 
       
   122     private Graphics3D()
       
   123     {
       
   124         iInterface = Interface.getInstance();
       
   125         initNativePeer();
       
   126 
       
   127         // setup listener for singleton teardown
       
   128         destroyer = new Destroyer(this);
       
   129     }
       
   130 
       
   131     //------------------------------------------------------------------
       
   132     // Public methods
       
   133     //------------------------------------------------------------------
       
   134 
       
   135     /**
       
   136      */
       
   137     public void bindTarget(java.lang.Object target)
       
   138     {
       
   139         bindTarget(target, true, 0);
       
   140     }
       
   141 
       
   142     /**
       
   143      *
       
   144      */
       
   145     public void bindTarget(java.lang.Object target, boolean depth, int flags)
       
   146     {
       
   147         integrityCheck();
       
   148         if (currentTarget != null)
       
   149         {
       
   150             throw new IllegalStateException();
       
   151         }
       
   152 
       
   153         if (target == null)
       
   154         {
       
   155             throw new NullPointerException();
       
   156         }
       
   157 
       
   158         final int finalFlags = flags;
       
   159         final boolean finalDepth = depth;
       
   160 
       
   161         if (target instanceof org.eclipse.swt.graphics.GC)
       
   162         {
       
   163             Rectangle clip = ((org.eclipse.swt.graphics.GC)target).getClipping();
       
   164             final int clipW = clip.width;
       
   165             final int clipH = clip.height;
       
   166             final int clipX = clip.x;
       
   167             final int clipY = clip.y;
       
   168 
       
   169             if (clipW > Defs.MAX_VIEWPORT_WIDTH ||
       
   170                     clipH > Defs.MAX_VIEWPORT_HEIGHT)
       
   171             {
       
   172                 throw new IllegalArgumentException();
       
   173             }
       
   174 
       
   175             final Object finalTarget = target;
       
   176             Platform.executeInUIThread(
       
   177                 new M3gRunnable()
       
   178             {
       
   179                 public void doRun()
       
   180                 {
       
   181                     GCData gcData = ((org.eclipse.swt.graphics.GC)finalTarget).getGCData();
       
   182                     iSurfaceHandle = gcData.internalGc.getWindowSurface().getHandle();
       
   183                     iIsImageTarget = _bindGraphics(
       
   184                                          handle,
       
   185                                          iSurfaceHandle,
       
   186                                          clipX, clipY,
       
   187                                          clipW, clipH,
       
   188                                          finalDepth, finalFlags,
       
   189                                          iIsProperRenderer);
       
   190                 }
       
   191             });
       
   192             currentTarget = target;
       
   193         }
       
   194 
       
   195         else if (target instanceof Graphics)
       
   196         {
       
   197 
       
   198             Graphics g = (Graphics) target;
       
   199             //Platform.sync(g);
       
   200 
       
   201             if (g.getClipWidth() > Defs.MAX_VIEWPORT_WIDTH ||
       
   202                     g.getClipHeight() > Defs.MAX_VIEWPORT_HEIGHT)
       
   203             {
       
   204                 throw new IllegalArgumentException();
       
   205             }
       
   206 
       
   207             offsetX = g.getTranslateX();
       
   208             offsetY = g.getTranslateY();
       
   209 
       
   210             final Graphics finalG = g;
       
   211 
       
   212             Platform.executeInUIThread(
       
   213                 new M3gRunnable()
       
   214             {
       
   215                 public void doRun()
       
   216                 {
       
   217                     iSurfaceHandle = (LCDUIInvoker.getGc(finalG)).getWindowSurface().getHandle();
       
   218                     iIsImageTarget = _bindGraphics(
       
   219                                          handle,
       
   220                                          iSurfaceHandle,
       
   221                                          finalG.getClipX() + offsetX, finalG.getClipY() + offsetY,
       
   222                                          finalG.getClipWidth(), finalG.getClipHeight(),
       
   223                                          finalDepth, finalFlags,
       
   224                                          iIsProperRenderer);
       
   225                 }
       
   226             });
       
   227             currentTarget = g;
       
   228         }
       
   229         else if (target instanceof Image2D)
       
   230         {
       
   231             Image2D img = (Image2D) target;
       
   232 
       
   233             offsetX = offsetY = 0;
       
   234             final int imageHandle = img.handle;
       
   235 
       
   236             Platform.executeInUIThread(
       
   237                 new M3gRunnable()
       
   238             {
       
   239                 public void doRun()
       
   240                 {
       
   241                     _bindImage(handle, imageHandle, finalDepth, finalFlags);
       
   242                 }
       
   243             });
       
   244             currentTarget = img;
       
   245         }
       
   246         else
       
   247         {
       
   248             throw new IllegalArgumentException();
       
   249         }
       
   250 
       
   251         hints = flags;
       
   252         depthEnabled = depth;
       
   253     }
       
   254 
       
   255     /**
       
   256      *
       
   257      */
       
   258     public void releaseTarget()
       
   259     {
       
   260         integrityCheck();
       
   261         if (currentTarget == null)
       
   262         {
       
   263             return;
       
   264         }
       
   265 
       
   266         if (currentTarget instanceof org.eclipse.swt.graphics.GC)
       
   267         {
       
   268             Platform.executeInUIThread(
       
   269                 new M3gRunnable()
       
   270             {
       
   271                 public void doRun()
       
   272                 {
       
   273                     _releaseGraphics(handle,
       
   274                                      iSurfaceHandle, iIsImageTarget, iIsProperRenderer);
       
   275                 }
       
   276             });
       
   277         }
       
   278         else if (currentTarget instanceof Graphics)
       
   279         {
       
   280             Platform.executeInUIThread(
       
   281                 new M3gRunnable()
       
   282             {
       
   283                 public void doRun()
       
   284                 {
       
   285                     _releaseGraphics(handle,
       
   286                                      iSurfaceHandle, iIsImageTarget, iIsProperRenderer);
       
   287                 }
       
   288             });
       
   289             /*
       
   290             Graphics g = (Graphics) currentTarget;
       
   291 
       
   292             //ToolkitInvoker invoker = ToolkitInvoker.getToolkitInvoker();
       
   293 
       
   294             Platform.getUIThread().syncExec(
       
   295                     new Runnable() {
       
   296                         public void run() {
       
   297                                         _releaseGraphics( handle,
       
   298                                         invoker.graphicsGetHandle(g), iIsImageTarget, iIsProperRenderer );
       
   299                                 }
       
   300                         });
       
   301                         */
       
   302         }
       
   303         else if (currentTarget instanceof Image2D)
       
   304         {
       
   305             Platform.executeInUIThread(
       
   306                 new M3gRunnable()
       
   307             {
       
   308                 public void doRun()
       
   309                 {
       
   310                     _releaseImage(handle);
       
   311                 }
       
   312             });
       
   313         }
       
   314         else
       
   315         {
       
   316             throw new Error();
       
   317         }
       
   318         currentTarget = null;
       
   319         iSurfaceHandle = 0;
       
   320     }
       
   321 
       
   322     /**
       
   323      *
       
   324      */
       
   325     public void setViewport(int x, int y, int width, int height)
       
   326     {
       
   327         integrityCheck();
       
   328         if (width <= 0 || height <= 0
       
   329                 || width  > Defs.MAX_VIEWPORT_DIMENSION
       
   330                 || height > Defs.MAX_VIEWPORT_DIMENSION)
       
   331         {
       
   332             throw new IllegalArgumentException();
       
   333         }
       
   334         _setViewport(handle, x + offsetX, y + offsetY, width, height);
       
   335     }
       
   336 
       
   337     /**
       
   338      *
       
   339      */
       
   340     public void clear(Background background)
       
   341     {
       
   342         integrityCheck();
       
   343         final Background finalBackground = background;
       
   344         Platform.executeInUIThread(
       
   345             new M3gRunnable()
       
   346         {
       
   347             public void doRun()
       
   348             {
       
   349                 _clear(handle, finalBackground != null ? finalBackground.handle : 0);
       
   350             }
       
   351         });
       
   352     }
       
   353 
       
   354     /**
       
   355      *
       
   356      */
       
   357     public void render(World world)
       
   358     {
       
   359         integrityCheck();
       
   360         final World finalWorld = world;
       
   361         Platform.executeInUIThread(
       
   362             new M3gRunnable()
       
   363         {
       
   364             public void doRun()
       
   365             {
       
   366                 _renderWorld(handle, finalWorld.handle);
       
   367             }
       
   368         });
       
   369     }
       
   370 
       
   371     /**
       
   372      *
       
   373      */
       
   374     public void render(VertexBuffer vertices,
       
   375                        IndexBuffer primitives,
       
   376                        Appearance appearance,
       
   377                        Transform transform)
       
   378     {
       
   379         // Call rendering method with default visibility
       
   380         integrityCheck();
       
   381         render(vertices, primitives, appearance, transform, -1);
       
   382     }
       
   383 
       
   384     /**
       
   385      *
       
   386      */
       
   387     public void render(VertexBuffer vertices,
       
   388                        IndexBuffer primitives,
       
   389                        Appearance appearance,
       
   390                        Transform transform,
       
   391                        int scope)
       
   392     {
       
   393 
       
   394         // null pointer exceptions thrown automatically below
       
   395         integrityCheck();
       
   396 
       
   397         final VertexBuffer finalVertices = vertices;
       
   398         final IndexBuffer finalPrimitives = primitives;
       
   399         final Appearance finalAppearance = appearance;
       
   400         final Transform finalTransform = transform;
       
   401         final int finalScope = scope;
       
   402 
       
   403         Platform.executeInUIThread(
       
   404             new M3gRunnable()
       
   405         {
       
   406             public void doRun()
       
   407             {
       
   408                 _render(handle,
       
   409                         finalVertices.handle,
       
   410                         finalPrimitives.handle,
       
   411                         finalAppearance.handle,
       
   412                         finalTransform != null ? finalTransform.matrix : null,
       
   413                         finalScope);
       
   414             }
       
   415         });
       
   416     }
       
   417 
       
   418     /**
       
   419      *
       
   420      */
       
   421     public void render(Node node, Transform transform)
       
   422     {
       
   423         if (!(node instanceof Mesh
       
   424                 || node instanceof Sprite3D
       
   425                 || node instanceof Group)
       
   426                 && node != null)
       
   427         {
       
   428             throw new IllegalArgumentException();
       
   429         }
       
   430         integrityCheck();
       
   431 
       
   432         final Node finalNode = node;
       
   433         final Transform finalTransform = transform;
       
   434 
       
   435         Platform.executeInUIThread(
       
   436             new M3gRunnable()
       
   437         {
       
   438             public void doRun()
       
   439             {
       
   440                 _renderNode(handle,
       
   441                             finalNode.handle,
       
   442                             finalTransform != null ? finalTransform.matrix : null);
       
   443             }
       
   444         });
       
   445     }
       
   446 
       
   447 
       
   448     public void setCamera(Camera camera, Transform transform)
       
   449     {
       
   450         integrityCheck();
       
   451         _setCamera(handle,
       
   452                    camera != null ? camera.handle : 0,
       
   453                    transform != null ? transform.matrix : null);
       
   454 
       
   455         this.camera = camera;
       
   456     }
       
   457 
       
   458     /**
       
   459      */
       
   460     public int addLight(Light light, Transform transform)
       
   461     {
       
   462         integrityCheck();
       
   463         int index = _addLight(handle,
       
   464                               light.handle,
       
   465                               transform != null ? transform.matrix : null);
       
   466         if (lights.size() < index + 1)
       
   467         {
       
   468             lights.setSize(index + 1);
       
   469         }
       
   470         lights.setElementAt(light, index);
       
   471         return index;
       
   472     }
       
   473 
       
   474     /**
       
   475      *
       
   476      */
       
   477     public void setLight(int index, Light light, Transform transform)
       
   478     {
       
   479         integrityCheck();
       
   480         _setLight(handle,
       
   481                   index,
       
   482                   light != null ? light.handle : 0,
       
   483                   transform != null ? transform.matrix : null);
       
   484         lights.setElementAt(light, index);
       
   485     }
       
   486 
       
   487     /**
       
   488      */
       
   489     public void resetLights()
       
   490     {
       
   491         integrityCheck();
       
   492         _resetLights(handle);
       
   493         lights.removeAllElements();
       
   494     }
       
   495 
       
   496     /**
       
   497      *
       
   498      */
       
   499     public static final Hashtable getProperties()
       
   500     {
       
   501         Hashtable props = new Hashtable();
       
   502 
       
   503         props.put("supportAntialiasing",          new java.lang.Boolean(
       
   504                       _isAASupported(Interface.getHandle())));
       
   505         props.put("supportTrueColor",             new java.lang.Boolean(Defs.supportTrueColor));
       
   506         props.put("supportDithering",             new java.lang.Boolean(Defs.supportDithering));
       
   507         props.put("supportMipmapping",            new java.lang.Boolean(Defs.supportMipmapping));
       
   508         props.put("supportPerspectiveCorrection", new java.lang.Boolean(Defs.supportPerspectiveCorrection));
       
   509         props.put("supportLocalCameraLighting",   new java.lang.Boolean(Defs.supportLocalCameraLighting));
       
   510         props.put("maxLights",                    new java.lang.Integer(Defs.MAX_LIGHTS));
       
   511         props.put("maxViewportWidth",             new java.lang.Integer(Defs.MAX_VIEWPORT_WIDTH));
       
   512         props.put("maxViewportHeight",            new java.lang.Integer(Defs.MAX_VIEWPORT_HEIGHT));
       
   513         props.put("maxViewportDimension",         new java.lang.Integer(Defs.MAX_VIEWPORT_DIMENSION));
       
   514         props.put("maxTextureDimension",          new java.lang.Integer(Defs.MAX_TEXTURE_DIMENSION));
       
   515         props.put("maxSpriteCropDimension",       new java.lang.Integer(Defs.MAX_TEXTURE_DIMENSION));
       
   516         props.put("numTextureUnits",              new java.lang.Integer(Defs.NUM_TEXTURE_UNITS));
       
   517         props.put("maxTransformsPerVertex",       new java.lang.Integer(Defs.MAX_TRANSFORMS_PER_VERTEX));
       
   518 
       
   519         // Extra properties
       
   520         props.put("m3gRelease",                   new java.lang.String("04_wk49"));
       
   521 
       
   522         return props;
       
   523     }
       
   524 
       
   525     /**
       
   526      *
       
   527      */
       
   528     public void setDepthRange(float near, float far)
       
   529     {
       
   530         integrityCheck();
       
   531         _setDepthRange(handle, near, far);
       
   532     }
       
   533 
       
   534     // M3G 1.1
       
   535 
       
   536     public Camera getCamera(Transform transform)
       
   537     {
       
   538         integrityCheck();
       
   539         if (transform != null)
       
   540         {
       
   541             _getViewTransform(handle, transform.matrix);
       
   542         }
       
   543 
       
   544         return (Camera) Object3D.getInstance(_getCamera(handle));
       
   545     }
       
   546 
       
   547     public float getDepthRangeFar()
       
   548     {
       
   549         integrityCheck();
       
   550         return _getDepthRangeFar(handle);
       
   551     }
       
   552 
       
   553     public float getDepthRangeNear()
       
   554     {
       
   555         integrityCheck();
       
   556         return _getDepthRangeNear(handle);
       
   557     }
       
   558 
       
   559     public Light getLight(int index, Transform transform)
       
   560     {
       
   561         integrityCheck();
       
   562         if (index < 0 || index >= _getLightCount(handle))
       
   563         {
       
   564             throw new IndexOutOfBoundsException();
       
   565         }
       
   566 
       
   567         return (Light) Object3D.getInstance(_getLightTransform(handle,
       
   568                                             index,
       
   569                                             transform != null ? transform.matrix : null));
       
   570     }
       
   571 
       
   572     public int getLightCount()
       
   573     {
       
   574         integrityCheck();
       
   575         return _getLightCount(handle);
       
   576     }
       
   577 
       
   578     public java.lang.Object getTarget()
       
   579     {
       
   580         return currentTarget;
       
   581     }
       
   582 
       
   583     public int getViewportHeight()
       
   584     {
       
   585         integrityCheck();
       
   586         return _getViewportHeight(handle);
       
   587     }
       
   588 
       
   589     public int getViewportWidth()
       
   590     {
       
   591         integrityCheck();
       
   592         return _getViewportWidth(handle);
       
   593     }
       
   594 
       
   595     public int getViewportX()
       
   596     {
       
   597         integrityCheck();
       
   598         return _getViewportX(handle) - offsetX;
       
   599     }
       
   600 
       
   601     public int getViewportY()
       
   602     {
       
   603         integrityCheck();
       
   604         return _getViewportY(handle) - offsetY;
       
   605     }
       
   606 
       
   607     public int getHints()
       
   608     {
       
   609         return hints;
       
   610     }
       
   611 
       
   612     public boolean isDepthBufferEnabled()
       
   613     {
       
   614         return depthEnabled;
       
   615     }
       
   616 
       
   617     // M3G 1.1 getters END
       
   618 
       
   619     //------------------------------------------------------------------
       
   620     // Private methods
       
   621     //------------------------------------------------------------------
       
   622 
       
   623     private void integrityCheck()
       
   624     {
       
   625         if (iInterface == null)
       
   626         {
       
   627             throw new RuntimeException("Graphics3D closed");
       
   628         }
       
   629         if (!iNativeInitialized)
       
   630         {
       
   631             // If native interface cannot be initialized we cannot recover from it
       
   632             if (!initNativePeer())
       
   633             {
       
   634                 throw new Error("UI thread not available");
       
   635             }
       
   636         }
       
   637     }
       
   638 
       
   639     /**
       
   640      * Initializes native peer
       
   641      * @return true if native interface was succesfully inialized otherwise false
       
   642      */
       
   643     private boolean initNativePeer()
       
   644     {
       
   645         if (iNativeInitialized)
       
   646         {
       
   647             return true;
       
   648         }
       
   649         if (iInterface.isFullyInitialized() && Platform.uiThreadAvailable())
       
   650         {
       
   651             handle = _ctor(iInterface.getHandle());
       
   652             _addRef(handle);
       
   653 
       
   654             Platform.executeInUIThread(
       
   655                 new M3gRunnable()
       
   656             {
       
   657                 public void doRun()
       
   658                 {
       
   659                     iIsProperRenderer = _isProperRenderer();
       
   660                 }
       
   661             });
       
   662             iNativeInitialized = true;
       
   663             return true;
       
   664         }
       
   665         else
       
   666         {
       
   667             return false;
       
   668         }
       
   669     }
       
   670 
       
   671     //------------------------------------------------------------------
       
   672     // Native implementation methods
       
   673     //------------------------------------------------------------------
       
   674     private native static int _ctor(int hInterface);
       
   675     private native static void _addRef(int hObject);
       
   676     private native static int _addLight(int handle,
       
   677                                         int hLight,
       
   678                                         byte[] transform);
       
   679     private native static boolean _bindGraphics(int handle,
       
   680             int surfaceHandle,
       
   681             int clipX, int clipY,
       
   682             int clipW, int clipH,
       
   683             boolean depth,
       
   684             int hintBits,
       
   685             boolean aIsProperRenderer);
       
   686     private native static void _bindImage(int handle, int imgHandle, boolean depth, int hintBits);
       
   687     private native static void _releaseGraphics(int handle,
       
   688             int surfaceHandle,
       
   689             boolean aIsImageTarget,
       
   690             boolean aIsProperRenderer);
       
   691     private native static void _releaseImage(int handle);
       
   692     private native static void _resetLights(int handle);
       
   693     private native static void _clear(int handle, int hBackground);
       
   694     private native static void _render(int handle,
       
   695                                        int hVtxBuffer,
       
   696                                        int hIdxBuffer,
       
   697                                        int hAppearance,
       
   698                                        byte[] transform,
       
   699                                        int scope);
       
   700     private native static void _renderNode(int handle, int hNode, byte[] transform);
       
   701     private native static void _renderWorld(int handle, int hWorld);
       
   702     private native static void _setCamera(int handle,
       
   703                                           int hCamera,
       
   704                                           byte[] transform);
       
   705     private native static void _setViewport(int handle,
       
   706                                             int x, int y,
       
   707                                             int width, int height);
       
   708     private native static void _setLight(int handle,
       
   709                                          int index,
       
   710                                          int hLight,
       
   711                                          byte[] transform);
       
   712     private native static void _setDepthRange(int handle,
       
   713             float near,
       
   714             float far);
       
   715 
       
   716     // M3G 1.1
       
   717     // Maintenance release getters
       
   718 
       
   719     private native static void _getViewTransform(int handle,
       
   720             byte[] transform);
       
   721     private native static int _getCamera(int handle);
       
   722     private native static int _getLightTransform(int handle,
       
   723             int index,
       
   724             byte[] transform);
       
   725     private native static int _getLightCount(int handle);
       
   726     private native static float _getDepthRangeNear(int handle);
       
   727     private native static float _getDepthRangeFar(int handle);
       
   728     private native static int _getViewportX(int handle);
       
   729     private native static int _getViewportY(int handle);
       
   730     private native static int _getViewportWidth(int handle);
       
   731     private native static int _getViewportHeight(int handle);
       
   732 
       
   733     /* Statistics support, MUST be disabled in official releases! */
       
   734     /*
       
   735         public native static int getStatistics(int[] statistics);
       
   736     */
       
   737     private native static boolean _isAASupported(int handle);
       
   738     private native static boolean _isProperRenderer();
       
   739 }