42 lines
796 B
GLSL
42 lines
796 B
GLSL
#include "macros.hlsl"
|
|
#include "ray_trace.hlsl"
|
|
|
|
struct MeshPayload
|
|
{
|
|
float3 m_vColor;
|
|
}
|
|
struct RayPayload
|
|
{
|
|
float3 m_vOrigin;
|
|
float3 m_vDirection;
|
|
};
|
|
|
|
RAY
|
|
{
|
|
funnyAccelerationStructure g_asGlobal;
|
|
Texture2D<float> g_tWorldSpaceCoords;
|
|
RWTexture2D<float> g_tDirectImage;
|
|
RWTexture2D<float> g_tIndirectImage;
|
|
|
|
|
|
|
|
void rayMain()
|
|
{
|
|
RayPayload p = {};
|
|
RunShaderResult_t<MeshPayload> m = RunShader<MeshPayload, RayPayload>(0, p);
|
|
m.val.m_vColor;
|
|
printf("%f\n", m.val.m_vColor.x);
|
|
|
|
/*
|
|
uint2 pixel = DispatchRaysIndex().xy;
|
|
MeshPayload p;
|
|
RayDesc ray;
|
|
ray.Origin = g_tWorldSpaceCoords[pixel];
|
|
ray.Direction = float3(1,0,0);
|
|
ray.TMin = 0.001;
|
|
ray.TMax = 10000;
|
|
funnyHitObject hit = funnyHitObject::TraceRay(g_asGlobal, RAY_FLAG_NONE, 0xFF, 0, 1, 0, ray, p);
|
|
*/
|
|
}
|
|
}
|