Freigeben über


HardwareRenderer.SetLightSourceGeometry Method

Definition

Sets the center of the light source.

[Android.Runtime.Register("setLightSourceGeometry", "(FFFF)V", "GetSetLightSourceGeometry_FFFFHandler", ApiSince=29)]
public virtual void SetLightSourceGeometry (float lightX, float lightY, float lightZ, float lightRadius);
[<Android.Runtime.Register("setLightSourceGeometry", "(FFFF)V", "GetSetLightSourceGeometry_FFFFHandler", ApiSince=29)>]
abstract member SetLightSourceGeometry : single * single * single * single -> unit
override this.SetLightSourceGeometry : single * single * single * single -> unit

Parameters

lightX
Single

The X position of the light source

lightY
Single

The Y position of the light source

lightZ
Single

The Z position of the light source. Must be >= 0.

lightRadius
Single

The radius of the light source. Smaller radius will have sharper edges, larger radius will have softer shadows.

Attributes

Remarks

Sets the center of the light source. The light source point controls the directionality and shape of shadows rendered by RenderNode Z & elevation.

The platform's recommendation is to set lightX to 'displayWidth / 2f - windowLeft', set lightY to 0 - windowTop, lightZ set to 600dp, and lightRadius to 800dp.

The light source should be setup both as part of initial configuration, and whenever the window moves to ensure the light source stays anchored in display space instead of in window space.

This must be set at least once along with #setLightSourceAlpha(float, float) before shadows will work.

Java documentation for android.graphics.HardwareRenderer.setLightSourceGeometry(float, float, float, float).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to