init
This commit is contained in:
commit
2fe6ca2f65
1473 changed files with 251771 additions and 0 deletions
54
gamedata/shaders/d3d11/fluid_grid_dyn_oobb.vs.hlsl
Normal file
54
gamedata/shaders/d3d11/fluid_grid_dyn_oobb.vs.hlsl
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
#include "fluid_common.hlsli"
|
||||
|
||||
cbuffer DynOOBBData
|
||||
{
|
||||
float3x4 WorldToLocal; // World to local of fog volume
|
||||
float3x4 LocalToWorld; // Local of fog volume to world
|
||||
float4 MassCenter; // Center for angular velocity
|
||||
float4 OOBBWorldAngularVelocity;
|
||||
float4 OOBBWorldTranslationVelocity;
|
||||
}
|
||||
|
||||
// Vertex
|
||||
v2g_fluidsim_dyn_aabb main(v_fluidsim input)
|
||||
{
|
||||
v2g_fluidsim_dyn_aabb output = (v2g_fluidsim_dyn_aabb)0;
|
||||
|
||||
output.pos = float4(input.position.x, input.position.y, input.position.z, 1.0);
|
||||
output.cell0 = float3(input.textureCoords0.x, input.textureCoords0.y, input.textureCoords0.z);
|
||||
|
||||
output.velocity = 0;
|
||||
|
||||
{
|
||||
output.velocity = OOBBWorldTranslationVelocity.xyz;
|
||||
|
||||
float3 r = mul(LocalToWorld, float4(output.cell0, 1)).xyz - MassCenter.xyz;
|
||||
|
||||
float3 AngularVel = cross(OOBBWorldAngularVelocity.xyz, r);
|
||||
|
||||
output.velocity += AngularVel;
|
||||
|
||||
output.velocity = mul((float3x3)WorldToLocal, output.velocity);
|
||||
}
|
||||
|
||||
// for (int i = 0; i < 3; ++i)
|
||||
// {
|
||||
// output.clip0[i] = dot(float4(output.cell0, 1), OOBBClipPlane[i]);
|
||||
// output.clip1[i] = dot(float4(output.cell0, 1), OOBBClipPlane[i + 3]);
|
||||
// // Make box a voxel bigger in each direction
|
||||
// // BOX_EXPANSION - voxel diagonal length
|
||||
// // output.clip0[i] += BOX_EXPANSION;
|
||||
// // output.clip1[i] += BOX_EXPANSION;
|
||||
// }
|
||||
|
||||
output.clip0.x = dot(float4(output.cell0, 1), OOBBClipPlane[0]);
|
||||
output.clip0.y = dot(float4(output.cell0, 1), OOBBClipPlane[1]);
|
||||
output.clip0.z = dot(float4(output.cell0, 1), OOBBClipPlane[2]);
|
||||
|
||||
output.clip1.x = dot(float4(output.cell0, 1), OOBBClipPlane[3]);
|
||||
output.clip1.y = dot(float4(output.cell0, 1), OOBBClipPlane[4]);
|
||||
output.clip1.z = dot(float4(output.cell0, 1), OOBBClipPlane[5]);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue