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

📄 apply_force.cg

📁 游戏编程精粹6第中关于粒子的实时流体仿真系统,对入门的游戏开发者很有帮助.
💻 CG
字号:
#include "sph.cg"

void main(float index : TEXCOORD0,
		  uniform samplerRECT attr_rect : TEXUNIT0,
		  uniform float timestep,
		  out float3 result : COLOR)
{
	float3 vel = f3texRECT(attr_rect, float2(index,  GPU_ATTR_VEL));
	float3 acc = f3texRECT(attr_rect, float2(index, GPU_ATTR_ACC));
	//float3 exacc = f3texRECT(attr_rect, float2(index, GPU_ATTR_EXACC));
	float3 gravity = float3(0.0, 0.0, -9.8);

	result = vel + timestep*(acc + gravity - 1.1f*vel);
}

⌨️ 快捷键说明

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