applyvelocityshader.nvp

来自「游戏编程精华02-含有几十个游戏编程例子」· NVP 代码 · 共 47 行

NVP
47
字号
/* ****************************************

2nd step of force calc for render-to-texture
water simulation.

Adds the 4th & final neighbor point to the 
force calc..

Bias and scale the values so 0 force is 0.5, 
  full negative force is 0.0, and full pos is
  1.0

******************************************* */


#include "PixelConstants.h"


; Declare pixel shader version
ps.1.1



; t0 = velocity field
; t1 = forces          
;  or
;  t0 = height & t1 = velocity



tex t0      // prev position
tex t1      // velocity at pt 1


; Bias the force back to 0 = 0.0 and negative = negative.
;   Too bad we can't store signed values in the velocity and
;   force textures!

mov r0, t1_bias


; add force * scale and output
mad  r0, r0, c[PCN_MULTFACTOR_1], t0



⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?