@@ -129,6 +129,8 @@ mod visualizer {
129
129
for event in events. read ( ) {
130
130
let texture_type = event. 0 . clone ( ) ;
131
131
132
+ info ! ( "Regenerating noise preview for {:?}" , texture_type) ;
133
+
132
134
let width = 512 ;
133
135
let height = 512 ;
134
136
let depth = 512 ;
@@ -190,12 +192,9 @@ mod visualizer {
190
192
mut world_regenerate_event_writer : EventWriter < terrain_events:: WorldRegenerateEvent > ,
191
193
) {
192
194
egui:: Window :: new ( "Splines" ) . show ( contexts. ctx_mut ( ) , |ui| {
193
- egui_plot:: Plot :: new ( "splines" )
194
- . show ( ui, |plot_ui| {
195
- let plot_points: Vec < PlotPoint > = generator. params . splines . iter ( ) . map ( |spline| PlotPoint { x : spline. x as f64 , y : spline. y as f64 } ) . collect ( ) ;
196
- let line_chart = Line :: new ( PlotPoints :: Owned ( plot_points) ) ;
197
- plot_ui. line ( line_chart) ;
198
- } ) ;
195
+ if ui. button ( "Organize windows" ) . clicked ( ) {
196
+ ui. ctx ( ) . memory_mut ( |mem| mem. reset_areas ( ) ) ;
197
+ }
199
198
200
199
let mut changed = false ;
201
200
@@ -216,6 +215,13 @@ mod visualizer {
216
215
if ui. button ( "Regenerate world" ) . clicked ( ) {
217
216
world_regenerate_event_writer. send ( terrain_events:: WorldRegenerateEvent ) ;
218
217
}
218
+
219
+ egui_plot:: Plot :: new ( "splines" )
220
+ . show ( ui, |plot_ui| {
221
+ let plot_points: Vec < PlotPoint > = generator. params . splines . iter ( ) . map ( |spline| PlotPoint { x : spline. x as f64 , y : spline. y as f64 } ) . collect ( ) ;
222
+ let line_chart = Line :: new ( PlotPoints :: Owned ( plot_points) ) ;
223
+ plot_ui. line ( line_chart) ;
224
+ } ) ;
219
225
} ) ;
220
226
221
227
let noise_textures = & noise_texture_list. noise_textures ;
@@ -234,19 +240,24 @@ mod visualizer {
234
240
TextureType :: Density => "Density" ,
235
241
} ;
236
242
243
+ let mut params = match texture_type {
244
+ TextureType :: Height => generator. params . height_params ,
245
+ TextureType :: HeightAdjust => generator. params . height_adjust_params ,
246
+ TextureType :: Density => generator. params . density_params
247
+ } ;
248
+
237
249
egui:: Window :: new ( window_name) . show ( contexts. ctx_mut ( ) , |ui| {
238
250
ui. label ( window_name) ;
239
251
240
252
let mut changed = false ;
241
253
242
- add_sliders_for_noise_params ( ui, & mut changed, & mut generator. params . height_params ) ;
243
-
254
+ add_sliders_for_noise_params ( ui, & mut changed, & mut params) ;
244
255
245
256
if changed {
246
257
event_writer. send ( terrain_events:: RegenerateHeightMapEvent ( texture_type. clone ( ) ) ) ;
247
258
} ;
248
259
249
- ui. label ( format ! ( "{:?}" , generator . params. height_params ) ) ;
260
+ ui. label ( format ! ( "{:?}" , params) ) ;
250
261
251
262
ui. add ( egui:: widgets:: Image :: new ( egui:: load:: SizedTexture :: new (
252
263
texture_handle. id ( ) ,
0 commit comments