Skip to content

SceneView: ambient light color #279

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberUpdatedState
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalLifecycleOwner
import androidx.compose.ui.semantics.contentDescription
Expand Down Expand Up @@ -78,6 +80,7 @@ import java.time.Instant
* @param spaceEffect the visual effect of outer space in the composable SceneView
* @param sunTime the position of the sun in the composable SceneView based on a specific date and time
* @param sunLighting the type of ambient sunlight and shadows in the composable SceneView
* @param ambientLightColor the color of the composable SceneView's ambient light
* @param onNavigationChanged lambda invoked when the navigation status of the composable SceneView has changed
* @param onSpatialReferenceChanged lambda invoked when the spatial reference of the composable SceneView has changed
* @param onLayerViewStateChanged lambda invoked when the composable SceneView's layer view state is changed
Expand Down Expand Up @@ -115,6 +118,7 @@ public fun SceneView(
spaceEffect: SpaceEffect = SpaceEffect.Stars,
sunTime: Instant = Instant.parse("2000-09-22T12:00:00Z"),
sunLighting: LightingMode = LightingMode.NoLight,
ambientLightColor: Color = Color(220, 220, 220, 255),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we using this default value?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the default value used by core, it is also documented on the view-based doc for SceneView.ambientLightColor

onNavigationChanged: ((isNavigating: Boolean) -> Unit)? = null,
onSpatialReferenceChanged: ((spatialReference: SpatialReference?) -> Unit)? = null,
onLayerViewStateChanged: ((GeoView.GeoViewLayerViewStateChanged) -> Unit)? = null,
Expand Down Expand Up @@ -149,6 +153,7 @@ public fun SceneView(
it.spaceEffect = spaceEffect
it.sunTime = sunTime
it.sunLighting = sunLighting
it.ambientLightColor = com.arcgismaps.Color(ambientLightColor.toArgb())
})

DisposableEffect(Unit) {
Expand Down