
Sample Applications 421
void CSMai n ( u int 3 c : S V DispatchThreadID)
{
float3 location = spaceDelta . xyz∗( c . xyz + 0.5 f ) ;
float3 diff = location − p osi ti on . xyz ;
float arg = −dot( di ff , d if f )/ data . x ;
float magnitude = data . y∗ exp ( arg ) ;
float4 vortexVelocity = float4(magnitude∗ c r os s ( no rma l . xyz , d i f f ) , 0 . 0 f ) ;
ou tV el ocity [ c . xyz ] = in Ve loc it y [ c . xyz ] + vo rt exV el oci ty ;
}
// From InitializeSource . hlsl :
cbuffer External
{
float4 densityProducer ; //(x,y,z,∗)
float4 densityPData; // ( variance , amplitude , ∗ , ∗)
float4 densityConsumer; //(x,y,z,∗)
float4 densityCData; // ( variance , amplitude ...