mirror of
https://github.com/Linloir/SceneEditor.git
synced 2025-12-16 23:18:12 +08:00
[CORE][FIX] Fix fragment shader
- wrong uniform struct member name causing failure in setting spot light
This commit is contained in:
parent
ace9e258e9
commit
fe571568ae
@ -30,8 +30,8 @@ struct PointLight {
|
||||
struct SpotLight {
|
||||
vec3 position;
|
||||
vec3 direction;
|
||||
float cutOff;
|
||||
float outerCutOff;
|
||||
float innercutoff;
|
||||
float outercutoff;
|
||||
|
||||
float constant;
|
||||
float linear;
|
||||
@ -143,8 +143,8 @@ vec3 CalcSpotLight(SpotLight light, vec3 normal, vec3 fragPos, vec3 viewDir)
|
||||
float attenuation = 1.0 / (light.constant + light.linear * distance + light.quadratic * (distance * distance));
|
||||
// spotlight intensity
|
||||
float theta = dot(lightDir, normalize(-light.direction));
|
||||
float epsilon = light.cutOff - light.outerCutOff;
|
||||
float intensity = clamp((theta - light.outerCutOff) / epsilon, 0.0, 1.0);
|
||||
float epsilon = light.innercutoff - light.outercutoff;
|
||||
float intensity = clamp((theta - light.outercutoff) / epsilon, 0.0, 1.0);
|
||||
// combine results
|
||||
vec3 ambient = light.ambient * vec3(texture(material.texture_diffuse1, TexCoords));
|
||||
vec3 diffuse = light.diffuse * diff * vec3(texture(material.texture_diffuse1, TexCoords));
|
||||
|
||||
@ -11,6 +11,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
QFontDatabase::addApplicationFont(":/fonts/font_awesome_6_regular_free.otf"); // Add font awesome font to application
|
||||
QFontDatabase::addApplicationFont(":/fonts/font_awesome_6_solid_free.otf"); // Add font awesome font to application
|
||||
QFontDatabase::addApplicationFont(":/fonts/corbel.ttf"); // Add corbel font to application
|
||||
QFontDatabase::addApplicationFont(":/fonts/Deng.ttf"); // Add Deng Xian font to application
|
||||
QFontDatabase::addApplicationFont(":/fonts/Dengb.ttf"); // Add Deng Xian Bold font to application
|
||||
QFontDatabase::addApplicationFont(":/fonts/Dengl.ttf"); // Add Deng Xian Light font to application
|
||||
|
||||
MainWindow w;
|
||||
w.setMouseTracking(true);
|
||||
|
||||
@ -14,5 +14,9 @@
|
||||
<qresource prefix="/fonts">
|
||||
<file>font_awesome_6_regular_free.otf</file>
|
||||
<file>font_awesome_6_solid_free.otf</file>
|
||||
<file>corbel.ttf</file>
|
||||
<file>Deng.ttf</file>
|
||||
<file>Dengb.ttf</file>
|
||||
<file>Dengl.ttf</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user