fix segfault

This commit is contained in:
MihailRis 2025-05-10 16:29:30 +03:00
parent 8bb03a004f
commit b5253bff99
2 changed files with 3 additions and 4 deletions

View File

@ -46,7 +46,6 @@ void main() {
a_dir = a_modelpos.xyz - u_cameraPos;
vec3 skyLightColor = pick_sky_color(u_skybox);
a_skyLight = skyLightColor.rgb*v_light.a;
//a_color.rgb = max(a_color.rgb, skyLightColor.rgb*v_light.a);
a_distance = length(u_view * u_model * vec4(pos3d * FOG_POS_SCALE, 0.0));
a_fog = calc_fog(a_distance / 256.0);

View File

@ -131,9 +131,6 @@ void WorldRenderer::setupWorldShader(
shader.uniform1i("u_enableShadows", shadows);
if (shadows) {
if (shadowMap == nullptr) {
shadowMap = std::make_unique<ShadowMap>(1024 * 8);
}
shader.uniformMatrix("u_shadowsMatrix", shadowCamera.getProjView());
shader.uniform3f("u_sunDir", shadowCamera.front);
shader.uniform1i("u_shadowsRes", shadowMap->getResolution());
@ -407,6 +404,9 @@ void WorldRenderer::draw(
skybox->refresh(pctx, worldInfo.daytime, mie, 4);
if (shadows) {
if (shadowMap == nullptr) {
shadowMap = std::make_unique<ShadowMap>(1024 * 8);
}
generateShadowsMap(camera, pctx);
}