summaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engine')
-rw-r--r--engine/Cargo.toml1
-rw-r--r--engine/src/renderer/opengl.rs39
2 files changed, 16 insertions, 24 deletions
diff --git a/engine/Cargo.toml b/engine/Cargo.toml
index 6d5effe..b3868ac 100644
--- a/engine/Cargo.toml
+++ b/engine/Cargo.toml
@@ -11,7 +11,6 @@ glfw = { path = "../glfw", features = ["opengl"] }
thiserror = "1.0.49"
gl = "0.14.0"
bitflags = "2.4.0"
-cstr = "0.2.11"
tracing = { version = "0.1.39", optional = true }
seq-macro = "0.3.5"
paste = "1.0.14"
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(