📄 normalrect.fp
字号:
!!FP1.0
#here compute the normal of a vector which in a 2d Texture
#add all elements together into ONE element
#HERE Texture Unit----RECT, just ONE channel
DECLARE TexOffset ={0,0,0,0};
#sample the current position (i,j)
TEX R0, f[WPOS], TEX0, RECT;
#sample the (i+W/2,j)
ADD R1, f[WPOS], TexOffset.xwww;
TEX R1, R1, TEX0, RECT;
ADD R0, R0, R1;
#sample the (i,j+W/2)
ADD R1, f[WPOS], TexOffset.wxww;
TEX R1, R1, TEX0, RECT;
ADD R0, R1, R0;
#sample the (i+W/2, j+W/2)
ADD R1, f[WPOS], TexOffset.xxww;
TEX R1, R1, TEX0, RECT;
#sum 4 positions together in 1 channel
ADD o[COLR], R1, R0;
#If in 4 Channels, we need to sum RGBA components together
#ADD R2, R1, R0;
#ADD R2.x, R2.x,R2.y;
#ADD R2.x, R2.x,R2.z;
#ADD o[COLR], R2.x,R2.w;
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -