port from perforce
This commit is contained in:
35
meshToolsV5/src/Interop/MeshVertexShader.hlsl
Normal file
35
meshToolsV5/src/Interop/MeshVertexShader.hlsl
Normal file
@@ -0,0 +1,35 @@
|
||||
cbuffer cb0 : register (b0)
|
||||
{
|
||||
float aspectRatio;
|
||||
float distanceToCenter;
|
||||
float dummy2;
|
||||
float dummy3;
|
||||
float4x4 modelRotation;
|
||||
float4 pivot;
|
||||
}
|
||||
|
||||
float4x4 getProjMatrix()
|
||||
{
|
||||
float yScale = 2.4142135623730950488016887242097;//cot(fovY/2)
|
||||
float xScale = yScale / aspectRatio;
|
||||
float n = 0.1f;
|
||||
float f = 100.0f;
|
||||
float4x4 proj =
|
||||
{
|
||||
xScale, 0, 0, 0,
|
||||
0, yScale, 0, 0,
|
||||
0, 0, f/(f-n), 1,
|
||||
0, 0, -n*f/(f-n), 0
|
||||
};
|
||||
return proj;
|
||||
}
|
||||
|
||||
void main(in float3 pos : POSITION, out float4 result : SV_POSITION, inout float3 normal : NORMAL, inout float4 uv : TEXCOORD)
|
||||
{
|
||||
float4 v = float4(pos, 1);
|
||||
v.xyz -= pivot.xyz;
|
||||
v = mul(v, modelRotation);
|
||||
v.z += distanceToCenter;
|
||||
v = mul(v, getProjMatrix());
|
||||
result = v;
|
||||
}
|
||||
Reference in New Issue
Block a user