示例#1
0
 /**
  * Creates a skybox with the specified single texture.
  *
  * @param resourceId int Resouce id of the skybox texture.
  * @throws TextureException
  * @return {@code boolean} True if the clear task was queued successfully.
  */
 public boolean setSkybox(int resourceId) 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, false);
     mNextSkybox.setDoubleSided(true);
     mSkyboxTexture = new Texture("skybox", resourceId);
     Material material = new Material();
     material.setColorInfluence(0);
     material.addTexture(mSkyboxTexture);
     mNextSkybox.setMaterial(material);
   }
   return internalOfferTask(task);
 }
示例#2
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);
  }
示例#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);
 }