Refactoring
This commit is contained in:
parent
3e399adf0a
commit
d90ce79135
222 changed files with 9045 additions and 5734 deletions
|
|
@ -20,29 +20,26 @@
|
|||
#version 460 core
|
||||
#extension GL_EXT_ray_tracing : enable
|
||||
#extension GL_GOOGLE_include_directive : enable
|
||||
#extension GL_EXT_shader_explicit_arithmetic_types_int64 : require
|
||||
|
||||
#include "raycommon.glsl"
|
||||
#include "host_device.h"
|
||||
|
||||
layout(location = 3) callableDataInEXT rayLight cLight;
|
||||
|
||||
layout(push_constant) uniform Constants
|
||||
layout(push_constant) uniform _PushConstantRay
|
||||
{
|
||||
vec4 clearColor;
|
||||
vec3 lightPosition;
|
||||
float lightIntensity;
|
||||
vec3 lightDirection;
|
||||
float lightSpotCutoff;
|
||||
float lightSpotOuterCutoff;
|
||||
int lightType;
|
||||
PushConstantRay pcRay;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 lDir = lightPosition - cLight.inHitPosition;
|
||||
vec3 lDir = pcRay.lightPosition - cLight.inHitPosition;
|
||||
cLight.outLightDistance = length(lDir);
|
||||
cLight.outIntensity = lightIntensity / (cLight.outLightDistance * cLight.outLightDistance);
|
||||
cLight.outIntensity = pcRay.lightIntensity / (cLight.outLightDistance * cLight.outLightDistance);
|
||||
cLight.outLightDir = normalize(lDir);
|
||||
float theta = dot(cLight.outLightDir, normalize(-lightDirection));
|
||||
float epsilon = lightSpotCutoff - lightSpotOuterCutoff;
|
||||
float spotIntensity = clamp((theta - lightSpotOuterCutoff) / epsilon, 0.0, 1.0);
|
||||
float theta = dot(cLight.outLightDir, normalize(-pcRay.lightDirection));
|
||||
float epsilon = pcRay.lightSpotCutoff - pcRay.lightSpotOuterCutoff;
|
||||
float spotIntensity = clamp((theta - pcRay.lightSpotOuterCutoff) / epsilon, 0.0, 1.0);
|
||||
cLight.outIntensity *= spotIntensity;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue