Skip to content

Commit

Permalink
Merge pull request #45 from brown-ccv/feature-animation-controller
Browse files Browse the repository at this point in the history
Feature animation controller
  • Loading branch information
kmilo9999 authored May 10, 2022
2 parents 7817e6b + 621bf99 commit 3861253
Show file tree
Hide file tree
Showing 48 changed files with 3,612 additions and 2,298 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ set(source_files
src/render/VolumeRaycastRenderer.cpp
src/render/VolumeRaycastShader.cpp
src/UI/UIView.cpp
src/UI/UIDoubleClickedTableCell.cpp
libs/glm.cpp
src/render/FrameBufferObject.cpp
src/render/DepthTexture.cpp
Expand Down Expand Up @@ -79,6 +80,7 @@ set(header_files
include/render/VolumeRaycastRenderer.h
include/render/VolumeRaycastShader.h
include/UI/UIView.h
include/UI/UIDoubleClickedTableCell.h
libs/glm.h
include/render/FrameBufferObject.h
include/render/DepthTexture.h
Expand Down
14 changes: 14 additions & 0 deletions Resources/Models/plane.obj
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Blender v2.82 (sub 7) OBJ File: ''
# www.blender.org
v -1.000000 0.000000 1.000000
v 1.000000 0.000000 1.000000
v -1.000000 0.000000 -1.000000
v 1.000000 0.000000 -1.000000
vt 0.000000 0.000000
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 1.000000 0.000000
vn 0.0000 1.0000 0.0000
s off
f 2/1/1 3/2/1 1/3/1
f 2/1/1 4/4/1 3/2/1
14 changes: 14 additions & 0 deletions Resources/Models/plane2.obj
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Blender v2.82 (sub 7) OBJ File: ''
# www.blender.org
v -1.000000 0.000000 1.000000
v 1.000000 0.000000 1.000000
v -1.000000 0.000000 -1.000000
v 1.000000 0.000000 -1.000000
vt 0.000000 0.000000
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 1.000000 0.000000
vn 0.0000 1.0000 0.0000
s off
f 2/1/1 3/2/1 1/3/1
f 2/1/1 4/4/1 3/2/1
17 changes: 17 additions & 0 deletions Resources/Models/plane3.obj
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Blender v2.82 (sub 7) OBJ File: ''
# www.blender.org
mtllib plane3.mtl
o plane
v 1.000000 1.000000 0.000000
v -1.000000 -1.000000 0.000000
v -1.000000 1.000000 0.000000
v 1.000000 -1.000000 0.000000
vt 0.000000 0.000000
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 1.000000 0.000000
vn 0.0000 0.0000 -1.0000
usemtl Default_OBJ
s 1
f 1/1/1 2/2/1 3/3/1
f 1/1/1 4/4/1 2/2/1
3 changes: 3 additions & 0 deletions Resources/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Resource folder

All the [Models - obj files ](https://en.wikipedia.org/wiki/Wavefront_.obj_file) used by applications must go on this folder. Make sure the `.objs` have both vertex and texture coordinates (normals are optional).
144 changes: 106 additions & 38 deletions include/UI/UIView.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,40 @@ class CreateMovieAction;
#define INPUT_TEXT_SIZE 200
#define MAX_COLUMS 50

enum SAVE_MODAL {SAVE_NONE, SAVE_SESSION, SAVE_TRFR_FNC};
enum LOAD_MODAL {LOAD_NONE, LOAD_SESSION, LOAD_TRFR_FNC };
enum SAVE_MODAL
{
SAVE_NONE,
SAVE_SESSION,
SAVE_TRANSFER_FUNCTION
};
enum LOAD_MODAL
{
LOAD_NONE,
LOAD_SESSION,
LOAD_TRFR_FNC
};
enum BUTTON_ACTION
{
NONE,
ADD,
EDIT,
REMOVE
};

struct Window_Properties
{

int window_w = 0;
int window_h = 0;
int framebuffer_w = 0;
int framebuffer_h = 0;

bool operator==(Window_Properties& other)
bool operator==(Window_Properties &other)
{
if (other.window_w == window_w &&
other.window_h == window_h &&
other.framebuffer_w == framebuffer_w &&
other.framebuffer_h == framebuffer_h)
other.window_h == window_h &&
other.framebuffer_w == framebuffer_w &&
other.framebuffer_h == framebuffer_h)
{
return true;
}
Expand All @@ -44,18 +61,17 @@ struct Window_Properties
class UIView
{
public:
UIView(VRVolumeApp& controllerApp);
UIView(VRVolumeApp &controllerApp);
~UIView();


void draw_ui_callback();
void init_ui(bool is2D, bool lookingGlass);
void update_ui(int numVolumes);
void render_2D(Window_Properties& window_properties);
void render_3D(glm::mat4& space_matrix, Window_Properties& window_properties);
void render_2D(Window_Properties &window_properties);
void render_3D(glm::mat4 &space_matrix, Window_Properties &window_properties);
void update_3D_ui_frame();

void set_cursor_pos(glm::vec2&);
void set_cursor_pos(glm::vec2 &);
void set_analog_value(float);

int get_num_transfer_functions();
Expand All @@ -72,7 +88,7 @@ class UIView

void set_enable_render_volume();

void set_controller_pose(glm::mat4& pose);
void set_controller_pose(glm::mat4 &pose);

void set_dynamic_slices(bool);
bool is_dynamic_slices();
Expand All @@ -87,7 +103,7 @@ class UIView

void update_animation(float speed, int numFrames);

void add_data_label(std::string& dataLabel);
void add_data_label(std::string &dataLabel);

void clear_data_labels();

Expand All @@ -108,39 +124,64 @@ class UIView
glm::vec3 get_clip_min();
glm::vec3 get_clip_max();

void set_chracter(char c);
void set_clip_min(glm::vec3 clip_min);
void set_clip_max(glm::vec3 clip_max);

void add_character(char c);

void remove_character();

void compute_new_histogram_view();

void addTransferFunction();
void add_transfer_function();

private:
void set_animation_length(int num_frames);

void get_quantiles(int row);

void set_volume_time_info(time_t time);

void draw_transfer_function_legend();

void set_transfer_function_min_max(float min, float max);

bool get_show_movie_saved_pop_up() const { return m_show_movie_saved_pop_up; }

void set_show_movie_saved_pop_up(bool val) { m_show_movie_saved_pop_up = val; }

private:
struct MyTransFerFunctions
{
int ID;
int ID;
std::string Name;
std::vector<bool> volumes;
};

void open_save_modal_dialog(std::string& id, bool& window_state,
std::function<void(std::ofstream&)> save_function, std::string& extension);
void open_save_modal_dialog(std::string &id, bool &window_state,
std::function<void(std::ofstream &)> save_function, std::string &extension);

void add_trans_function();
void add_transfer_function();

void save_trans_functions(std::ofstream& saveFile);
void save_transfer_functions(std::ofstream &saveFile);

void save_user_session(std::ofstream& saveFile);
void save_user_session(std::ofstream &saveFile);

void load_trans_functions(std::ifstream& loadPath);
void load_transfer_functions(std::ifstream &loadPath);

void load_user_session(std::string filePath);

void save_simulation_states(std::ofstream &loadPath, int num_poi);

void load_camera_poi(std::ifstream &loadPath, int num_poi);

void read_file_line(std::string &line, std::vector<std::string> &values);

void load_ocean_color_maps();

VRVolumeApp& m_controller_app;
VRMenuHandler* m_menu_handler;
void adjust_transfer_function_to_histogram();

VRVolumeApp &m_controller_app;
VRMenuHandler *m_menu_handler;
imgui_addons::ImGuiFileBrowser fileDialog;
bool m_file_dialog_open;
bool m_file_dialog_save_dir;
Expand Down Expand Up @@ -172,6 +213,7 @@ class UIView

bool m_animated;
float m_ui_frame_controller;
unsigned int m_num_animation_frames;
float m_stopped;

glm::vec3 m_clip_min;
Expand All @@ -181,13 +223,15 @@ class UIView
glm::vec3 m_clip_ypr;
glm::vec3 m_clip_pos;

int m_table_selection;
int m_trnfnc_table_selection;

int m_camera_poi_table_selection;

bool m_initialized;

bool m_trn_fct_opitions_window;
bool m_transfer_function_options_window;

bool m_save_trnfct_open;
bool m_save_transfer_function_open;

bool m_save_session_dialog_open;

Expand All @@ -199,6 +243,12 @@ class UIView

std::string m_copy_trnfnct_name;

std::string m_copy_camera_name;

bool m_camera_name_window_open;

BUTTON_ACTION m_camera_button_action;

std::string m_save_file_name;

unsigned int m_trnfnct_counter;
Expand All @@ -207,29 +257,47 @@ class UIView

bool m_ui_background;



bool m_column_selected[MAX_COLUMS];

unsigned int m_column_selection_state;

bool m_compute_new_histogram;

Histogram m_histogram;

void adjust_transfer_function_to_histogram();

vec2f m_histogram_point_1;
vec2f m_histogram_point_2;
float m_histogram_quantiles[2];


void load_ocean_color_maps();
float m_histogram_quantiles[2];

std::vector<std::string> m_ocean_color_maps_names;

std::string m_color_map_directory;

float m_animation_step;
std::string m_string_animation_duration;

bool m_camera_animation_duration_open;

std::vector<float> m_clip_maxs;
std::vector<float> m_clip_mins;

bool m_show_clock;
float m_clock_pos_x;
float m_clock_pos_y;
float m_clock_width;
float m_clock_height;

float m_legend_pos_y;

std::string m_time_info;
std::string m_day_info;

std::string m_months[12] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};

int m_simulation_state_selection;
bool m_time_frame_edited;

bool m_show_movie_saved_pop_up;
};


#endif
Loading

0 comments on commit 3861253

Please sign in to comment.