Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

大昔(2013年頃?)に某所で配布していたものを最近の環境でコンパイルし直したものになります。どこかしら不具合があるかも。

**ダウンロード**: [app-release.apk](https://github.com/106-/HellSinkerWallPaper/releases/download/v0.0.1/app-release.apk)
**ダウンロード**: [app-release.apk](https://github.com/106-/HellSinkerWallPaper/releases/download/v0.0.2/app-release.apk)

```
所詮 他愛ない模倣か……
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package net.t106.sinkerglwallpaper.config;

import android.opengl.GLES32;

/**
* Centralized blend mode management for OpenGL ES 3.2
* Eliminates duplicated blend function code across filter classes
*/
public class BlendModeManager {

// Blend mode constants matching SinkerService.blend_type
public static final int BLEND_ADDITIVE = 0;
public static final int BLEND_MULTIPLICATIVE = 1;
public static final int BLEND_ALPHA = 2;
public static final int BLEND_XOR = 3;
public static final int BLEND_INVERT = 4; // Special mode for right filter

/**
* Applies the specified blend mode
* @param blendMode The blend mode to apply
*/
public static void applyBlendMode(int blendMode) {
GLES32.glEnable(GLES32.GL_BLEND);

switch(blendMode) {
case BLEND_ADDITIVE:
// Additive blending: add colors together
GLES32.glBlendFunc(GLES32.GL_ONE, GLES32.GL_ONE);
break;

case BLEND_MULTIPLICATIVE:
// Multiplicative blending: multiply colors
GLES32.glBlendFunc(GLES32.GL_ZERO, GLES32.GL_SRC_COLOR);
break;

case BLEND_ALPHA:
// Alpha blending with additive component
GLES32.glBlendFunc(GLES32.GL_SRC_ALPHA, GLES32.GL_ONE);
break;

case BLEND_XOR:
// XOR-like blending: exclusive or effect
GLES32.glBlendFunc(GLES32.GL_ONE_MINUS_DST_COLOR, GLES32.GL_ONE_MINUS_SRC_COLOR);
break;

case BLEND_INVERT:
// Invert blending: invert destination color
GLES32.glBlendFunc(GLES32.GL_ONE_MINUS_DST_COLOR, GLES32.GL_ZERO);
break;

default:
// Default to standard alpha blending
GLES32.glBlendFunc(GLES32.GL_SRC_ALPHA, GLES32.GL_ONE_MINUS_SRC_ALPHA);
break;
}
}

/**
* Disables blending
*/
public static void disableBlending() {
GLES32.glDisable(GLES32.GL_BLEND);
}

/**
* Gets a human-readable name for a blend mode
* @param blendMode The blend mode
* @return Descriptive name
*/
public static String getBlendModeName(int blendMode) {
switch(blendMode) {
case BLEND_ADDITIVE: return "Additive";
case BLEND_MULTIPLICATIVE: return "Multiplicative";
case BLEND_ALPHA: return "Alpha";
case BLEND_XOR: return "XOR";
case BLEND_INVERT: return "Invert";
default: return "Default";
}
}

/**
* Checks if a blend mode is valid
* @param blendMode The blend mode to check
* @return True if valid
*/
public static boolean isValidBlendMode(int blendMode) {
return blendMode >= BLEND_ADDITIVE && blendMode <= BLEND_INVERT;
}
}
178 changes: 178 additions & 0 deletions app/src/main/java/net/t106/sinkerglwallpaper/config/RenderConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
package net.t106.sinkerglwallpaper.config;

import net.t106.sinkerglwallpaper.config.BlendModeManager;

/**
* Configuration classes for data-driven rendering
* Eliminates hardcoded values and enables flexible object behavior
*/
public class RenderConfig {

/**
* Configuration for rotating objects
*/
public static class RotationConfig {
public final float rotationSpeed;
public final int maxCount;
public final boolean clockwise;

public RotationConfig(float rotationSpeed, int maxCount, boolean clockwise) {
this.rotationSpeed = rotationSpeed;
this.maxCount = maxCount;
this.clockwise = clockwise;
}

// Predefined configurations
public static final RotationConfig CENTER = new RotationConfig(-0.125f, 2881, false);
public static final RotationConfig BACKGROUND = new RotationConfig(0.125f, 2880, true);
}

/**
* Configuration for colors
*/
public static class ColorConfig {
public final float red;
public final float green;
public final float blue;
public final float alpha;

public ColorConfig(float red, float green, float blue, float alpha) {
this.red = red;
this.green = green;
this.blue = blue;
this.alpha = alpha;
}

// Predefined colors
public static final ColorConfig WHITE = new ColorConfig(1.0f, 1.0f, 1.0f, 1.0f);
public static final ColorConfig REDDISH_BROWN = new ColorConfig(0.375f, 0.04f, 0.09f, 0.5f);
public static final ColorConfig PINKISH = new ColorConfig(1.0f, 0.5f, 0.5f, 0.5f);

/**
* Creates a color config from user settings (0-100 range)
*/
public static ColorConfig fromUserSettings(int[] col) {
return new ColorConfig(
col[0] / 100.0f,
col[1] / 100.0f,
col[2] / 100.0f,
col[3] / 100.0f
);
}
}

/**
* Configuration for textures
*/
public static class TextureConfig {
public final int textureIndex;
public final boolean useTexture;

public TextureConfig(int textureIndex, boolean useTexture) {
this.textureIndex = textureIndex;
this.useTexture = useTexture;
}

// Predefined texture configurations
public static final TextureConfig TEXTURE_0 = new TextureConfig(0, true);
public static final TextureConfig TEXTURE_1 = new TextureConfig(1, true);
public static final TextureConfig NO_TEXTURE = new TextureConfig(0, false);
}

/**
* Configuration for geometry
*/
public static class GeometryConfig {
public final float[] vertices;
public final float[] texCoords;
public final float scale;

public GeometryConfig(float[] vertices, float[] texCoords, float scale) {
this.vertices = vertices.clone();
this.texCoords = texCoords.clone();
this.scale = scale;
}

// Predefined geometry configurations
public static final GeometryConfig STANDARD_QUAD = new GeometryConfig(
new float[] { -1f, -1f, 1f, -1f, -1f, 1f, 1f, 1f },
new float[] { 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f },
1.0f
);

public static final GeometryConfig LARGE_QUAD = new GeometryConfig(
new float[] { -1.5f, -1.5f, 1.5f, -1.5f, -1.5f, 1.5f, 1.5f, 1.5f },
new float[] { 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f },
1.5f
);

/**
* Creates a right-side filter geometry
*/
public static GeometryConfig createRightFilter(boolean smallSize) {
if (smallSize) {
return new GeometryConfig(
new float[] { 0f, -1.5f, 0.5f, -1.5f, 0f, 1.5f, 0.5f, 1.5f },
new float[] { 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f },
0.5f
);
} else {
return new GeometryConfig(
new float[] { 0f, -1.5f, 0.7f, -1.5f, 0f, 1.5f, 0.7f, 1.5f },
new float[] { 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f },
0.7f
);
}
}

/**
* Creates a left filter geometry (center overlay)
*/
public static GeometryConfig createLeftFilter(boolean smallSize) {
if (smallSize) {
return new GeometryConfig(
new float[] { -0.5f, -1.5f, 0.5f, -1.5f, -0.5f, 1.5f, 0.5f, 1.5f },
new float[] { 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f },
1.0f
);
} else {
return new GeometryConfig(
new float[] { -0.7f, -1.5f, 0.7f, -1.5f, -0.7f, 1.5f, 0.7f, 1.5f },
new float[] { 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f },
1.4f
);
}
}
}

/**
* Complete rendering configuration combining all aspects
*/
public static class CompleteConfig {
public final RotationConfig rotation;
public final ColorConfig color;
public final TextureConfig texture;
public final GeometryConfig geometry;
public final int blendMode;

public CompleteConfig(RotationConfig rotation, ColorConfig color,
TextureConfig texture, GeometryConfig geometry, int blendMode) {
this.rotation = rotation;
this.color = color;
this.texture = texture;
this.geometry = geometry;
this.blendMode = blendMode;
}

// Predefined complete configurations
public static final CompleteConfig CENTER_GRAVEYARD = new CompleteConfig(
RotationConfig.CENTER, ColorConfig.WHITE, TextureConfig.TEXTURE_0,
GeometryConfig.STANDARD_QUAD, BlendModeManager.BLEND_ADDITIVE
);

public static final CompleteConfig BACKGROUND_GRAVEYARD = new CompleteConfig(
RotationConfig.BACKGROUND, ColorConfig.REDDISH_BROWN, TextureConfig.TEXTURE_1,
GeometryConfig.LARGE_QUAD, BlendModeManager.BLEND_ADDITIVE
);
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package net.t106.sinkerglwallpaper;
package net.t106.sinkerglwallpaper.opengl.shaders;

import android.content.Context;
import android.content.res.AssetManager;
import android.util.Log;
import net.t106.sinkerglwallpaper.opengl.utils.ShaderUtils;

import java.io.BufferedReader;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.t106.sinkerglwallpaper;
package net.t106.sinkerglwallpaper.opengl.utils;

import android.opengl.GLES32;
import java.nio.ByteBuffer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.t106.sinkerglwallpaper;
package net.t106.sinkerglwallpaper.opengl.utils;

import android.opengl.Matrix;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.t106.sinkerglwallpaper;
package net.t106.sinkerglwallpaper.opengl.utils;

import android.opengl.GLES32;
import android.util.Log;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.t106.sinkerglwallpaper;
package net.t106.sinkerglwallpaper.opengl.utils;

import android.content.Context;
import android.graphics.Bitmap;
Expand Down
Loading