mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-28 03:35:51 +03:00
remove the experimental hi-res grass and park textures and all the
flagged off textures. going to experiment in a different branch instead.
This commit is contained in:
parent
c523f7fb9c
commit
81a19eb78d
@ -65,6 +65,5 @@ Other binary data bundled in:
|
||||
|
||||
- DejaVuSans.ttf (https://dejavu-fonts.github.io/License.html)
|
||||
- Roboto-Regular.ttf (https://fonts.google.com/specimen/Roboto, Apache license)
|
||||
- http://www.textures4photoshop.com for textures
|
||||
- Icons from https://thenounproject.com/aiga-icons/,
|
||||
https://thenounproject.com/sakchai.ruankam, https://thenounproject.com/wilmax
|
||||
|
@ -47,21 +47,10 @@ impl<'a> EventCtx<'a> {
|
||||
|| self.input.get_mouse_scroll().is_some()
|
||||
}
|
||||
|
||||
pub fn set_textures(
|
||||
&mut self,
|
||||
skip_textures: Vec<(&str, Color)>,
|
||||
textures: Vec<(&str, TextureType)>,
|
||||
timer: &mut Timer,
|
||||
) {
|
||||
pub fn set_textures(&mut self, textures: Vec<(&str, TextureType)>, timer: &mut Timer) {
|
||||
self.canvas.texture_arrays.clear();
|
||||
self.canvas.texture_lookups.clear();
|
||||
|
||||
for (filename, fallback) in skip_textures {
|
||||
self.canvas
|
||||
.texture_lookups
|
||||
.insert(filename.to_string(), fallback);
|
||||
}
|
||||
|
||||
// Group textures with the same dimensions and create a texture array. Videocards have a
|
||||
// limit on the number of textures that can be uploaded.
|
||||
let mut dims_to_textures: BTreeMap<(u32, u32), Vec<(String, Vec<u8>, TextureType)>> =
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 2.0 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.2 MiB |
Binary file not shown.
Before Width: | Height: | Size: 49 KiB |
Binary file not shown.
Before Width: | Height: | Size: 765 KiB |
@ -32,7 +32,6 @@ fn main() {
|
||||
kml: args.optional("--kml"),
|
||||
draw_lane_markings: !args.enabled("--dont_draw_lane_markings"),
|
||||
num_agents: args.optional_parse("--num_agents", |s| s.parse()),
|
||||
textures: args.enabled("--textures"),
|
||||
};
|
||||
let mut opts = options::Options::default();
|
||||
if args.enabled("--dev") {
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::helpers::ID;
|
||||
use crate::helpers::{ColorScheme, ID};
|
||||
use crate::render::{DrawCtx, DrawOptions, Renderable};
|
||||
use ezgui::{Color, EventCtx, GeomBatch, GfxCtx};
|
||||
use ezgui::{Color, GeomBatch, GfxCtx};
|
||||
use geom::Polygon;
|
||||
use map_model::{Area, AreaID, AreaType, Map};
|
||||
|
||||
@ -9,10 +9,10 @@ pub struct DrawArea {
|
||||
}
|
||||
|
||||
impl DrawArea {
|
||||
pub fn new(area: &Area, ctx: &EventCtx, all_areas: &mut GeomBatch) -> DrawArea {
|
||||
pub fn new(area: &Area, cs: &ColorScheme, all_areas: &mut GeomBatch) -> DrawArea {
|
||||
let color = match area.area_type {
|
||||
AreaType::Park => ctx.canvas.texture("assets/grass_texture.png"),
|
||||
AreaType::Water => ctx.canvas.texture("assets/water_texture.png"),
|
||||
AreaType::Park => cs.get_def("grass", Color::hex("#94C84A")),
|
||||
AreaType::Water => cs.get_def("water", Color::rgb(164, 200, 234)),
|
||||
AreaType::PedestrianIsland => Color::grey(0.3),
|
||||
};
|
||||
all_areas.push(color, area.polygon.clone());
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::helpers::{ColorScheme, ID};
|
||||
use crate::render::{AgentColorScheme, DrawCtx, DrawOptions, Renderable, OUTLINE_THICKNESS};
|
||||
use ezgui::{Canvas, Color, Drawable, GeomBatch, GfxCtx, Line, Prerender, Text};
|
||||
use ezgui::{Color, Drawable, GeomBatch, GfxCtx, Line, Prerender, Text};
|
||||
use geom::{Angle, Circle, Distance, PolyLine, Polygon, Pt2D};
|
||||
use map_model::{Map, TurnType};
|
||||
use sim::{CarID, DrawCarInput};
|
||||
@ -22,21 +22,12 @@ impl DrawCar {
|
||||
input: DrawCarInput,
|
||||
map: &Map,
|
||||
prerender: &Prerender,
|
||||
canvas: &Canvas,
|
||||
cs: &ColorScheme,
|
||||
acs: AgentColorScheme,
|
||||
use_textures: bool,
|
||||
) -> DrawCar {
|
||||
let mut draw_default = GeomBatch::new();
|
||||
let body_polygon = input.body.make_polygons(CAR_WIDTH);
|
||||
|
||||
if use_textures {
|
||||
if let Some(p) = input.body.make_polygons_with_uv(CAR_WIDTH) {
|
||||
draw_default.push(canvas.texture("assets/car.png"), p);
|
||||
} else {
|
||||
draw_default.push(Color::RED, body_polygon.clone());
|
||||
}
|
||||
} else {
|
||||
draw_default.push(acs.zoomed_color_car(&input, cs), body_polygon.clone());
|
||||
|
||||
{
|
||||
@ -75,8 +66,7 @@ impl DrawCar {
|
||||
{
|
||||
let radius = Distance::meters(0.3);
|
||||
let edge_offset = Distance::meters(0.5);
|
||||
let (front_pos, front_angle) =
|
||||
input.body.dist_along(input.body.length() - edge_offset);
|
||||
let (front_pos, front_angle) = input.body.dist_along(input.body.length() - edge_offset);
|
||||
let (back_pos, back_angle) = input.body.dist_along(edge_offset);
|
||||
|
||||
let front_left = Circle::new(
|
||||
@ -92,13 +82,11 @@ impl DrawCar {
|
||||
radius,
|
||||
);
|
||||
let back_left = Circle::new(
|
||||
back_pos
|
||||
.project_away(CAR_WIDTH / 2.0 - edge_offset, back_angle.rotate_degs(-90.0)),
|
||||
back_pos.project_away(CAR_WIDTH / 2.0 - edge_offset, back_angle.rotate_degs(-90.0)),
|
||||
radius,
|
||||
);
|
||||
let back_right = Circle::new(
|
||||
back_pos
|
||||
.project_away(CAR_WIDTH / 2.0 - edge_offset, back_angle.rotate_degs(90.0)),
|
||||
back_pos.project_away(CAR_WIDTH / 2.0 - edge_offset, back_angle.rotate_degs(90.0)),
|
||||
radius,
|
||||
);
|
||||
|
||||
@ -146,7 +134,6 @@ impl DrawCar {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DrawCar {
|
||||
id: input.id,
|
||||
|
@ -192,7 +192,7 @@ impl DrawMap {
|
||||
timer.start_iter("make DrawAreas", map.all_areas().len());
|
||||
for a in map.all_areas() {
|
||||
timer.next();
|
||||
areas.push(DrawArea::new(a, ctx, &mut all_areas));
|
||||
areas.push(DrawArea::new(a, cs, &mut all_areas));
|
||||
}
|
||||
timer.start("upload all areas");
|
||||
let draw_all_areas = all_areas.upload(ctx);
|
||||
|
@ -25,7 +25,7 @@ pub use crate::render::pedestrian::{DrawPedCrowd, DrawPedestrian};
|
||||
pub use crate::render::road::DrawRoad;
|
||||
pub use crate::render::traffic_signal::{draw_signal_phase, TrafficSignalDiagram};
|
||||
pub use crate::render::turn::{DrawTurn, DrawTurnGroup};
|
||||
use ezgui::{Canvas, Color, GfxCtx, Prerender};
|
||||
use ezgui::{Color, GfxCtx, Prerender};
|
||||
use geom::{Distance, PolyLine, Polygon, Pt2D, EPSILON_DIST};
|
||||
use map_model::{IntersectionID, Map};
|
||||
use sim::{DrawCarInput, Sim, VehicleType};
|
||||
@ -65,23 +65,13 @@ pub fn draw_vehicle(
|
||||
input: DrawCarInput,
|
||||
map: &Map,
|
||||
prerender: &Prerender,
|
||||
canvas: &Canvas,
|
||||
cs: &ColorScheme,
|
||||
acs: AgentColorScheme,
|
||||
use_textures: bool,
|
||||
) -> Box<dyn Renderable> {
|
||||
if input.id.1 == VehicleType::Bike {
|
||||
Box::new(DrawBike::new(input, map, prerender, cs, acs))
|
||||
} else {
|
||||
Box::new(DrawCar::new(
|
||||
input,
|
||||
map,
|
||||
prerender,
|
||||
canvas,
|
||||
cs,
|
||||
acs,
|
||||
use_textures,
|
||||
))
|
||||
Box::new(DrawCar::new(input, map, prerender, cs, acs))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::helpers::{ColorScheme, ID};
|
||||
use crate::render::{AgentColorScheme, DrawCtx, DrawOptions, Renderable, OUTLINE_THICKNESS};
|
||||
use ezgui::{Canvas, Color, Drawable, GeomBatch, GfxCtx, Line, Prerender, Text};
|
||||
use ezgui::{Color, Drawable, GeomBatch, GfxCtx, Line, Prerender, Text};
|
||||
use geom::{Circle, Distance, PolyLine, Polygon};
|
||||
use map_model::{Map, LANE_THICKNESS};
|
||||
use sim::{DrawPedCrowdInput, DrawPedestrianInput, PedCrowdLocation, PedestrianID};
|
||||
@ -19,10 +19,8 @@ impl DrawPedestrian {
|
||||
step_count: usize,
|
||||
map: &Map,
|
||||
prerender: &Prerender,
|
||||
canvas: &Canvas,
|
||||
cs: &ColorScheme,
|
||||
acs: AgentColorScheme,
|
||||
use_textures: bool,
|
||||
) -> DrawPedestrian {
|
||||
// TODO Slight issues with rendering small pedestrians:
|
||||
// - route visualization is thick
|
||||
@ -33,12 +31,6 @@ impl DrawPedestrian {
|
||||
|
||||
let mut draw_default = GeomBatch::new();
|
||||
|
||||
if use_textures {
|
||||
draw_default.push(
|
||||
canvas.texture("assets/pedestrian.png").rotate(input.facing),
|
||||
body_circle.to_polygon(),
|
||||
);
|
||||
} else {
|
||||
let foot_radius = 0.2 * radius;
|
||||
let hand_radius = 0.2 * radius;
|
||||
let left_foot_angle = 30.0;
|
||||
@ -136,7 +128,6 @@ impl DrawPedestrian {
|
||||
cs.get_def("pedestrian head", Color::rgb(139, 69, 19)),
|
||||
head_circle.to_polygon(),
|
||||
);
|
||||
}
|
||||
|
||||
if let Some(t) = input.waiting_for_turn {
|
||||
// A silly idea for peds... use hands to point at their turn?
|
||||
|
@ -5,7 +5,7 @@ use crate::render::{
|
||||
DrawPedestrian, Renderable, MIN_ZOOM_FOR_DETAIL,
|
||||
};
|
||||
use abstutil::{MeasureMemory, Timer};
|
||||
use ezgui::{Canvas, Color, EventCtx, GfxCtx, Prerender, TextureType};
|
||||
use ezgui::{Color, EventCtx, GfxCtx, Prerender, TextureType};
|
||||
use geom::{Bounds, Circle, Distance, Pt2D};
|
||||
use map_model::{Map, Traversable};
|
||||
use rand::seq::SliceRandom;
|
||||
@ -24,8 +24,8 @@ impl UI {
|
||||
pub fn new(flags: Flags, opts: Options, ctx: &mut EventCtx, splash: bool) -> UI {
|
||||
let cs = ColorScheme::load(opts.color_scheme.clone());
|
||||
let primary = ctx.loading_screen("load map", |ctx, mut timer| {
|
||||
// Always load some small icons.
|
||||
let mut textures = vec![
|
||||
ctx.set_textures(
|
||||
vec![
|
||||
("assets/pregame/back.png", TextureType::Stretch),
|
||||
("assets/pregame/challenges.png", TextureType::Stretch),
|
||||
("assets/pregame/quit.png", TextureType::Stretch),
|
||||
@ -53,31 +53,9 @@ impl UI {
|
||||
("assets/ui/location.png", TextureType::Stretch),
|
||||
("assets/ui/save.png", TextureType::Stretch),
|
||||
("assets/ui/show.png", TextureType::Stretch),
|
||||
];
|
||||
let skip_textures = if flags.textures {
|
||||
textures.extend(vec![
|
||||
("assets/water_texture.png", TextureType::Tile),
|
||||
("assets/grass_texture.png", TextureType::Tile),
|
||||
("assets/pedestrian.png", TextureType::Stretch),
|
||||
("assets/car.png", TextureType::CustomUV),
|
||||
]);
|
||||
Vec::new()
|
||||
} else {
|
||||
vec![
|
||||
(
|
||||
"assets/water_texture.png",
|
||||
cs.get_def("water", Color::rgb(164, 200, 234)),
|
||||
),
|
||||
(
|
||||
"assets/grass_texture.png",
|
||||
cs.get_def("grass", Color::hex("#94C84A")),
|
||||
),
|
||||
("assets/pedestrian.png", Color::rgb(51, 178, 178)),
|
||||
("assets/car.png", Color::CYAN),
|
||||
]
|
||||
};
|
||||
|
||||
ctx.set_textures(skip_textures, textures, &mut timer);
|
||||
],
|
||||
&mut timer,
|
||||
);
|
||||
|
||||
PerMapUI::new(flags, &cs, ctx, &mut timer)
|
||||
});
|
||||
@ -189,7 +167,6 @@ impl UI {
|
||||
let objects = self.get_renderables_back_to_front(
|
||||
g.get_screen_bounds(),
|
||||
&g.prerender,
|
||||
&g.canvas,
|
||||
&mut cache,
|
||||
source,
|
||||
show_objs,
|
||||
@ -264,7 +241,6 @@ impl UI {
|
||||
let mut objects = self.get_renderables_back_to_front(
|
||||
Circle::new(pt, Distance::meters(3.0)).get_bounds(),
|
||||
ctx.prerender,
|
||||
ctx.canvas,
|
||||
&mut cache,
|
||||
source,
|
||||
show_objs,
|
||||
@ -302,7 +278,6 @@ impl UI {
|
||||
&'a self,
|
||||
bounds: Bounds,
|
||||
prerender: &Prerender,
|
||||
canvas: &Canvas,
|
||||
agents: &'a mut AgentCache,
|
||||
source: &dyn GetDrawAgents,
|
||||
show_objs: &dyn ShowObject,
|
||||
@ -372,15 +347,7 @@ impl UI {
|
||||
if !agents.has(time, *on) {
|
||||
let mut list: Vec<Box<dyn Renderable>> = Vec::new();
|
||||
for c in source.get_draw_cars(*on, map).into_iter() {
|
||||
list.push(draw_vehicle(
|
||||
c,
|
||||
map,
|
||||
prerender,
|
||||
canvas,
|
||||
&self.cs,
|
||||
self.agent_cs,
|
||||
self.primary.current_flags.textures,
|
||||
));
|
||||
list.push(draw_vehicle(c, map, prerender, &self.cs, self.agent_cs));
|
||||
}
|
||||
let (loners, crowds) = source.get_draw_peds(*on, map);
|
||||
for p in loners {
|
||||
@ -389,10 +356,8 @@ impl UI {
|
||||
step_count,
|
||||
map,
|
||||
prerender,
|
||||
canvas,
|
||||
&self.cs,
|
||||
self.agent_cs,
|
||||
self.primary.current_flags.textures,
|
||||
)));
|
||||
}
|
||||
for c in crowds {
|
||||
@ -473,7 +438,6 @@ pub struct Flags {
|
||||
// Number of agents to generate when requested. If unspecified, trips to/from borders will be
|
||||
// included.
|
||||
pub num_agents: Option<usize>,
|
||||
pub textures: bool,
|
||||
}
|
||||
|
||||
// All of the state that's bound to a specific map+edit has to live here.
|
||||
|
@ -70,7 +70,6 @@ impl UI {
|
||||
Model::blank()
|
||||
};
|
||||
ctx.set_textures(
|
||||
Vec::new(),
|
||||
vec![
|
||||
("assets/ui/hide.png", TextureType::Stretch),
|
||||
("assets/ui/show.png", TextureType::Stretch),
|
||||
|
Loading…
Reference in New Issue
Block a user