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 9 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
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).
110 changes: 57 additions & 53 deletions include/UI/UIView.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,30 @@
#include <stdint.h>
#include <fstream>


class VRVolumeApp;
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 BUTTON_ACTION { NONE, ADD, EDIT, REMOVE };
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
{
Expand All @@ -30,12 +45,12 @@ struct Window_Properties
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 @@ -46,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 @@ -74,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 @@ -89,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 Down Expand Up @@ -119,53 +133,55 @@ class UIView

void compute_new_histogram_view();

void addTransferFunction();

void add_transfer_function();

void set_animation_length(int num_frames);

void get_Quantiles(int row);
void get_quantiles(int row);

void set_volume_time_info(time_t time);

void draw_tranfer_funciton_legend();
void draw_transfer_function_legend();

void set_trns_fnct_min_max(float min, float max);
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 save_simulation_states(std::ofstream &loadPath, int num_poi);

void load_camera_poi(std::ifstream &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 read_file_line(std::string& line, std::vector<std::string>& values);
void load_ocean_color_maps();

void adjust_transfer_function_to_histogram();

VRVolumeApp& m_controller_app;
VRMenuHandler* m_menu_handler;
VRVolumeApp &m_controller_app;
VRMenuHandler *m_menu_handler;
imgui_addons::ImGuiFileBrowser fileDialog;
bool m_file_dialog_open;
bool m_file_dialog_save_dir;
Expand All @@ -184,7 +200,6 @@ class UIView
float m_scale;
int m_slices;
bool m_dynamic_slices;
RobertGemmaJr marked this conversation as resolved.
Show resolved Hide resolved


bool m_show_menu;
bool m_renderVolume;
Expand Down Expand Up @@ -214,9 +229,9 @@ class UIView

bool m_initialized;

bool m_trn_fct_options_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 @@ -242,39 +257,31 @@ 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();

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_speed;
std::string m_str_animation_duration;
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 halfScreen;
float m_clock_pos_x;
float m_clock_pos_y;
float m_clock_width;
Expand All @@ -285,15 +292,12 @@ class UIView
std::string m_time_info;
std::string m_day_info;

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

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
88 changes: 28 additions & 60 deletions include/interaction/ArcBallCamera.h
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
// ----------------------------------
// Copyright 2017, Brown University, Providence, RI.
//
// Copyright © 2017, Brown University, Providence, RI.
//
// All Rights Reserved
//
// Use of the software is provided under the terms of the GNU General Public License version 3
// as published by the Free Software Foundation at http://www.gnu.org/licenses/gpl-3.0.html, provided
// that this copyright notice appear in all copies and that the name of Brown University not be used in
// advertising or publicity pertaining to the use or distribution of the software without specific written
//
// Use of the software is provided under the terms of the GNU General Public License version 3
// as published by the Free Software Foundation at http://www.gnu.org/licenses/gpl-3.0.html, provided
// that this copyright notice appear in all copies and that the name of Brown University not be used in
// advertising or publicity pertaining to the use or distribution of the software without specific written
// prior permission from Brown University.
//
//
// See license.txt for further information.
//
// BROWN UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE WHICH IS
// PROVIDED AS IS, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR ANY PARTICULAR PURPOSE. IN NO EVENT SHALL BROWN UNIVERSITY BE LIABLE FOR ANY
// SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR FOR ANY DAMAGES WHATSOEVER RESULTING
// FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
// OTHER TORTIOUS ACTION, OR ANY OTHER LEGAL THEORY, ARISING OUT OF OR IN CONNECTION
// WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
//
// BROWN UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE WHICH IS
// PROVIDED "AS IS", INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR ANY PARTICULAR PURPOSE. IN NO EVENT SHALL BROWN UNIVERSITY BE LIABLE FOR ANY
// SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR FOR ANY DAMAGES WHATSOEVER RESULTING
// FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
// OTHER TORTIOUS ACTION, OR ANY OTHER LEGAL THEORY, ARISING OUT OF OR IN CONNECTION
// WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
// ----------------------------------
//
//
///\file ArcBall.h
///\author Benjamin Knorlein
///\date 10/17/2019
Expand All @@ -43,36 +43,13 @@ enum WASD_KEYS
E = 1 << 5, // binary 100000
};

//struct PointOfInterest {
//
//
// glm::vec3 eye = glm::vec3(0.0f, 0.0f, 1.0f);
// glm::vec3 target = glm::vec3(0.0f, 0.0f, 0.0f);
// glm::vec3 up = glm::vec3(0.0f, 1.0f, 0.0f);
// float radius = 1.f;
// glm::vec3 max_clip;
// glm::vec3 min_clip;
//
// std::string label;
//
// glm::vec3 get_camera_position()
// {
// eye = glm::normalize(eye);
// return radius * eye + target;
// }
//
//};



/** Adds a HeadMatrix to the RenderState that gets updated repeatedly based
upon head tracking events.
*/


class ArcBallCamera {
class ArcBallCamera
{
public:

ArcBallCamera();

virtual ~ArcBallCamera();
Expand All @@ -81,22 +58,21 @@ class ArcBallCamera {
void mouse_move(float x, float y);
void mouse_scroll(float dist);
void setCameraCenterRotation(bool useCameraCenter);
void wasd_pressed(int awsd);
void wasd_pressed(int wasd);

glm::mat4& getViewmatrix()
glm::mat4 &get_view_matrix()
{
updateCameraMatrix();
update_camera_matrix();
return m_viewmatrix;
}

void updateCameraMatrix();
void update_camera_matrix();

void update_sim_poi(PointOfInterest& poi);
void update_sim_poi(PointOfInterest &poi);


PointOfInterest& get_current_poi();
PointOfInterest &get_current_poi();

void set_current_poi(const PointOfInterest& poi);
void set_current_poi(const PointOfInterest &poi);

void reset_camera();

Expand All @@ -107,13 +83,12 @@ class ArcBallCamera {
void RotateEyeAxis(float dy);
void Zoom(float distance);
void Pan(float dx, float dy);


float m_radius;
glm::vec3 m_target;
glm::vec3 m_up;
glm::vec3 m_eye;

PointOfInterest m_current_poi;
PointOfInterest m_simulation_poi;

Expand All @@ -125,16 +100,9 @@ class ArcBallCamera {
float m_PanFactor;
float m_RotateFactor;
float m_cameraScrollFactor;

bool m_rotate_camera_center;


std::string animation_button_label;

RobertGemmaJr marked this conversation as resolved.
Show resolved Hide resolved


unsigned int m_aap_mode;
unsigned int m_app_mode;
};

#endif

Loading