summaryrefslogtreecommitdiffstats
path: root/dev/a3-earthquake/earth.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/earth.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/earth.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/dev/a3-earthquake/earth.h b/dev/a3-earthquake/earth.h
new file mode 100644
index 0000000..2091c11
--- /dev/null
+++ b/dev/a3-earthquake/earth.h
@@ -0,0 +1,57 @@
+/** CSci-4611 Assignment 3: Earthquake
+ */
+
+#ifndef EARTH_H_
+#define EARTH_H_
+
+#include <mingfx.h>
+using namespace mingfx;
+
+
+/** This class can draw a textured earth as either a plane or a sphere or
+ somewhere inbetween in order to support morphing from one shape to another.
+ */
+class Earth {
+public:
+ Earth();
+ virtual ~Earth();
+
+ /// Load texture and define geometry. Initializes the mesh to the planar
+ /// version of the earth. The searchPath is for finding the texture file.
+ void Init(const std::vector<std::string> &search_path);
+
+ /// Draw the Earth to screen using the current version of the mesh set with
+ /// the last call to UpdateMesh.
+ void Draw(const Matrix4 &model_matrix, const Matrix4 &view_matrix, const Matrix4 &proj_matrix);
+
+ /// Given latitude and longitude, calculate 3D position for the flat earth
+ /// model that lies on a plane
+ Point3 LatLongToPlane(double latitude, double longitude) const;
+
+ /// Given latitude and longitude, calculate the 3D position for the spherical
+ /// earth model.
+ Point3 LatLongToSphere(double latitude, double longitude) const;
+
+ /// This can be a helpful debugging aid when creating your triangle mesh. It
+ /// draws the triangles and normals for the current earth mesh.
+ void DrawDebugInfo(const Matrix4 &model_matrix, const Matrix4 &view_matrix, const Matrix4 &proj_matrix);
+
+protected:
+
+ // Stores the earth texture map
+ Texture2D earth_tex_;
+
+ // Stores the earth geometry as a renderable mesh
+ Mesh earth_mesh_;
+
+ // Renders meshes with texture and some simple shading
+ DefaultShader shader_;
+ DefaultShader::MaterialProperties earth_material_;
+
+ // Used only for the DrawDebugInfo() routine
+ QuickShapes quick_shapes_;
+};
+
+
+#endif
+ \ No newline at end of file