Search in sources :

Example 6 with AFrameTask

use of org.rajawali3d.renderer.AFrameTask in project Rajawali by Rajawali.

the class Scene method setSkybox.

/**
     * 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);
}
Also used : TextureException(org.rajawali3d.materials.textures.ATexture.TextureException) AFrameTask(org.rajawali3d.renderer.AFrameTask) Cube(org.rajawali3d.primitives.Cube) Material(org.rajawali3d.materials.Material) ShadowMapMaterial(org.rajawali3d.postprocessing.materials.ShadowMapMaterial) CubeMapTexture(org.rajawali3d.materials.textures.CubeMapTexture)

Example 7 with AFrameTask

use of org.rajawali3d.renderer.AFrameTask in project Rajawali by Rajawali.

the class Scene method removeLight.

/**
	 * Requests the removal of a light from the scene.
	 *
	 * @param light {@link ALight} child to be removed.
	 * @return boolean True if the child was successfully queued for removal.
	 */
public boolean removeLight(final ALight light) {
    final AFrameTask task = new AFrameTask() {

        @Override
        protected void doTask() {
            mLights.remove(light);
            mLightsDirty = true;
        }
    };
    return internalOfferTask(task);
}
Also used : AFrameTask(org.rajawali3d.renderer.AFrameTask)

Example 8 with AFrameTask

use of org.rajawali3d.renderer.AFrameTask in project Rajawali by Rajawali.

the class Scene method addLight.

/**
	 * Requests the addition of a light to the scene. The light
	 * will be added to the end of the list.
	 *
	 * @param light {@link ALight} to be added.
	 * @return True if the light was successfully queued for addition.
	 */
public boolean addLight(final ALight light) {
    final AFrameTask task = new AFrameTask() {

        @Override
        protected void doTask() {
            mLights.add(light);
            mLightsDirty = true;
        }
    };
    return internalOfferTask(task);
}
Also used : AFrameTask(org.rajawali3d.renderer.AFrameTask)

Aggregations

AFrameTask (org.rajawali3d.renderer.AFrameTask)8 Material (org.rajawali3d.materials.Material)2 CubeMapTexture (org.rajawali3d.materials.textures.CubeMapTexture)2 ShadowMapMaterial (org.rajawali3d.postprocessing.materials.ShadowMapMaterial)2 Cube (org.rajawali3d.primitives.Cube)2 TextureException (org.rajawali3d.materials.textures.ATexture.TextureException)1