import { FragmentShader } from "https://deno.land/x/shader_canvas@v1.1.1/core/webgl_programs/shaders.ts";
This class implements the "load" function for the fragment shader. All other functionality is done by extending the ShaderCode class.
Methods
Simple wrapper for the ShaderCode.loadShader()
method.
Sets the shader type as a FRAGMENT_SHADER
Static Properties
<fragment-shader>
{#FragmentShader}
This tag holds the fragment shader code of a WebGL program. The code must be valid WebGL 2 GLSL. It is parsed and the variables analyzed and retrieved to allow Shader Canvas to be able to easily reference them and track their locations at compilation/linking time.
The allowed children for the <fragment-shader>
:
<code>
Plain HTML<code>
tag that holds the fragment code. Code tag is useful because it allows preformatted text as content.
Example
<shader-canvas>
<webgl-canvas>
<webgl-programs>
<some-program>
<vertex-shader>
<code>
<!--
Write the vertex shader code for
"some-program" here.
-->
</code>
</vertex-shader>
<fragment-shader>
<code>
#version 300 es
precision highp float;
out vec4 outColor;
void main() {
outColor = vec4(1, 0, 1, 1);
}
</code>
</fragment-shader>
</some-program>
</webgl-programs>
</webgl-canvas>
</shader-canvas>
For a usable example check the 1st example - simple triangle
The <fragment-shader>
tag is meant to be used as a child of the
<{{program-name}}>
custom named tag.