Search in sources :

Example 1 with FogMaterialPlugin

use of org.rajawali3d.materials.plugins.FogMaterialPlugin in project Rajawali by Rajawali.

the class Scene method updateChildMaterialWithLights.

/**
	 * Update the lights on this child's material. This method should only
	 * be called when the lights collection is dirty. It will
	 * trigger compilation of all light-enabled shaders.
	 *
	 * @param child
	 */
private void updateChildMaterialWithLights(Object3D child) {
    Material material = child.getMaterial();
    if (material != null && material.lightingEnabled())
        material.setLights(mLights);
    if (material != null && mFogParams != null)
        material.addPlugin(new FogMaterialPlugin(mFogParams));
    int numChildren = child.getNumChildren();
    for (int i = 0; i < numChildren; i++) {
        Object3D grandChild = child.getChildAt(i);
        updateChildMaterialWithLights(grandChild);
    }
}
Also used : Material(org.rajawali3d.materials.Material) ShadowMapMaterial(org.rajawali3d.postprocessing.materials.ShadowMapMaterial) FogMaterialPlugin(org.rajawali3d.materials.plugins.FogMaterialPlugin) Object3D(org.rajawali3d.Object3D)

Aggregations

Object3D (org.rajawali3d.Object3D)1 Material (org.rajawali3d.materials.Material)1 FogMaterialPlugin (org.rajawali3d.materials.plugins.FogMaterialPlugin)1 ShadowMapMaterial (org.rajawali3d.postprocessing.materials.ShadowMapMaterial)1