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.

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

// Fragment only: the engine owns the vertex stage, which is what lets the same
// material be compiled for a second vertex source (a GPU-resident mesh).
#pragma fragment
precision mediump float;

in vec4 v_color;
in vec2 v_texCoord;

out vec4 fragColor;

void main() {
    fragColor = v_color * u_tint;
}
#pragma end

#pragma fragment wgsl
// No VSOut here: the engine's canonical vertex owns that interface and injects
// it into a fragment-only twin.
@fragment fn fs_main(v : VSOut) -> @location(0) vec4f {
    return v.v_color * mc.u_tint;
}
#pragma end