Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature animation controller #45

Merged
merged 26 commits into from
May 10, 2022
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
bc896e0
add camera point of interests feature
kmilo9999 Feb 1, 2022
ce019e5
add poi to save and load session functionality
kmilo9999 Feb 2, 2022
4cf1ec7
more changes on UI control
kmilo9999 Feb 23, 2022
9142b5f
add missed files in the last comment
kmilo9999 Feb 23, 2022
649d5bc
add camera name edit. fix input text field no input on active. fix cr…
kmilo9999 Feb 26, 2022
60b136e
fix camera ui table selection
kmilo9999 Mar 1, 2022
52bab9b
fix resize window and frame buffer
kmilo9999 Mar 2, 2022
aa03f35
merge feature-camera-positions to get fix on resize window
kmilo9999 Mar 2, 2022
0d7d3c4
adde camera animation. camera zoom is broken
kmilo9999 Mar 10, 2022
e3559dd
add animationdurantion input text
kmilo9999 Mar 10, 2022
73d6789
add slice animation and 3d terrain lables
kmilo9999 Apr 14, 2022
1cc9c27
add Choreograph to superbuild script
kmilo9999 Apr 19, 2022
1ff12e5
Merge branch 'feature-animation-controller' of https://github.com/bro…
kmilo9999 Apr 19, 2022
ddc0572
add slice and camera animation. fix animation ui. fix memory leak on …
kmilo9999 Apr 20, 2022
986eb4c
Merge branch 'feature-animation-controller' of https://github.com/bro…
kmilo9999 Apr 20, 2022
86c62e2
add copy command to move Resource folder to executable folder
kmilo9999 Apr 20, 2022
1e7a79f
add Choreograph folder to be exclude in the clean superbuild folder s…
kmilo9999 Apr 20, 2022
14bb1ec
fix file format and identation. remove comments and unused variables.…
kmilo9999 Apr 21, 2022
0f54d4e
address comments from PR review. Delete comments, unuse code, formatt…
kmilo9999 Apr 26, 2022
695d9c3
remove unsed code. rename variables. add comments.
kmilo9999 Apr 28, 2022
9ac9368
rename variable. remove unused code
kmilo9999 May 2, 2022
6383728
rename variables. format files
kmilo9999 May 6, 2022
2d02f28
renamed uiview member variable
kmilo9999 May 6, 2022
5a63ded
remove commented code. add notes on code.
kmilo9999 May 9, 2022
f197c5f
remove uncommented code. reformatted files
kmilo9999 May 9, 2022
621bf99
remove commeted code.
kmilo9999 May 10, 2022
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
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
RobertGemmaJr marked this conversation as resolved.
Show resolved Hide resolved
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_TRFR_FNC
};
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;
kmilo9999 marked this conversation as resolved.
Show resolved Hide resolved

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_trnfct_open;
kmilo9999 marked this conversation as resolved.
Show resolved Hide resolved

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;
mcmcgrath13 marked this conversation as resolved.
Show resolved Hide resolved

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