Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

806 B
Raw Blame
#pragma shader "ParticleMaterialTest"
#pragma version 300 es
#pragma domain Unlit
#pragma param u_tint color default(1,1,1,1)

// Colour entirely from the material, shape still from the texture: a particle
// drawn WITHOUT this material keeps its own green, so the two are told apart by
// the pixel rather than by both being plausible.
#pragma fragment
precision mediump float;

in vec4 v_color;
in vec2 v_texCoord;

uniform sampler2D u_textures[8];

out vec4 fragColor;

void main() {
    float a = texture(u_textures[0], v_texCoord).a * v_color.a;
    fragColor = vec4(u_tint.rgb, a);
}
#pragma end

#pragma fragment wgsl
@fragment fn fs_main(v : VSOut) -> @location(0) vec4f {
    let a = textureSampleLevel(t0, s0, v.v_texCoord, 0.0).a * v.v_color.a;
    return vec4f(mc.u_tint.rgb, a);
}
#pragma end