use of org.rajawali3d.renderer.AFrameTask in project Rajawali by Rajawali.
the class Scene method addChild.
/**
* Requests the addition of a child to the scene. The child
* will be added to the end of the list.
*
* @param child {@link Object3D} child to be added.
* @return True if the child was successfully queued for addition.
*/
public boolean addChild(final Object3D child) {
final AFrameTask task = new AFrameTask() {
@Override
protected void doTask() {
mChildren.add(child);
if (mSceneGraph != null) {
//mSceneGraph.addObject(child); //TODO: Uncomment
}
addShadowMapMaterialPlugin(child, mShadowMapMaterial == null ? null : mShadowMapMaterial.getMaterialPlugin());
}
};
return internalOfferTask(task);
}
use of org.rajawali3d.renderer.AFrameTask in project Rajawali by Rajawali.
the class Scene method clearFrameCallbacks.
/**
* Removes all {@link ASceneFrameCallback} objects from the scene.
*
* @return {@code boolean} True if the clear task was queued successfully.
*/
public boolean clearFrameCallbacks() {
final AFrameTask task = new AFrameTask() {
@Override
protected void doTask() {
mPreCallbacks.clear();
mPreDrawCallbacks.clear();
mPostCallbacks.clear();
}
};
return internalOfferTask(task);
}
use of org.rajawali3d.renderer.AFrameTask in project Rajawali by Rajawali.
the class Scene method setSkybox.
/**
* 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);
}
use of org.rajawali3d.renderer.AFrameTask in project Rajawali by Rajawali.
the class Scene method clearLights.
/**
* Requests the removal of all lights from the scene.
*
* @return boolean True if the light was successfully queued for removal.
*/
public boolean clearLights() {
final AFrameTask task = new AFrameTask() {
@Override
protected void doTask() {
mLights.clear();
mLightsDirty = true;
}
};
return internalOfferTask(task);
}
use of org.rajawali3d.renderer.AFrameTask in project Rajawali by Rajawali.
the class Scene method performFrameTasks.
/**
* Internal method for performing frame tasks. Should be called at the
* start of onDrawFrame() prior to render().
*/
private void performFrameTasks() {
synchronized (mFrameTaskQueue) {
//Fetch the first task
AFrameTask task = mFrameTaskQueue.poll();
while (task != null) {
task.run();
//Retrieve the next task
task = mFrameTaskQueue.poll();
}
}
}
Aggregations