public AmbientCubemap add (final float r, final float g, final float b, final Vector3 direction) { return add(r, g, b, direction.x, direction.y, direction.z); }
public AmbientCubemap add (final Color color) { return add(color.r, color.g, color.b); }
public AmbientCubemap add (final Color color) { return add(color.r, color.g, color.b); }
public AmbientCubemap add (final Color color, final float x, final float y, final float z) { return add(color.r, color.g, color.b, x, y, z); }
public AmbientCubemap add (final Color color, final Vector3 direction) { return add(color.r, color.g, color.b, direction.x, direction.y, direction.z); }
public AmbientCubemap add (final float r, final float g, final float b, final Vector3 direction) { return add(r, g, b, direction.x, direction.y, direction.z); }
public AmbientCubemap add (final Color color, final float x, final float y, final float z) { return add(color.r, color.g, color.b, x, y, z); }
public AmbientCubemap add (final Color color, final Vector3 point, final Vector3 target) { return add(color.r, color.g, color.b, target.x - point.x, target.y - point.y, target.z - point.z); }
public AmbientCubemap add (final Color color, final Vector3 direction) { return add(color.r, color.g, color.b, direction.x, direction.y, direction.z); }
public AmbientCubemap add (final Color color, final Vector3 point, final Vector3 target) { return add(color.r, color.g, color.b, target.x - point.x, target.y - point.y, target.z - point.z); }
public AmbientCubemap add (final Color color, final Vector3 point, final Vector3 target, final float intensity) { final float t = intensity / (1f + target.dst(point)); return add(color.r * t, color.g * t, color.b * t, target.x - point.x, target.y - point.y, target.z - point.z); }
public AmbientCubemap add (final Color color, final Vector3 point, final Vector3 target, final float intensity) { final float t = intensity / (1f + target.dst(point)); return add(color.r * t, color.g * t, color.b * t, target.x - point.x, target.y - point.y, target.z - point.z); }
@Override public void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { if (renderable.environment == null) shader.program.setUniform3fv(shader.loc(inputID), ones, 0, ones.length); else { renderable.worldTransform.getTranslation(tmpV1); if (combinedAttributes.has(ColorAttribute.AmbientLight)) cacheAmbientCubemap.set(((ColorAttribute)combinedAttributes.get(ColorAttribute.AmbientLight)).color); if (combinedAttributes.has(DirectionalLightsAttribute.Type)) { Array<DirectionalLight> lights = ((DirectionalLightsAttribute)combinedAttributes .get(DirectionalLightsAttribute.Type)).lights; for (int i = dirLightsOffset; i < lights.size; i++) cacheAmbientCubemap.add(lights.get(i).color, lights.get(i).direction); } if (combinedAttributes.has(PointLightsAttribute.Type)) { Array<PointLight> lights = ((PointLightsAttribute)combinedAttributes.get(PointLightsAttribute.Type)).lights; for (int i = pointLightsOffset; i < lights.size; i++) cacheAmbientCubemap.add(lights.get(i).color, lights.get(i).position, tmpV1, lights.get(i).intensity); } cacheAmbientCubemap.clamp(); shader.program.setUniform3fv(shader.loc(inputID), cacheAmbientCubemap.data, 0, cacheAmbientCubemap.data.length); } } }
@Override public void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) { if (renderable.environment == null) shader.program.setUniform3fv(shader.loc(inputID), ones, 0, ones.length); else { renderable.worldTransform.getTranslation(tmpV1); if (combinedAttributes.has(ColorAttribute.AmbientLight)) cacheAmbientCubemap.set(((ColorAttribute)combinedAttributes.get(ColorAttribute.AmbientLight)).color); if (combinedAttributes.has(DirectionalLightsAttribute.Type)) { Array<DirectionalLight> lights = ((DirectionalLightsAttribute)combinedAttributes .get(DirectionalLightsAttribute.Type)).lights; for (int i = dirLightsOffset; i < lights.size; i++) cacheAmbientCubemap.add(lights.get(i).color, lights.get(i).direction); } if (combinedAttributes.has(PointLightsAttribute.Type)) { Array<PointLight> lights = ((PointLightsAttribute)combinedAttributes.get(PointLightsAttribute.Type)).lights; for (int i = pointLightsOffset; i < lights.size; i++) cacheAmbientCubemap.add(lights.get(i).color, lights.get(i).position, tmpV1, lights.get(i).intensity); } cacheAmbientCubemap.clamp(); shader.program.setUniform3fv(shader.loc(inputID), cacheAmbientCubemap.data, 0, cacheAmbientCubemap.data.length); } } }
public AmbientCubemap add (final float r, final float g, final float b, final Vector3 direction) { return add(r, g, b, direction.x, direction.y, direction.z); }
public AmbientCubemap add (final Color color, final Vector3 point, final Vector3 target) { return add(color.r, color.g, color.b, target.x - point.x, target.y - point.y, target.z - point.z); }
public AmbientCubemap add (final Color color) { return add(color.r, color.g, color.b); }
public AmbientCubemap add (final Color color, final Vector3 direction) { return add(color.r, color.g, color.b, direction.x, direction.y, direction.z); }
public AmbientCubemap add (final Color color, final float x, final float y, final float z) { return add(color.r, color.g, color.b, x, y, z); }
public AmbientCubemap add (final Color color, final Vector3 point, final Vector3 target, final float intensity) { final float t = intensity / (1f + target.dst(point)); return add(color.r * t, color.g * t, color.b * t, target.x - point.x, target.y - point.y, target.z - point.z); }