summaryrefslogtreecommitdiff
path: root/engine/src/renderer/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'engine/src/renderer/mod.rs')
-rw-r--r--engine/src/renderer/mod.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/engine/src/renderer/mod.rs b/engine/src/renderer/mod.rs
index e2a567a..f9082fc 100644
--- a/engine/src/renderer/mod.rs
+++ b/engine/src/renderer/mod.rs
@@ -12,7 +12,7 @@ use crate::camera::Camera;
use crate::color::Color;
use crate::data_types::dimens::Dimens;
use crate::event::{Present as PresentEvent, Start as StartEvent};
-use crate::lighting::LightSource;
+use crate::lighting::{GlobalLight, LightSource};
use crate::material::Material;
use crate::matrix::Matrix;
use crate::mesh::Mesh;
@@ -95,6 +95,7 @@ fn render(
light_source_query: Query<(LightSource, Transform)>,
camera_query: Query<(Camera,)>,
window: Single<Window>,
+ global_light: Single<GlobalLight>,
mut gl_objects: Local<GlObjects>,
)
{
@@ -138,6 +139,7 @@ fn render(
apply_light(
&material,
+ &global_light,
shader_program,
light_source
.as_ref()
@@ -344,6 +346,7 @@ fn apply_transformation_matrices(
fn apply_light(
material: &Material,
+ global_light: &GlobalLight,
gl_shader_program: &mut GlShaderProgram,
light_source: Option<(&LightSource, &Transform)>,
camera: &Camera,
@@ -385,7 +388,7 @@ fn apply_light(
gl_shader_program.set_uniform_vec_3fv(
cstr!("material.ambient"),
- &material.ambient().clone().into(),
+ &(material.ambient().clone() + global_light.ambient_offset.clone()).into(),
);
gl_shader_program.set_uniform_vec_3fv(