Tests the {@link GVRSceneObject} against the ray information passed to the function.

@param sceneObject
The {@link GVRSceneObject} to be tested.

@return  a {@link GVRPicker.GVRPickedObject} containing the picking information
519863
public static final GVRPickedObject pickSceneObject(GVRSceneObject sceneObject) {
        GVRCameraRig cam = sceneObject.getGVRContext().getMainScene().getMainCameraRig();
        GVRTransform t = cam.getHeadTransform();
        float[] lookat = cam.getLookAt();
        return NativePicker.pickSceneObject(sceneObject.getNative(), t.getPositionX(), t.getPositionY(), t.getPositionZ(),
                lookat[0], lookat[1], lookat[2]);
    }
143850
protected void propagateOnTouch(GVRPickedObject hit)
    {
        if (mEventOptions.contains(EventOptions.SEND_TOUCH_EVENTS))
        {
            GVREventManager eventManager = getGVRContext().getEventManager();
            GVRSceneObject hitObject = hit.getHitObject();
            if (mEventOptions.contains(EventOptions.SEND_TO_LISTENERS))
            {
                eventManager.sendEvent(this, ITouchEvents.class, "onTouchStart", hitObject, hit);
            }
            if (mEventOptions.contains(EventOptions.SEND_TO_HIT_OBJECT))
            {
                eventManager.sendEvent(hitObject, ITouchEvents.class, "onTouchStart", hitObject, hit);
            }
            if (mEventOptions.contains(EventOptions.SEND_TO_SCENE) && (mScene != null))
            {
                eventManager.sendEvent(mScene, ITouchEvents.class, "onTouchStart", hitObject, hit);
            }
        }
    }
262949
function Ball(scene) {
    this.x = scene.width() / 2;
    this.y = scene.height() / 2;
    this.vx = 1;// + Math.random()* 2;
    this.vy = 1;// + Math.random() * 2;

    this.move = function () {
        this.x += this.vx;
        this.y += this.vy;
        if (this.y < 0) {
            this.y = 0;
            this.vy = -this.vy;
        } else if (this.y > scene.height()) {
            this.y = scene.height();
            this.vy = -this.vy;
        }
    };
    this.setPosition = function (pos) {
        this.x = pos.x;
        this.y = pos.y;
    };
    this.isOut = function () {
        if (this.x < 0) {
            return 'left';
        }
        if (this.x > scene.width()) {
            return 'right';
        }
        return false;
    };
}
1070550
def sceneRect( self ):
        
        pos     = self.scenePos()
        rect    = self.rect()
        return QRectF(pos.x(), pos.y(), rect.width(), rect.height())
690250
public Matrix4d pick(double x, double y, double width, double height, int[] viewport, Matrix4d dest) {
        double sx = viewport[2] / width;
        double sy = viewport[3] / height;
        double tx = (viewport[2] + 2.0 * (viewport[0] - x)) / width;
        double ty = (viewport[3] + 2.0 * (viewport[1] - y)) / height;
        dest.m30 = m00 * tx + m10 * ty + m30;
        dest.m31 = m01 * tx + m11 * ty + m31;
        dest.m32 = m02 * tx + m12 * ty + m32;
        dest.m33 = m03 * tx + m13 * ty + m33;
        dest.m00 = m00 * sx;
        dest.m01 = m01 * sx;
        dest.m02 = m02 * sx;
        dest.m03 = m03 * sx;
        dest.m10 = m10 * sy;
        dest.m11 = m11 * sy;
        dest.m12 = m12 * sy;
        dest.m13 = m13 * sy;
        dest.properties = 0;
        return dest;
    }
655386
@Override
  @SuppressWarnings("deprecation")
  public byte[] takeScreenshot() {
    ViewHierarchyAnalyzer viewAnalyzer = ViewHierarchyAnalyzer.getDefaultInstance();

    // TODO ddary review later, but with getRecentDecorView() it seems to work better
    // long drawingTime = 0;
    // View container = null;
    // for (View view : viewAnalyzer.getTopLevelViews()) {
    // if (view != null && view.isShown() && view.hasWindowFocus()
    // && view.getDrawingTime() > drawingTime) {
    // container = view;
    // drawingTime = view.getDrawingTime();
    // }
    // }
    // final View mainView = container;
    final View mainView = viewAnalyzer.getRecentDecorView();
    if (mainView == null) {
      throw new SelendroidException("No open windows.");
    }
    done = false;
    long end =
        System.currentTimeMillis() + serverInstrumentation.getAndroidWait().getTimeoutInMillis();
    final byte[][] rawPng = new byte[1][1];
    serverInstrumentation.getCurrentActivity().runOnUiThread(new Runnable() {
      public void run() {
        synchronized (syncObject) {
          Display display =
              serverInstrumentation.getCurrentActivity().getWindowManager().getDefaultDisplay();
          Point size = new Point();
          try {
            display.getSize(size);
          } catch (NoSuchMethodError ignore) { // Older than api level 13
            size.x = display.getWidth();
            size.y = display.getHeight();
          }

          // Get root view
          View view = mainView.getRootView();

          // Create the bitmap to use to draw the screenshot
          final Bitmap bitmap = Bitmap.createBitmap(size.x, size.y, Bitmap.Config.ARGB_8888);
          final Canvas canvas = new Canvas(bitmap);

          // Get current theme to know which background to use
          final Activity activity = serverInstrumentation.getCurrentActivity();
          final Theme theme = activity.getTheme();
          final TypedArray ta =
              theme.obtainStyledAttributes(new int[] {android.R.attr.windowBackground});
          final int res = ta.getResourceId(0, 0);
          final Drawable background = activity.getResources().getDrawable(res);

          // Draw background
          background.draw(canvas);

          // Draw views
          view.draw(canvas);

          ByteArrayOutputStream stream = new ByteArrayOutputStream();
          if (!bitmap.compress(Bitmap.CompressFormat.PNG, 70, stream)) {
            throw new RuntimeException("Error while compressing screenshot image.");
          }
          try {
            stream.flush();
            stream.close();
          } catch (IOException e) {
            throw new RuntimeException("I/O Error while capturing screenshot: " + e.getMessage());
          } finally {
            Closeable closeable = (Closeable) stream;
            try {
              if (closeable != null) {
                closeable.close();
              }
            } catch (IOException ioe) {
              // ignore
            }
          }
          rawPng[0] = stream.toByteArray();
          mainView.destroyDrawingCache();
          done = true;
          syncObject.notify();
        }
      }
    });

    waitForDone(end, serverInstrumentation.getAndroidWait().getTimeoutInMillis(),
        "Failed to take screenshot.");
    return rawPng[0];
  }
378236
public static void loadPhysicsFile(GVRContext gvrContext, String fileName, GVRScene scene) throws IOException
    {
        loadPhysicsFile(gvrContext, fileName, false, scene);
    }
943131
protected void setVisible(boolean visible) {
        GVRSceneObject sceneObject = gvrCursorController.getCursor();
        if (sceneObject != null && sceneObject.isEnabled() != visible) {
            sceneObject.setEnable(visible);
        }
    }
794298
def copy(self):
        
        # use the geometries copy method to
        # allow them to handle references to unpickle-able objects
        geometry = {n: g.copy() for n, g in self.geometry.items()}
        # create a new scene with copied geometry and graph
        copied = Scene(geometry=geometry,
                       graph=self.graph.copy())
        return copied
252058
static GVRPickedObject makeHit(long colliderPointer, float distance, float hitx, float hity, float hitz)
    {
        GVRCollider collider = GVRCollider.lookup(colliderPointer);
        if (collider == null)
        {
            Log.d(TAG, "makeHit: cannot find collider for %x", colliderPointer);
            return null;
        }
        return new GVRPicker.GVRPickedObject(collider, new float[] { hitx, hity, hitz }, distance);
    }
1135895
public static int getGraphicsDeviceIndexIsShowingOn(final Component component)
	{
		final GraphicsDevice graphicsDevice = getGraphicsDeviceIsShowingOn(component);
		final GraphicsDevice[] graphicsDevices = getAvailableScreens();
		for (int i = 0; i < graphicsDevices.length; i++)
		{
			if (graphicsDevices[i].equals(graphicsDevice))
			{
				return i;
			}
		}
		return 0;
	}
752950
public static synchronized GVRPeriodicEngine getInstance(GVRContext context) {
        if (sInstance == null) {
            sInstance = new GVRPeriodicEngine(context);
        }
        return sInstance;
    }
1370255
private Scene getScene(final StageWaveBean swb, final Region region) {

        Scene scene = swb.scene();
        if (scene == null) {
            scene = new Scene(region);
        } else {
            scene.setRoot(region);
        }

        return scene;
    }
744421
public GVRMesh findMesh(GVRSceneObject model)
    {
        class MeshFinder implements GVRSceneObject.ComponentVisitor
        {
            private GVRMesh meshFound = null;
            public GVRMesh getMesh() { return meshFound; }
            public boolean visit(GVRComponent comp)
            {
                GVRRenderData rdata = (GVRRenderData) comp;
                meshFound = rdata.getMesh();
                return (meshFound == null);
            }
        };
        MeshFinder findMesh = new MeshFinder();
        model.forAllComponents(findMesh, GVRRenderData.getComponentType());
        return findMesh.getMesh();
    }
687623
static private GVRMaterial getMaterial(final GVRContext gvrContext,
            JSONObject materialSpec) throws JSONException, IOException {

        GVRShaderId shaderId = getShaderId(materialSpec);
        GVRMaterial material = new GVRMaterial(gvrContext, shaderId);

        final Iterator<String> iter = materialSpec.keys();
        while (iter.hasNext()) {
            final String key = iter.next();
            switch (MaterialProperties.valueOf(key)) {
                case color:
                    final float[] color = getJSONColorGl(materialSpec,
                                                               key);
                    material.setColor(color[0], color[1], color[2]);
                    break;
                case ambient_color:
                    final float[] ambientColor = getJSONColorGl(materialSpec, key);
                    material.setAmbientColor(ambientColor[0], ambientColor[1],
                                             ambientColor[2], ambientColor[3]);
                    break;
                case diffuse_color:
                    final float[] diffuseColor = getJSONColorGl(materialSpec, key);
                    material.setDiffuseColor(diffuseColor[0], diffuseColor[1],
                                             diffuseColor[2], diffuseColor[3]);
                    break;
                case specular_color:
                    final float[] specularColor = getJSONColorGl(materialSpec, key);
                    material.setSpecularColor(specularColor[0],
                                              specularColor[1],
                                              specularColor[2],
                                              specularColor[3]);
                    break;
                case specular_exponent:
                    material.setSpecularExponent((float) materialSpec
                            .getDouble(key));
                    break;
                case opacity:
                    material.setOpacity((float) materialSpec.getDouble(key));
                    break;
            }
        }

        TextureFactory.loadMaterialTextures(material, materialSpec);

        return material;
    }
1360028
protected Rectangle getRadialMenuBounds (SceneObject scobj)
    {
        Rectangle mbounds = new Rectangle(scobj.bounds);
        Dimension radbox = getObjectRadialSize();
        if (mbounds.width != radbox.width) {
            mbounds.x += (mbounds.width-radbox.width)/2;
            mbounds.width = radbox.width;
        }
        if (mbounds.height != radbox.height) {
            mbounds.y += (mbounds.height-radbox.height)/2;
            mbounds.height = radbox.height;
        }
        return mbounds;
    }
803419
public Object copy(final Object pvRootObject) {
		Object lvSimple = makeSimple(pvRootObject);
		Object lvComplex = makeComplex(lvSimple);
		return lvComplex;
	}