diff --git a/crates/fx/src/draw.rs b/crates/fx/src/draw.rs index e8dde36..84b366c 100644 --- a/crates/fx/src/draw.rs +++ b/crates/fx/src/draw.rs @@ -205,7 +205,7 @@ pub struct FxElemLightInstance { pub is_spot: bool, pub origin: [f32; 3], pub radius: f32, - pub color_bgr: [f32; 3], + pub color_rgb: [f32; 3], pub axis: [[f32; 3]; 3], } diff --git a/crates/fx_iw4/src/cull.rs b/crates/fx_iw4/src/cull.rs index 5987701..84c9d22 100644 --- a/crates/fx_iw4/src/cull.rs +++ b/crates/fx_iw4/src/cull.rs @@ -94,11 +94,8 @@ pub fn cull_elem_light( } #[inline] -pub fn elem_light_color_bgr(color_rgba: [u8; 4], scale: f32) -> [f32; 3] { +pub fn elem_light_color_rgb(color_rgba: [u8; 4], scale: f32) -> [f32; 3] { let s = scale * (crate::FX_RECIP_255 as f32); - [ - color_rgba[2] as f32 * s, - color_rgba[1] as f32 * s, - color_rgba[0] as f32 * s, - ] + let [r, g, b, _a] = color_rgba; + [r as f32 * s, g as f32 * s, b as f32 * s] } diff --git a/crates/fx_iw4/src/lib.rs b/crates/fx_iw4/src/lib.rs index d8695f0..cc85018 100644 --- a/crates/fx_iw4/src/lib.rs +++ b/crates/fx_iw4/src/lib.rs @@ -95,7 +95,7 @@ pub use collide::{ }; pub use cull::{ FX_ELEM_FLAG_CULL_DRAW_5_PLANES, cull_cloud, cull_cloud_plane_count, cull_cloud_radius, - cull_elem_for_spawn_allows, cull_elem_light, cull_sphere, elem_light_color_bgr, + cull_elem_for_spawn_allows, cull_elem_light, cull_sphere, elem_light_color_rgb, }; pub use draw::{FX_DRAW_ELEM_HANDLER_PRESENT, FxElemType, draw_elem_handler_present}; pub use effect_def::FxEffectDef; diff --git a/crates/lighting_iw4/src/scene_light.rs b/crates/lighting_iw4/src/scene_light.rs index 1b0fb11..547fce7 100644 --- a/crates/lighting_iw4/src/scene_light.rs +++ b/crates/lighting_iw4/src/scene_light.rs @@ -212,10 +212,10 @@ pub fn add_omni_light_to_scene_allows( Ok(()) } -pub fn omni_light_pack(origin: [f32; 3], radius: f32, color_bgr: [f32; 3]) -> GfxLightPack { +pub fn omni_light_pack(origin: [f32; 3], radius: f32, color_rgb: [f32; 3]) -> GfxLightPack { GfxLightPack { light_type: GFX_LIGHT_TYPE_OMNI, - color: color_bgr, + color: color_rgb, direction: [0.0; 3], origin, radius, @@ -281,7 +281,7 @@ pub fn spot_light_pack( origin: [f32; 3], forward: [f32; 3], radius: f32, - color_bgr: [f32; 3], + color_rgb: [f32; 3], cone: SpotLightConeDvars, ) -> GfxLightPack { let end = spot_light_clamp_end(cone.start_radius, cone.end_radius, radius); @@ -301,9 +301,9 @@ pub fn spot_light_pack( GfxLightPack { light_type: GFX_LIGHT_TYPE_SPOT, color: [ - color_bgr[0] * cone.brightness, - color_bgr[1] * cone.brightness, - color_bgr[2] * cone.brightness, + color_rgb[0] * cone.brightness, + color_rgb[1] * cone.brightness, + color_rgb[2] * cone.brightness, ], direction: dir, origin, diff --git a/crates/render_frontend/src/adapters/fx/system.rs b/crates/render_frontend/src/adapters/fx/system.rs index 22e3b8a..fd63272 100644 --- a/crates/render_frontend/src/adapters/fx/system.rs +++ b/crates/render_frontend/src/adapters/fx/system.rs @@ -707,7 +707,7 @@ fn commit_fx_transaction( light.origin, light.axis[0], light.radius, - light.color_bgr, + light.color_rgb, spot_cone, )), Err(lighting_iw4::AddOmniLightRefuse::Cap) => { @@ -725,7 +725,7 @@ fn commit_fx_transaction( Ok(()) => env.dlights.scene.push(lighting_iw4::omni_light_pack( light.origin, light.radius, - light.color_bgr, + light.color_rgb, )), Err(lighting_iw4::AddOmniLightRefuse::Cap) => { env.dlights.cap_full = env.dlights.cap_full.saturating_add(1); diff --git a/crates/render_fx/src/present.rs b/crates/render_fx/src/present.rs index 8178b88..586197f 100644 --- a/crates/render_fx/src/present.rs +++ b/crates/render_fx/src/present.rs @@ -19,7 +19,7 @@ use fx::{ use fx_iw4::{ FX_ELEM_ATLAS_OFF, FX_ELEM_ATLAS_SIZE, FxElemType, FxRandomChannel, apply_lighting_frac_bgra, build_cloud, clamp_elem_rotation_time, cull_cloud, cull_elem_light, - effect_def_needs_lighting_sample, elem_light_color_bgr, elem_uses_lighting_frac, + effect_def_needs_lighting_sample, elem_light_color_rgb, elem_uses_lighting_frac, evaluate_rotation_total, evaluate_scale, evaluate_size0, evaluate_size1, get_elem_angles_axis, get_velocity_at_time, sample_f32, sprite_atlas_uv, vec3_normalize, vis_blocker_add_prepared, }; @@ -1467,7 +1467,7 @@ pub fn build_fx_verts( is_spot: ctx.elem_type == FxElemType::SpotLight as u8, origin: ctx.origin, radius: size0, - color_bgr: elem_light_color_bgr(color, scale), + color_rgb: elem_light_color_rgb(color, scale), axis, }) };