跳转到内容

ShaderParamType

此内容尚不支持你的语言。

ShaderParamType = "float" | "vec2" | "vec3" | "vec4" | "color" | "int" | "texture"

Defined in: render/shaderReflect.ts:24

shaderReflect.ts

What a .esshader’s #pragma param lines declare, read from the source.

Parses the same param grammar the engine’s C++ ShaderParser does, but only the declaration metadata (name / type / default / range / ui hint / display name). The engine remains the single source of the std140 layout + GLSL codegen; this is the static view of the declarations, for everything that needs to know a shader’s parameter vocabulary without compiling one.

Three things read it, which is why it lives here rather than in the editor where
it started: the Material inspector builds its parameter panel from it, the built-in
templates derive their material defaults from it (so the defaults cannot drift from
the shader that consumes them), and `Material.setUniform` uses it to tell a caller
that the name it just wrote is not one this shader has — a value the engine would
otherwise drop without a word.
Grammar (matches ShaderParser):
#pragma param <name> <type> [default(csv)] [range(min,max)] [ui(hint)]
#pragma domain <Unlit2D|Lit2D|PostProcess|UI>