Toy with raytracing
This commit is contained in:
parent
d1c6fbe61f
commit
523aaedecf
6 changed files with 139 additions and 46 deletions
|
|
@ -645,13 +645,17 @@ void VkLevelMesh::RaytraceScene(const VkRenderPassKey& renderPassKey, VulkanComm
|
|||
float f = 1.0f / std::tan(fovy * (pi::pif() / 360.0f));
|
||||
|
||||
ViewerPushConstants pushconstants;
|
||||
pushconstants.ViewToWorld = viewToWorld;
|
||||
pushconstants.CameraPos = cameraPos;
|
||||
pushconstants.ProjX = f / aspect;
|
||||
pushconstants.ProjY = f;
|
||||
pushconstants.SunDir = FVector3(Mesh->SunDirection.X, Mesh->SunDirection.Z, Mesh->SunDirection.Y);
|
||||
pushconstants.SunColor = Mesh->SunColor;
|
||||
pushconstants.SunIntensity = Mesh->SunIntensity;
|
||||
pushconstants.ViewX = (viewToWorld * FVector4(1.0f, 0.0f, 0.0f, 1.0f)).XYZ() - cameraPos;
|
||||
pushconstants.ViewY = (viewToWorld * FVector4(0.0f, 1.0f, 0.0f, 1.0f)).XYZ() - cameraPos;
|
||||
pushconstants.ViewZ = (viewToWorld * FVector4(0.0f, 0.0f, 1.0f, 1.0f)).XYZ() - cameraPos;
|
||||
pushconstants.ResolutionScaleX = 2.0f / fb->GetWidth();
|
||||
pushconstants.ResolutionScaleY = 2.0f / fb->GetHeight();
|
||||
|
||||
commands->bindDescriptorSet(VK_PIPELINE_BIND_POINT_GRAPHICS, Viewer.PipelineLayout.get(), 0, Viewer.DescriptorSet.get());
|
||||
commands->bindDescriptorSet(VK_PIPELINE_BIND_POINT_GRAPHICS, Viewer.PipelineLayout.get(), 1, fb->GetDescriptorSetManager()->GetBindlessSet());
|
||||
|
|
|
|||
|
|
@ -55,13 +55,18 @@ struct LightInfo
|
|||
|
||||
struct ViewerPushConstants
|
||||
{
|
||||
VSMatrix ViewToWorld;
|
||||
FVector3 CameraPos;
|
||||
float ProjX;
|
||||
FVector3 SunDir;
|
||||
float ProjY;
|
||||
FVector3 SunColor;
|
||||
float SunIntensity;
|
||||
FVector3 ViewX;
|
||||
float ResolutionScaleX;
|
||||
FVector3 ViewY;
|
||||
float ResolutionScaleY;
|
||||
FVector3 ViewZ;
|
||||
float Unused;
|
||||
};
|
||||
|
||||
static_assert(sizeof(LightInfo) == sizeof(float) * 20);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue