aboutsummaryrefslogtreecommitdiffstats
path: root/dev/a3-earthquake/quake_app.h
diff options
context:
space:
mode:
authorMatt Strapp <matt@mattstrapp.net>2021-10-11 20:02:46 -0500
committerMatt Strapp <matt@mattstrapp.net>2021-10-11 20:02:46 -0500
commitaa2a4faf537c9bc7e2e87ff38483e2bf53ed24cf (patch)
treed5049549bcb1fed21d118c200ae40bac7e1ebbcc /dev/a3-earthquake/quake_app.h
parentFix gnu's stupidity (diff)
parentPublish a3 (diff)
downloadcsci4611-aa2a4faf537c9bc7e2e87ff38483e2bf53ed24cf.tar
csci4611-aa2a4faf537c9bc7e2e87ff38483e2bf53ed24cf.tar.gz
csci4611-aa2a4faf537c9bc7e2e87ff38483e2bf53ed24cf.tar.bz2
csci4611-aa2a4faf537c9bc7e2e87ff38483e2bf53ed24cf.tar.lz
csci4611-aa2a4faf537c9bc7e2e87ff38483e2bf53ed24cf.tar.xz
csci4611-aa2a4faf537c9bc7e2e87ff38483e2bf53ed24cf.tar.zst
csci4611-aa2a4faf537c9bc7e2e87ff38483e2bf53ed24cf.zip
Merge branch 'support-code' of github.umn.edu:umn-csci-4611-f21/shared-upstream
Diffstat (limited to '')
-rw-r--r--dev/a3-earthquake/quake_app.h84
1 files changed, 84 insertions, 0 deletions
diff --git a/dev/a3-earthquake/quake_app.h b/dev/a3-earthquake/quake_app.h
new file mode 100644
index 0000000..21d7a8d
--- /dev/null
+++ b/dev/a3-earthquake/quake_app.h
@@ -0,0 +1,84 @@
+/** CSci-4611 Assignment 3: Earthquake
+ */
+
+#ifndef QUAKEAPP_H_
+#define QUAKEAPP_H_
+
+#include <mingfx.h>
+using namespace mingfx;
+
+#include "earthquake_database.h"
+#include "earth.h"
+
+#include <string>
+#include <vector>
+
+
+/** Main application class for the Earthquake app.
+ */
+class QuakeApp : public GraphicsApp {
+public:
+
+ QuakeApp();
+ virtual ~QuakeApp();
+
+ /// Dragging with the mouse tilts the earth when in globe mode
+ void OnLeftMouseDrag(const Point2 &pos, const Vector2 &delta);
+
+ /// Pressing the globe button toggles between flat earth and sphere earth modes
+ void OnGlobeBtnPressed();
+
+ /// Pressing the debug button toggles on/off the underlying triangle mesh and normals
+ void OnDebugBtnPressed();
+
+ /// The slides controls the speed of the playback for the earthquakes animation
+ void OnSliderUpdate(float value);
+
+
+ /// The animation gets updated inside this function.
+ void UpdateSimulation(double dt);
+
+ /// Initializes NanoGUI widgets
+ void InitNanoGUI();
+
+ /// The models and textures get initialized in this function.
+ void InitOpenGL();
+
+ /// The earth and earthquake spheres get drawn in this function.
+ void DrawUsingOpenGL();
+
+private:
+ // controls playback
+ double current_time_;
+ double playback_scale_;
+
+ // true if drawing debugging info for the mesh
+ bool debug_mode_;
+
+ // Database through which you can access the earthquakes
+ EarthquakeDatabase quake_db_;
+
+ // Object for rendering textured earth geometry
+ Earth earth_;
+
+ // Background image
+ Texture2D stars_tex_;
+
+ // Sets up the computer graphics camera
+ Matrix4 view_matrix_;
+ Matrix4 proj_matrix_;
+
+ // Gui elements
+ nanogui::Button *globe_btn_;
+ nanogui::Label *date_label_;
+ nanogui::TextBox *speed_box_;
+
+ // A list of paths to search for data files (images and shaders)
+ std::vector<std::string> search_path_;
+
+ // Used to draw a background texture, you can also use this to draw the
+ // earthquakes if you want.
+ QuickShapes quick_shapes_;
+};
+
+#endif \ No newline at end of file