mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 16:19:19 +02:00
fix null reference
This commit is contained in:
@@ -210,18 +210,14 @@ opengl_renderer::Render() {
|
|||||||
World.Camera.SetMatrix( worldcamera );
|
World.Camera.SetMatrix( worldcamera );
|
||||||
m_camera.update_frustum( OpenGLMatrices.data( GL_PROJECTION ), worldcamera);
|
m_camera.update_frustum( OpenGLMatrices.data( GL_PROJECTION ), worldcamera);
|
||||||
::glMultMatrixd(glm::value_ptr(glm::dmat4(glm::dmat3(worldcamera))));
|
::glMultMatrixd(glm::value_ptr(glm::dmat4(glm::dmat3(worldcamera))));
|
||||||
|
shader.bind(); active_shader = &shader;
|
||||||
glDebug("rendering environment");
|
glDebug("rendering environment");
|
||||||
glDisable(GL_FRAMEBUFFER_SRGB);
|
glDisable(GL_FRAMEBUFFER_SRGB);
|
||||||
Render( &World.Environment );
|
Render( &World.Environment );
|
||||||
glDebug("rendering world");
|
glDebug("rendering world");
|
||||||
glEnable(GL_FRAMEBUFFER_SRGB);
|
glEnable(GL_FRAMEBUFFER_SRGB);
|
||||||
shader.bind(); active_shader = &shader;
|
|
||||||
|
|
||||||
glm::vec3 transdiff = Global::daylight.direction * 50.0f;
|
shader.set_lightview(depthproj * depthcam); //to jest źle. nie uwzględnia przesunięcia to wiadomo, ale obrót też jest źle
|
||||||
glm::mat3 rotdiff = glm::inverse(glm::mat3(depthcam)) * glm::mat3(worldcamera);
|
|
||||||
glm::mat4 lv = depthproj * glm::translate(glm::mat4(rotdiff), transdiff);
|
|
||||||
|
|
||||||
shader.set_lightview(lv);
|
|
||||||
Render( &World.Ground );
|
Render( &World.Ground );
|
||||||
|
|
||||||
glDebug("rendering cab");
|
glDebug("rendering cab");
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ float calc_shadow()
|
|||||||
coords = coords * 0.5 + 0.5;
|
coords = coords * 0.5 + 0.5;
|
||||||
float closest_depth = texture(shadowmap, coords.xy).r;
|
float closest_depth = texture(shadowmap, coords.xy).r;
|
||||||
float current_depth = coords.z;
|
float current_depth = coords.z;
|
||||||
float shadow = current_depth > closest_depth ? 0.0 : 1.0;
|
float shadow = (current_depth - 0.1) > closest_depth ? 0.0 : 1.0;
|
||||||
return shadow;
|
return shadow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,5 @@ void main()
|
|||||||
f_normal = modelviewnormal * v_normal;
|
f_normal = modelviewnormal * v_normal;
|
||||||
f_coord = v_coord;
|
f_coord = v_coord;
|
||||||
f_pos = vec3(modelview * vec4(v_vert, 1.0f));
|
f_pos = vec3(modelview * vec4(v_vert, 1.0f));
|
||||||
//f_light_pos = lightview * vec4(f_pos, 1.0f);
|
|
||||||
f_light_pos = lightview * vec4(f_pos, 1.0f);
|
f_light_pos = lightview * vec4(f_pos, 1.0f);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user