Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ Fork of seedee/SDHLT focused on compile performance and map FPS for Counter-Stri
- CI ran `ctest` with no registered tests and always failed that step

### Added
- `gui/`: `-texchart` has a toggle under CSG, "Informe de coste de texturas",
with the explanation aimed at the decision rather than the mechanism: what
the `oversampled` column means and what to do at each value (4x or more,
halve it; around 1x, leave it; below 1x, it tiles and halving will show).
It also carries the reason the column exists at all, since reading the size
column alone suggests savings that are not there
- CSG: `-texchart` reports what each texture costs the bsp. On a map compiled
with `-nowadtextures` the texture lump is most of the file - measured at
82.8% on `zm_azteca` and 69.9% on `zm_eichen`, against 8.7% and 15.4% for
Expand Down
2 changes: 1 addition & 1 deletion gui/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion gui/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "resdhlt-gui"
version = "0.5.0"
version = "0.6.0"
edition = "2021"
description = "Map compiler front-end for ReSDHLT"
license = "GPL-2.0-or-later"
Expand Down
39 changes: 39 additions & 0 deletions gui/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2315,6 +2315,45 @@ impl App {
);
}
}
toggle_row(
ui,
m,
"Informe de coste de texturas",
"No cambia el .bsp. Solo añade un informe al final de CSG diciendo qué \
texturas lo están engordando.\n\n\
PARA QUÉ: si compilas con 'Meter las texturas en el BSP', el lump de \
texturas suele ser la mayor parte del archivo. Medido en mapas reales: \
82.8% y 69.9% del .bsp, contra 8.7% y 15.4% de la iluminación. El chart \
normal te da un único total y ahí se acaba; este te dice de qué está \
hecho.\n\n\
QUÉ MIRAR, la columna 'oversampled': cuántos píxeles tiene la textura \
por cada píxel que llega a mostrarse. Se calcula con la superficie real \
que pinta en el mapa y la escala de textura, no es una estimación.\n\
· 4x o más — le sobra resolución. Puedes bajarla a la mitad en cada eje \
y seguir teniendo un píxel por píxel en pantalla\n\
· alrededor de 1x — está usada a su resolución nativa, no la toques\n\
· por debajo de 1x — se repite sobre una superficie grande. Bajarla se \
va a notar\n\n\
Esa columna es el motivo de la opción. Mirando solo el tamaño parece que \
bajar todas las texturas de 256px ahorraría muchísimo, y en un mapa real \
medido resultó que no sobraba resolución en ninguna: eran texturas que \
se repiten sobre paredes enormes y bajarlas solo se habría visto peor.\n\n\
También avisa si dos texturas tienen los píxeles idénticos, que es peso \
pagado dos veces.\n\n\
CUÁNDO USARLO: cuando el .bsp pese más de lo que te gustaría. No hace \
falta dejarlo puesto en cada compilación.",
Some("cuando quieras adelgazar el mapa"),
&mut self.opts.texchart,
);
if self.opts.texchart {
hint(
ui,
m,
"Mira la columna 'oversampled': 4x o más significa que puedes bajar \
esa textura a la mitad sin que se note. Cerca de 1x, déjala",
OK,
);
}
row(
ui,
m,
Expand Down
17 changes: 17 additions & 0 deletions gui/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ pub struct Options {
pub mergeentities: bool,
pub mergesize: u32, // longest side a merged group may reach, 0 = no limit
pub mergeblend: bool,
pub texchart: bool,
pub csg_extra: String,

// ---- BSP ----
Expand Down Expand Up @@ -202,6 +203,7 @@ impl Default for Options {
mergeentities: false,
mergesize: 1024,
mergeblend: false,
texchart: false,
csg_extra: String::new(),

run_bsp: true,
Expand Down Expand Up @@ -431,6 +433,18 @@ mod tests {
assert!(!o.csg_args().iter().any(|a| a.starts_with("-merge")));
}

#[test]
fn the_texture_report_is_asked_for_on_its_own() {
let mut o = Options::default();
assert!(!o.csg_args().contains(&"-texchart".to_string()));

// It reports, it does not change the bsp, so it depends on nothing else.
o.texchart = true;
let a = o.csg_args();
assert!(a.contains(&"-texchart".to_string()));
assert!(!a.iter().any(|a| a.starts_with("-merge")));
}

#[test]
fn project_names_survive_becoming_folders() {
assert_eq!(sanitize_folder("zm_hola"), "zm_hola");
Expand Down Expand Up @@ -549,6 +563,9 @@ impl Options {
a.push("-mergeblend".to_string());
}
}
if self.texchart {
a.push("-texchart".to_string());
}
push_extra(&mut a, &self.csg_extra);
a
}
Expand Down
Loading