Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e97d445a authored by Michel Comin Escude's avatar Michel Comin Escude
Browse files

Add boilerplate sun effect

Bug: 347299395
Test: visual
Flag: EXEMPT MP apk not in build yet
Change-Id: I3d6bbcad3005ccdc2f748b131cb1c7ecc396f5d5
parent be71faed
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -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"
+1 −0
Original line number Diff line number Diff line
@@ -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>
+5 −0
Original line number Diff line number Diff line
@@ -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

+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
+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