正在查看: Kreate v1.5.0 应用的 Stripy.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Kreate v1.5.0 应用的 Stripy.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.mikepenz.hypnoticcanvas.shaders;
import com.mikepenz.hypnoticcanvas.RuntimeEffect;
import com.mikepenz.hypnoticcanvas.shaders.Shader;
import kotlin.Metadata;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
@Metadata(d1 = {"\u0000(\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0007\n\u0002\b\u0005\n\u0002\u0010\u000e\n\u0002\b\u0011\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\b\u0007\u0018\u00002\u00020\u0001B\u0011\u0012\b\b\u0002\u0010\u0002\u001a\u00020\u0003¢\u0006\u0004\b\u0004\u0010\u0005J(\u0010\u001a\u001a\u00020\u001b2\u0006\u0010\u001c\u001a\u00020\u001d2\u0006\u0010\u001e\u001a\u00020\u00032\u0006\u0010\u001f\u001a\u00020\u00032\u0006\u0010 \u001a\u00020\u0003H\u0016R\u0011\u0010\u0002\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\u0006\u0010\u0007R\u0014\u0010\b\u001a\u00020\t8VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\n\u0010\u000bR\u0014\u0010\f\u001a\u00020\t8VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\r\u0010\u000bR\u0014\u0010\u000e\u001a\u00020\t8VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u000f\u0010\u000bR\u0014\u0010\u0010\u001a\u00020\t8VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u0011\u0010\u000bR\u0014\u0010\u0012\u001a\u00020\t8VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u0013\u0010\u000bR\u0014\u0010\u0014\u001a\u00020\t8VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u0015\u0010\u000bR\u0014\u0010\u0016\u001a\u00020\u00038VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u0017\u0010\u0007R\u0014\u0010\u0018\u001a\u00020\tX\u0096D¢\u0006\b\n\u0000\u001a\u0004\b\u0019\u0010\u000b¨\u0006!"}, d2 = {"Lcom/mikepenz/hypnoticcanvas/shaders/Stripy;", "Lcom/mikepenz/hypnoticcanvas/shaders/Shader;", "gamma", "", "<init>", "(F)V", "getGamma", "()F", "name", "", "getName", "()Ljava/lang/String;", "authorName", "getAuthorName", "authorUrl", "getAuthorUrl", "credit", "getCredit", "license", "getLicense", "licenseUrl", "getLicenseUrl", "speedModifier", "getSpeedModifier", "sksl", "getSksl", "applyUniforms", "", "runtimeEffect", "Lcom/mikepenz/hypnoticcanvas/RuntimeEffect;", "time", "width", "height", "hypnoticcanvas-shaders_release"}, k = 1, mv = {2, 0, 0}, xi = 48)
public final class Stripy implements Shader {
public static final int $stable = 0;
private final float gamma;
private final String sksl;
public Stripy() {
this(0.0f, 1, null);
}
@Override
public float getSpeedModifier() {
return 0.1f;
}
public Stripy(float f) {
this.gamma = f;
this.sksl = "\nuniform float gamma;\nuniform float uTime;\nuniform vec3 uResolution;\n\n//For when the derivatives must be manually calculated\nfloat antialias_l2_dxy(float d, vec2 dxy)\n{\n //Get gradient width\n float width = length(dxy);\n //Calculate reciprocal scale (avoid division by 0!)\n float scale = width>0.0? 1.0/width : 1e7;\n //Normalize the gradient d with it's scale\n return clamp(0.5 + 0.7 * scale * d, 0.0, 1.0);\n}\n//Sine-base hue function\nvec3 color(float index)\n{\n return cos(index+vec3(0,2,4))*0.5+0.5;\n}\n\nvec4 main( vec2 fragCoord )\n{\n //Normalize screen coordinates (aspect ratio corrected)\n vec2 uv = (fragCoord-0.5*uResolution.xy) / uResolution.y;\n\n //Generate a little pattern\n float value = cos(uv.x*9.)*cos(uv.y*9.)*3.+uv.x*7.+uv.y*9.+uTime;\n \n //Get the gradient from the pattern\n float stripe_grad = value;\n //Break into stripe steps\n float stripe_step = floor(stripe_grad + 0.5);\n //Find the gradient to the nearest edge\n float stripe_frac = stripe_grad - stripe_step;\n \n //Calculate the derivatives on the continous gradient\n vec2 dxy = vec2(stripe_grad, stripe_grad);\n \n //Blend between the two nearest stripes\n vec3 c1 = color(stripe_step+0.0);\n vec3 c2 = color(stripe_step+1.0);\n //Anti-aliasing like normal\n vec3 col = mix(c1, c2, antialias_l2_dxy(stripe_frac,dxy));\n\n // Output to screen\n return vec4(pow(col, 1.0/vec3(gamma)),1.0);\n}\n ";
}
public Stripy(float f, int i, DefaultConstructorMarker defaultConstructorMarker) {
this((i & 1) != 0 ? 2.2f : f);
}
public final float getGamma() {
return this.gamma;
}
@Override
public String getName() {
return "Stripy";
}
@Override
public String getAuthorName() {
return "Xor";
}
@Override
public String getAuthorUrl() {
return "https://www.shadertoy.com/user/Xor";
}
@Override
public String getCredit() {
return "https://www.shadertoy.com/view/l3VcWG";
}
@Override
public String getLicense() {
return "Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License";
}
@Override
public String getLicenseUrl() {
return "https://www.shadertoy.com/terms";
}
@Override
public String getSksl() {
return this.sksl;
}
@Override
public void applyUniforms(RuntimeEffect runtimeEffect, float time, float width, float height) {
Intrinsics.checkNotNullParameter(runtimeEffect, "runtimeEffect");
Shader.DefaultImpls.applyUniforms(this, runtimeEffect, time, width, height);
runtimeEffect.setFloatUniform("gamma", this.gamma);
}
}