2020-05-21 10:20:19 +00:00
|
|
|
// Copyright 2020 Google LLC
|
|
|
|
|
|
2023-10-13 17:26:51 +02:00
|
|
|
struct Attributes
|
2020-05-21 10:20:19 +00:00
|
|
|
{
|
2023-10-13 17:26:51 +02:00
|
|
|
float2 bary;
|
2020-05-21 10:20:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct Payload
|
|
|
|
|
{
|
|
|
|
|
[[vk::location(0)]] float3 hitValue;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
[shader("closesthit")]
|
2023-10-13 17:26:51 +02:00
|
|
|
void main(inout Payload p, in Attributes attribs)
|
2020-05-21 10:20:19 +00:00
|
|
|
{
|
2023-10-13 17:26:51 +02:00
|
|
|
const float3 barycentricCoords = float3(1.0f - attribs.bary.x - attribs.bary.y, attribs.bary.x, attribs.bary.y);
|
2020-05-21 10:20:19 +00:00
|
|
|
p.hitValue = barycentricCoords;
|
|
|
|
|
}
|