color Library Method
Signature: sc.color ()
Class: taccglShaderConfig Class
This is initially an empty method that you can override to customize the fragment shader.
The code can modify the variable col which contains the color of the current fragment
(as vec3) or a which contains its opacity. The shader already blended both
texture canvases and the directly specified color leading to col and a.
Afterwards still lighting calculations will be applied to col and a.
By assigning a=0.0, i.e. making a fragment transparent, the fragment can effectively
be deleted. Note that col contains the color in premultiplied alpha form, so all color
values must be in the range from 0.0 to a.
Examples
var s=taccgl.ssc('ShaderSample2');var b=taccgl.actor("testimg").sc(s).dur(2).start(); | RUN |
<script id="ShaderSample2" type="x-gsgl/x-shader"> :color col = vec3(1.0,1.0,1.0)*a-col; </script> |
|
var s=taccgl.ssc('ShaderSample3').times().dynTex(); var b=taccgl.actor(document.body).sc(s).dur(2).start(); | RUN |
<script id="ShaderSample3" type="x-gsgl/x-shader"> :color if (s*t>ct/4.0) a=0.0; </script> |
|
WebGL™ is a trademark of the Khronos Group Inc.
|