Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
hannorein committed Feb 11, 2024
1 parent 106ffdd commit dba9e5d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 17 deletions.
7 changes: 3 additions & 4 deletions examples/animation_solar_system/problem.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void heartbeat(struct reb_simulation* const r){
}else if (r->t > 2.*2.*M_PI && r->t < 4.*2.*M_PI){ // Year 2 to 4

// Increase length of trail to 64
r->display_settings->breadcrumb_N = 64;
r->display_settings->breadcrumbs = 64;

// Apply same rotation matrix as before
struct reb_mat4df rm = reb_rotation_to_mat4df(rot_x);
Expand Down Expand Up @@ -111,7 +111,7 @@ void heartbeat(struct reb_simulation* const r){
// Show real size of particles
r->display_settings->spheres = 1;
// Hide planet trails
r->display_settings->past = 0;
r->display_settings->breadcrumbs = 0;

}

Expand Down Expand Up @@ -195,8 +195,7 @@ int main(int argc, char* argv[]) {
// Show orbits
r->display_settings->wire = 1;
// Show 4 past particle positions
r->display_settings->past = 1;
r->display_settings->breadcrumb_N = 4;
r->display_settings->breadcrumbs = 4;

// Slow the simulation down to at most 120 timesteps per second.
r->usleep = 8333;
Expand Down
2 changes: 1 addition & 1 deletion examples/outer_solar_system/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export OPENGL=1# Set this to 1 to enable OpenGL
export OPENGL=0# Set this to 1 to enable OpenGL
export SERVER=1# Set this to 1 to enable the visualization web server
include ../../src/Makefile.defs

Expand Down
18 changes: 7 additions & 11 deletions src/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void reb_display_settings_init(struct reb_simulation*r, struct reb_display_setti
}else{
s->wire = 0;
}
s->breadcrumb_N = 0;
s->breadcrumbs = 0;
s->onscreentext = 1;
s->ghostboxes = 0;
s->reference = -1;
Expand Down Expand Up @@ -460,11 +460,11 @@ void reb_display_keyboard(GLFWwindow* window, int key, int scancode, int action,
reb_display_clear_particle_data(data);
break;
case 'I':
data->s.breadcrumb_N = MAX(1,data->s.breadcrumb_N*2);
data->s.breadcrumbs = MAX(1,data->s.breadcrumbs*2);
break;
case 'O':
data->past_current_index = data->past_current_index % MAX(2, data->s.breadcrumb_N/2) ;
data->s.breadcrumb_N = MAX(0, data->s.breadcrumb_N/2) ;
data->past_current_index = data->past_current_index % MAX(2, data->s.breadcrumbs/2) ;
data->s.breadcrumbs = MAX(0, data->s.breadcrumbs/2) ;
break;
case 'T':
data->s.onscreentext = !data->s.onscreentext;
Expand Down Expand Up @@ -494,7 +494,7 @@ void reb_display_keyboard(GLFWwindow* window, int key, int scancode, int action,
break;
}
}
printf("%d\n", data->s.breadcrumb_N);
printf("%d\n", data->s.breadcrumbs);
}

// Actual rendering
Expand Down Expand Up @@ -558,13 +558,9 @@ void reb_render_frame(void* p){
// prepare data (incl orbit calculation)
const int N_real = r_copy->N - r_copy->N_var;

if (data->s.breadcrumb_N <0){
data->s.breadcrumb_N = 0;
}

if (N_real > data->N_allocated || data->s.breadcrumb_N+1 != data->breadcrumb_N_allocated){
if (N_real > data->N_allocated || data->s.breadcrumbs+1 != data->breadcrumb_N_allocated){
data->N_allocated = N_real;
data->breadcrumb_N_allocated = data->s.breadcrumb_N+1;
data->breadcrumb_N_allocated = data->s.breadcrumbs+1;

data->particle_data = realloc(data->particle_data, data->N_allocated*sizeof(struct reb_vec4df));
data->orbit_data = realloc(data->orbit_data, data->N_allocated*sizeof(struct reb_orbit_opengl));
Expand Down
2 changes: 1 addition & 1 deletion src/rebound.h
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,7 @@ struct reb_display_settings {
int spheres; // Switches between point sprite and real spheres.
int pause; // Pauses visualization, but keep simulation running
int wire; // Shows/hides orbit wires.
unsigned int breadcrumb_N; // Number of past particle positions.
unsigned int breadcrumbs; // Number of past particle positions.
int onscreentext; // Shows/hides onscreen text.
int onscreenhelp; // Shows/hides onscreen help.
int multisample; // Turn off/on multisampling.
Expand Down

0 comments on commit dba9e5d

Please sign in to comment.