copy_dup_density.cg
来自「游戏编程精粹6第中关于粒子的实时流体仿真系统,对入门的游戏开发者很有帮助.」· CG 代码 · 共 21 行
CG
21 行
void main(float2 sn_coord : TEXCOORD0,
uniform samplerRECT density_rect : TEXUNIT0,
uniform samplerRECT neighbour_rect : TEXUNIT1,
out float3 result : COLOR
)
{
/*
float2 nlist_index = float2(floor(sn_coord.y)*2, sn_coord.x);
float neighbour_index = f1texRECT(neighbour_rect, nlist_index);
result = f1texRECT(density_rect, unpack_2ushort(neighbour_index)*65536);
neighbour_index = f1texRECT(neighbour_rect, nlist_index - float2(1, 0));
result += f1texRECT(density_rect, unpack_2ushort(neighbour_index)*65536);
*/
//result.xy = unpack_2ushort(neighbour_index)*65536;
//result.xy = nlist_index - float2(1, 0);//sn_coord.xy;
float neighbour_index = f1texRECT(neighbour_rect, sn_coord.yx);
result = f1texRECT(density_rect, unpack_2ushort(neighbour_index)*65536);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?