/////////////////////////////////////////////////////////////////////////// // // fragment program in charge // of position texture update // /////////////////////////////////////////////////////////////////////////// float4 main(float2 coords : TEXCOORD0, uniform float tslf, uniform float bbposTexSide, uniform float partCount, uniform float3 randomMove, uniform float3 lastMove, uniform float3 fallVect, uniform sampler2D oldPos : TEXUNIT0) : COLOR { float4 newPos; newPos = tex2D(oldPos, coords); newPos.a =1; // compute the newt position, based on fall direction and speed, and user movement to compensate newPos.xyz += fallVect * tslf - lastMove; // keep the particles within the box if (newPos.y <= 0.05) { newPos.y += 0.9; newPos.xz += randomMove.xz; } else if (newPos.y >= 0.95) { newPos.y -= 0.9; } if (newPos.x <= 0.05) { newPos.x += 0.9; } else if (newPos.x >= 0.95) { newPos.x -= 0.9; } if (newPos.z <= 0.05) { newPos.z += 0.9; } else if (newPos.z >= 0.95) { newPos.z -= 0.9; } return newPos; }