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 17 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
94 changes: 79 additions & 15 deletions include/UI/UIView.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@
#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 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;
Expand All @@ -46,7 +48,7 @@ class UIView
public:
UIView(VRVolumeApp& controllerApp);
~UIView();


void draw_ui_callback();
void init_ui(bool is2D, bool lookingGlass);
Expand Down Expand Up @@ -108,14 +110,32 @@ 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();
RobertGemmaJr marked this conversation as resolved.
Show resolved Hide resolved


void set_animation_length(int num_frames);

void get_Quantiles(int row);
kmilo9999 marked this conversation as resolved.
Show resolved Hide resolved

void set_volume_time_info(time_t time);

void draw_tranfer_funciton_legend();
RobertGemmaJr marked this conversation as resolved.
Show resolved Hide resolved

void set_trns_fnct_min_max(float min, float max);
RobertGemmaJr marked this conversation as resolved.
Show resolved Hide resolved

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
Expand All @@ -125,8 +145,8 @@ class UIView
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();
RobertGemmaJr marked this conversation as resolved.
Show resolved Hide resolved

Expand All @@ -138,6 +158,11 @@ class UIView

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);

VRVolumeApp& m_controller_app;
VRMenuHandler* m_menu_handler;
Expand All @@ -159,6 +184,7 @@ 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 All @@ -172,6 +198,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 +208,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_trn_fct_options_window;

bool m_save_trnfct_open;
bool m_save_trnfct_open;
RobertGemmaJr marked this conversation as resolved.
Show resolved Hide resolved
kmilo9999 marked this conversation as resolved.
Show resolved Hide resolved

bool m_save_session_dialog_open;

Expand All @@ -199,6 +228,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,8 +242,8 @@ class UIView

bool m_ui_background;


RobertGemmaJr marked this conversation as resolved.
Show resolved Hide resolved

bool m_column_selected[MAX_COLUMS];

unsigned int m_column_selection_state;
Expand All @@ -220,16 +255,45 @@ class UIView

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



void load_ocean_color_maps();
RobertGemmaJr marked this conversation as resolved.
Show resolved Hide resolved

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

bool m_camera_animation_duration_open;

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


bool m_show_clock;
float halfScreen;
RobertGemmaJr marked this conversation as resolved.
Show resolved Hide resolved
RobertGemmaJr marked this conversation as resolved.
Show resolved Hide resolved
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 months[12] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };
RobertGemmaJr marked this conversation as resolved.
Show resolved Hide resolved
RobertGemmaJr marked this conversation as resolved.
Show resolved Hide resolved


int m_simulation_state_selection;
bool m_time_frame_edited;

bool m_show_movie_saved_pop_up;

};


#endif
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@

#include <glm/glm.hpp>
#include <string>
#include <list>

#include "PointOfInterests.h"

enum WASD_KEYS
{
Expand All @@ -40,15 +43,39 @@ enum WASD_KEYS
E = 1 << 5, // binary 100000
};

//struct PointOfInterest {
RobertGemmaJr marked this conversation as resolved.
Show resolved Hide resolved
//
//
// 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);
RobertGemmaJr marked this conversation as resolved.
Show resolved Hide resolved
// 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 ArcBall {


class ArcBallCamera {
public:

ArcBall();
ArcBallCamera();

virtual ~ArcBall();
virtual ~ArcBallCamera();

void mouse_pressed(int button, bool isDown);
void mouse_move(float x, float y);
Expand All @@ -59,22 +86,38 @@ class ArcBall {
glm::mat4& getViewmatrix()
{
updateCameraMatrix();
return viewmatrix;
return m_viewmatrix;
}

void updateCameraMatrix();
kmilo9999 marked this conversation as resolved.
Show resolved Hide resolved

void update_sim_poi(PointOfInterest& poi);


PointOfInterest& get_current_poi();

void set_current_poi(const PointOfInterest& poi);

void reset_camera();

void set_app_mode(unsigned int mode);

protected:
void Rotate(float dTheta, float dPhi);
void RotateEyeAxis(float dy);
void Zoom(float distance);
void Pan(float dx, float dy);
void updateCameraMatrix();


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

PointOfInterest m_current_poi;
PointOfInterest m_simulation_poi;

glm::mat4 viewmatrix;
glm::mat4 m_viewmatrix;
bool m_mouse_left_pressed;
bool m_mouse_right_pressed;
bool m_mouse_center_pressed;
Expand All @@ -84,6 +127,13 @@ class ArcBall {
float m_cameraScrollFactor;

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

#endif
Expand Down
Loading