diff options
Diffstat (limited to 'engine/src/renderer/opengl.rs')
-rw-r--r-- | engine/src/renderer/opengl.rs | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/engine/src/renderer/opengl.rs b/engine/src/renderer/opengl.rs index 888f760..463e654 100644 --- a/engine/src/renderer/opengl.rs +++ b/engine/src/renderer/opengl.rs @@ -5,7 +5,6 @@ use std::ffi::{c_void, CString}; use std::ops::Deref; use std::process::abort; -use cstr::cstr; use ecs::actions::Actions; use ecs::component::local::Local; use ecs::query::options::{Not, With}; @@ -427,14 +426,12 @@ fn apply_transformation_matrices( window_size: Dimens<u32>, ) { - gl_shader_program.set_uniform_matrix_4fv( - cstr!("model"), - &create_transformation_matrix(transformation), - ); + gl_shader_program + .set_uniform_matrix_4fv(c"model", &create_transformation_matrix(transformation)); let view = create_view(camera, camera_pos); - gl_shader_program.set_uniform_matrix_4fv(cstr!("view"), &view); + gl_shader_program.set_uniform_matrix_4fv(c"view", &view); #[allow(clippy::cast_precision_loss)] let projection = match &camera.projection { @@ -444,7 +441,7 @@ fn apply_transformation_matrices( ), }; - gl_shader_program.set_uniform_matrix_4fv(cstr!("projection"), &projection); + gl_shader_program.set_uniform_matrix_4fv(c"projection", &projection); } fn apply_light<PointLightHolder>( @@ -488,10 +485,8 @@ fn apply_light<PointLightHolder>( // There probably won't be more than 2147483648 directional lights #[allow(clippy::cast_possible_wrap, clippy::cast_possible_truncation)] - gl_shader_program.set_uniform_1i( - cstr!("directional_light_cnt"), - directional_lights.len() as i32, - ); + gl_shader_program + .set_uniform_1i(c"directional_light_cnt", directional_lights.len() as i32); for (point_light_index, point_light) in point_lights.iter().enumerate() { gl_shader_program.set_uniform_vec_3fv( @@ -516,10 +511,10 @@ fn apply_light<PointLightHolder>( // There probably won't be more than 2147483648 point lights #[allow(clippy::cast_possible_wrap, clippy::cast_possible_truncation)] - gl_shader_program.set_uniform_1i(cstr!("point_light_cnt"), point_lights.len() as i32); + gl_shader_program.set_uniform_1i(c"point_light_cnt", point_lights.len() as i32); gl_shader_program.set_uniform_vec_3fv( - cstr!("material.ambient"), + c"material.ambient", &if material_flags.use_ambient_color { material.ambient.clone() } else { @@ -529,35 +524,33 @@ fn apply_light<PointLightHolder>( ); gl_shader_program - .set_uniform_vec_3fv(cstr!("material.diffuse"), &material.diffuse.clone().into()); + .set_uniform_vec_3fv(c"material.diffuse", &material.diffuse.clone().into()); #[allow(clippy::cast_possible_wrap)] - gl_shader_program.set_uniform_vec_3fv( - cstr!("material.specular"), - &material.specular.clone().into(), - ); + gl_shader_program + .set_uniform_vec_3fv(c"material.specular", &material.specular.clone().into()); #[allow(clippy::cast_possible_wrap)] gl_shader_program.set_uniform_1i( - cstr!("material.ambient_map"), + c"material.ambient_map", material.ambient_map.into_inner() as i32, ); #[allow(clippy::cast_possible_wrap)] gl_shader_program.set_uniform_1i( - cstr!("material.diffuse_map"), + c"material.diffuse_map", material.diffuse_map.into_inner() as i32, ); #[allow(clippy::cast_possible_wrap)] gl_shader_program.set_uniform_1i( - cstr!("material.specular_map"), + c"material.specular_map", material.specular_map.into_inner() as i32, ); - gl_shader_program.set_uniform_1fv(cstr!("material.shininess"), material.shininess); + gl_shader_program.set_uniform_1fv(c"material.shininess", material.shininess); - gl_shader_program.set_uniform_vec_3fv(cstr!("view_pos"), &camera_pos.position); + gl_shader_program.set_uniform_vec_3fv(c"view_pos", &camera_pos.position); } fn set_light_attenuation_uniforms( |