ignoring w component on VS_In

This commit is contained in:
James Fulop authored and baldurk committed 2016-09-30 10:58:27 +02:00
1 parent d306f27c72
commit bfd1d96f8f
3 files changed
+30 -6

No files matched your search

+11 -1
View File
@@ -140,9 +140,19 @@ void trianglePath(uint threadID)
#endif
vec3 hitPosition;
bool hit = TriangleRayIntersect(pos0.xyz/pos0.w, pos1.xyz/pos1.w, pos2.xyz/pos2.w,
bool hit;
if (meshpick.unproject == 1u)
{
hit = TriangleRayIntersect(pos0.xyz / pos0.w, pos1.xyz / pos1.w, pos2.xyz / pos2.w,
meshpick.rayPos, meshpick.rayDir,
/*out*/ hitPosition);
}
else
{
hit = TriangleRayIntersect(pos0.xyz, pos1.xyz, pos2.xyz,
meshpick.rayPos, meshpick.rayDir,
/*out*/ hitPosition);
}
// ray hit a triangle, so return the vertex that was closest
// to the triangle/ray intersection point
+16 -4
View File
@@ -143,7 +143,8 @@ cbuffer MeshPickData : register(b0)
float2 PickViewport;
uint PickMeshMode;
float3 Padding;
uint PickUnproject;
float2 Padding;
row_major float4x4 PickMVP;
};
@@ -232,11 +233,22 @@ void trianglePath(uint threadID)
float4 pos0 = PickIdx ? vertex[index[vertid0]] : vertex[vertid0];
float4 pos1 = PickIdx ? vertex[index[vertid1]] : vertex[vertid1];
float4 pos2 = PickIdx ? vertex[index[vertid2]] : vertex[vertid2];
float3 hitPosition;
bool hit = TriangleRayIntersect(pos0.xyz/pos0.w, pos1.xyz/pos1.w, pos2.xyz/pos2.w,
PickRayPos, PickRayDir,
/*out*/ hitPosition);
bool hit;
if (PickUnproject == 1)
{
hit = TriangleRayIntersect(pos0.xyz / pos0.w, pos1.xyz / pos1.w, pos2.xyz / pos2.w,
PickRayPos, PickRayDir,
/*out*/ hitPosition);
}
else
{
hit = TriangleRayIntersect(pos0.xyz, pos1.xyz, pos2.xyz,
PickRayPos, PickRayDir,
/*out*/ hitPosition);
}
// ray hit a triangle, so return the vertex that was closest
// to the triangle/ray intersection point
+3 -1
View File
@@ -2250,7 +2250,8 @@ uint32_t D3D11DebugManager::PickVertex(uint32_t eventID, const MeshDisplay &cfg,
Vec2f PickViewport;
uint32_t MeshMode;
Vec3f Padding;
uint32_t PickUnproject;
float2 Padding;
Matrix4f PickMVP;
@@ -2260,6 +2261,7 @@ uint32_t D3D11DebugManager::PickVertex(uint32_t eventID, const MeshDisplay &cfg,
cbuf.PickViewport = Vec2f((float)GetWidth(), (float)GetHeight());
cbuf.PickIdx = cfg.position.idxByteWidth ? 1 : 0;
cbuf.PickNumVerts = cfg.position.numVerts;
cbuf.PickUnproject = cfg.position.unproject ? 1 : 0;
Matrix4f projMat =
Matrix4f::Perspective(90.0f, 0.1f, 100000.0f, float(GetWidth()) / float(GetHeight()));