⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 neighborforcecalc2.nvp

📁 游戏编程精华02-含有几十个游戏编程例子
💻 NVP
字号:
/* ****************************************

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 = center
; t1 = 2nd axis final point
; t2 = previous partial result texture


def c1, -0.5, -0.5, -0.5, 1.0


; get colors from all 4 texture stages
tex t0
tex t1
tex t2

; last element of neighbor force
;   result can be negative
sub r0, t1, t0

; need to possibly subtract from previous result, 
;   this is why we need two force accumulation textures
;   and cannot use additive blending to get away with using
;   only a single force accumulation texture

; If you want to make one more than another
;add r0, r0, r0
;add r0, r0, t2
;add r0, r0, c1

add r0, r0, t2



⌨️ 快捷键说明

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