Loading weathereffects/debug/res/layout/debug_activity.xml +10 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,16 @@ android:text="@string/button_snow" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintBottom_toTopOf="@id/sunny" app:layout_constraintEnd_toEndOf="parent" android:layout_marginBottom="10dp" android:layout_marginEnd="20dp" /> <Button android:id="@+id/sunny" android:text="@string/button_sunny" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintBottom_toTopOf="@id/clear" app:layout_constraintEnd_toEndOf="parent" android:layout_marginBottom="10dp" Loading weathereffects/debug/res/values/strings.xml +1 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ <string name="button_rain" translatable="false">Rain</string> <string name="button_fog" translatable="false">Fog</string> <string name="button_snow" translatable="false">Snow</string> <string name="button_sunny" translatable="false">Sun</string> <string name="button_clear" translatable="false">Clear Weather</string> <string name="change_asset" translatable="false">Change Asset</string> </resources> weathereffects/debug/src/com/google/android/wallpaper/weathereffects/WallpaperEffectsDebugActivity.kt +5 −0 Original line number Diff line number Diff line Loading @@ -112,6 +112,11 @@ class WallpaperEffectsDebugActivity : TorusViewerActivity() { updateWallpaper() setDebugText(context.getString(R.string.generating)) } rootView.requireViewById<Button>(R.id.sunny).setOnClickListener { weatherEffect = WallpaperInfoContract.WeatherEffect.SUN updateWallpaper() setDebugText(context.getString(R.string.generating)) } rootView.requireViewById<Button>(R.id.clear).setOnClickListener { weatherEffect = null Loading weathereffects/graphics/assets/shaders/lens_flare.agsl 0 → 100644 +17 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // TODO(b/347299395): to add flare weathereffects/graphics/assets/shaders/rain_glass_layer.agsl +6 −8 Original line number Diff line number Diff line Loading @@ -26,18 +26,16 @@ uniform half intensity; #include "shaders/rain_constants.agsl" vec4 main(float2 fragCoord) { // 0. Add a bit of noise so that the droplets are not perfect circles. fragCoord += vec2(valueNoise(fragCoord) * 0.015 - 0.0025); float2 uv = fragCoord / screenSize; // 0. Calculate UV and add a bit of noise so that the droplets are not perfect circles. float2 uv = vec2(valueNoise(fragCoord) * 0.015 - 0.0025) + fragCoord / screenSize; // 1. Generate small glass rain. GlassRain smallDrippingRain = generateGlassRain( uv, screenAspectRatio, time, time * 0.7, /* Grid size = */ vec2(4.0, 2.0), intensity); intensity * 0.6); float dropMask = smallDrippingRain.dropMask; float droppletsMask = smallDrippingRain.droppletsMask; float trailMask = smallDrippingRain.trailMask; Loading @@ -48,9 +46,9 @@ vec4 main(float2 fragCoord) { GlassRain medDrippingRain = generateGlassRain( uv, screenAspectRatio, time * 1.267, time * 0.8869, /* Grid size = */ vec2(3.5, 1.5), intensity); intensity * 0.6); // 3. Combine those two glass rains. dropMask = max(medDrippingRain.dropMask, dropMask); Loading Loading
weathereffects/debug/res/layout/debug_activity.xml +10 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,16 @@ android:text="@string/button_snow" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintBottom_toTopOf="@id/sunny" app:layout_constraintEnd_toEndOf="parent" android:layout_marginBottom="10dp" android:layout_marginEnd="20dp" /> <Button android:id="@+id/sunny" android:text="@string/button_sunny" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintBottom_toTopOf="@id/clear" app:layout_constraintEnd_toEndOf="parent" android:layout_marginBottom="10dp" Loading
weathereffects/debug/res/values/strings.xml +1 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ <string name="button_rain" translatable="false">Rain</string> <string name="button_fog" translatable="false">Fog</string> <string name="button_snow" translatable="false">Snow</string> <string name="button_sunny" translatable="false">Sun</string> <string name="button_clear" translatable="false">Clear Weather</string> <string name="change_asset" translatable="false">Change Asset</string> </resources>
weathereffects/debug/src/com/google/android/wallpaper/weathereffects/WallpaperEffectsDebugActivity.kt +5 −0 Original line number Diff line number Diff line Loading @@ -112,6 +112,11 @@ class WallpaperEffectsDebugActivity : TorusViewerActivity() { updateWallpaper() setDebugText(context.getString(R.string.generating)) } rootView.requireViewById<Button>(R.id.sunny).setOnClickListener { weatherEffect = WallpaperInfoContract.WeatherEffect.SUN updateWallpaper() setDebugText(context.getString(R.string.generating)) } rootView.requireViewById<Button>(R.id.clear).setOnClickListener { weatherEffect = null Loading
weathereffects/graphics/assets/shaders/lens_flare.agsl 0 → 100644 +17 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // TODO(b/347299395): to add flare
weathereffects/graphics/assets/shaders/rain_glass_layer.agsl +6 −8 Original line number Diff line number Diff line Loading @@ -26,18 +26,16 @@ uniform half intensity; #include "shaders/rain_constants.agsl" vec4 main(float2 fragCoord) { // 0. Add a bit of noise so that the droplets are not perfect circles. fragCoord += vec2(valueNoise(fragCoord) * 0.015 - 0.0025); float2 uv = fragCoord / screenSize; // 0. Calculate UV and add a bit of noise so that the droplets are not perfect circles. float2 uv = vec2(valueNoise(fragCoord) * 0.015 - 0.0025) + fragCoord / screenSize; // 1. Generate small glass rain. GlassRain smallDrippingRain = generateGlassRain( uv, screenAspectRatio, time, time * 0.7, /* Grid size = */ vec2(4.0, 2.0), intensity); intensity * 0.6); float dropMask = smallDrippingRain.dropMask; float droppletsMask = smallDrippingRain.droppletsMask; float trailMask = smallDrippingRain.trailMask; Loading @@ -48,9 +46,9 @@ vec4 main(float2 fragCoord) { GlassRain medDrippingRain = generateGlassRain( uv, screenAspectRatio, time * 1.267, time * 0.8869, /* Grid size = */ vec2(3.5, 1.5), intensity); intensity * 0.6); // 3. Combine those two glass rains. dropMask = max(medDrippingRain.dropMask, dropMask); Loading