Beispiel #1
0
  /**
   * Updates the sky box textures with a bitmap array of length 6.
   *
   * @param bitmaps {@link Bitmap} array containing the cube map textures. The sequence of the
   *     bitmaps in array should be front, right, back, left, up, down, the same as in
   *     setSkybox(Bitmap[] bitmaps)
   * @throws Exception
   */
  public void updateSkybox(Bitmap[] bitmaps) throws Exception {
    if (mSkyboxTexture.getClass() != CubeMapTexture.class)
      throw new Exception("The skybox texture cannot be updated. It is not a cube map texture.");

    CubeMapTexture cubemap = (CubeMapTexture) mSkyboxTexture;
    cubemap.setBitmaps(bitmaps);
    mRenderer.getTextureManager().replaceTexture(cubemap);
  }
Beispiel #2
0
  /**
   * Updates the sky box textures with 6 new resource ids.
   *
   * @param front int Resource id for the front face.
   * @param right int Resource id for the right face.
   * @param back int Resource id for the back face.
   * @param left int Resource id for the left face.
   * @param up int Resource id for the up face.
   * @param down int Resource id for the down face.
   * @throws Exception
   */
  public void updateSkybox(int front, int right, int back, int left, int up, int down)
      throws Exception {
    if (mSkyboxTexture.getClass() != CubeMapTexture.class)
      throw new Exception("The skybox texture cannot be updated. It is not a cube map texture.");

    int[] resourceIds = new int[] {front, right, back, left, up, down};

    CubeMapTexture cubemap = (CubeMapTexture) mSkyboxTexture;
    cubemap.setResourceIds(resourceIds);
    mRenderer.getTextureManager().replaceTexture(cubemap);
  }
Beispiel #3
0
 /**
  * Creates a skybox with the specified 6 {@link Bitmap} textures.
  *
  * @param bitmaps {@link Bitmap} array containing the cube map textures.
  */
 public boolean setSkybox(Bitmap[] bitmaps) {
   final AFrameTask task =
       new AFrameTask() {
         @Override
         protected void doTask() {
           for (int i = 0, j = mCameras.size(); i < j; ++i) mCameras.get(i).setFarPlane(1000);
         }
       };
   final Cube skybox = new Cube(700, true);
   final CubeMapTexture texture = new CubeMapTexture("bitmap_skybox", bitmaps);
   texture.isSkyTexture(true);
   final Material material = new Material();
   material.setColorInfluence(0);
   try {
     material.addTexture(texture);
   } catch (TextureException e) {
     RajLog.e(e.getMessage());
   }
   skybox.setMaterial(material);
   synchronized (mNextCameraLock) {
     mNextSkybox = skybox;
   }
   return internalOfferTask(task);
 }
Beispiel #4
0
  /**
   * Creates a skybox with the specified 6 textures.
   *
   * @param posx int Resource id for the front face.
   * @param negx int Resource id for the right face.
   * @param posy int Resource id for the back face.
   * @param negy int Resource id for the left face.
   * @param posz int Resource id for the up face.
   * @param negz int Resource id for the down face.
   * @throws TextureException
   */
  public boolean setSkybox(int posx, int negx, int posy, int negy, int posz, int negz)
      throws TextureException {
    final AFrameTask task =
        new AFrameTask() {
          @Override
          protected void doTask() {
            for (int i = 0, j = mCameras.size(); i < j; ++i) mCameras.get(i).setFarPlane(1000);
          }
        };
    synchronized (mNextSkyboxLock) {
      mNextSkybox = new Cube(700, true);
      int[] resourceIds = new int[] {posx, negx, posy, negy, posz, negz};

      mSkyboxTexture = new CubeMapTexture("skybox", resourceIds);
      ((CubeMapTexture) mSkyboxTexture).isSkyTexture(true);
      Material mat = new Material();
      mat.setColorInfluence(0);
      mat.addTexture(mSkyboxTexture);
      mNextSkybox.setMaterial(mat);
    }
    return internalOfferTask(task);
  }