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/sun_effect.agsl 0 → 100644 +49 −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. */ uniform shader foreground; uniform shader background; uniform float2 uvOffsetFgd; uniform float2 uvScaleFgd; uniform float2 uvOffsetBgd; uniform float2 uvScaleBgd; uniform float screenAspectRatio; uniform float2 screenSize; uniform float time; uniform float intensity; #include "shaders/constants.agsl" #include "shaders/utils.agsl" #include "shaders/simplex2d.agsl" #include "shaders/lens_flare.agsl" vec4 main(float2 fragCoord) { float2 uv = fragCoord / screenSize; uv.y /= screenAspectRatio; vec4 colorForeground = foreground.eval(fragCoord * uvScaleFgd + uvOffsetFgd); vec4 color = background.eval(fragCoord * uvScaleBgd + uvOffsetBgd); // TODO(b/347299395): to add flare and sun effect background // add foreground color.rgb = normalBlend(color.rgb, colorForeground.rgb, colorForeground.a); // TODO(b/347299395): to add flare and sun effect foreground return color; } 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/sun_effect.agsl 0 → 100644 +49 −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. */ uniform shader foreground; uniform shader background; uniform float2 uvOffsetFgd; uniform float2 uvScaleFgd; uniform float2 uvOffsetBgd; uniform float2 uvScaleBgd; uniform float screenAspectRatio; uniform float2 screenSize; uniform float time; uniform float intensity; #include "shaders/constants.agsl" #include "shaders/utils.agsl" #include "shaders/simplex2d.agsl" #include "shaders/lens_flare.agsl" vec4 main(float2 fragCoord) { float2 uv = fragCoord / screenSize; uv.y /= screenAspectRatio; vec4 colorForeground = foreground.eval(fragCoord * uvScaleFgd + uvOffsetFgd); vec4 color = background.eval(fragCoord * uvScaleBgd + uvOffsetBgd); // TODO(b/347299395): to add flare and sun effect background // add foreground color.rgb = normalBlend(color.rgb, colorForeground.rgb, colorForeground.a); // TODO(b/347299395): to add flare and sun effect foreground return color; }