init
This commit is contained in:
commit
2fe6ca2f65
1473 changed files with 251771 additions and 0 deletions
51
gamedata/shaders/d3d11/fluid_obststaticbox.ps.hlsl
Normal file
51
gamedata/shaders/d3d11/fluid_obststaticbox.ps.hlsl
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
#include "fluid_common.hlsli"
|
||||
|
||||
cbuffer BoxBounds
|
||||
{
|
||||
// float3 boxLBDcorner;
|
||||
// float3 boxRTUcorner;
|
||||
float4 boxLBDcorner;
|
||||
float4 boxRTUcorner;
|
||||
}
|
||||
|
||||
struct PSDrawBoxOut
|
||||
{
|
||||
float4 obstacle : SV_TARGET0;
|
||||
float4 velocity : SV_TARGET1;
|
||||
};
|
||||
|
||||
bool PointIsInsideBox(float3 p, float3 LBUcorner, float3 RTDcorner)
|
||||
{
|
||||
return ((p.x > LBUcorner.x) && (p.x < RTDcorner.x) &&
|
||||
(p.y > LBUcorner.y) && (p.y < RTDcorner.y) &&
|
||||
(p.z > LBUcorner.z) && (p.z < RTDcorner.z));
|
||||
}
|
||||
|
||||
// Pixel
|
||||
PSDrawBoxOut main(p_fluidsim input)
|
||||
{
|
||||
PSDrawBoxOut voxel;
|
||||
float3 innerboxLBDcorner = boxLBDcorner + 1;
|
||||
float3 innerboxRTUcorner = boxRTUcorner - 1;
|
||||
// cells completely inside box = 1.0
|
||||
if (PointIsInsideBox(input.cell0, innerboxLBDcorner, innerboxRTUcorner))
|
||||
{
|
||||
voxel.obstacle = 0.5;
|
||||
voxel.velocity = 0;
|
||||
return voxel;
|
||||
}
|
||||
|
||||
// cells in box boundary = 0.5
|
||||
if (PointIsInsideBox(input.cell0, boxLBDcorner, boxRTUcorner))
|
||||
{
|
||||
voxel.obstacle = 1.0;
|
||||
// voxel.velocity = float4(obstVelocity.xyz,1);
|
||||
voxel.velocity = 0;
|
||||
return voxel;
|
||||
}
|
||||
|
||||
// Kill texel to preserve other obstacles
|
||||
clip(-1);
|
||||
|
||||
return (PSDrawBoxOut)0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue