Пример #1
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);
  }
Пример #2
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);
 }