aboutsummaryrefslogtreecommitdiffstats
path: root/dev/a3-earthquake/earth.h
diff options
context:
space:
mode:
authorMatt Strapp <matt@mattstrapp.net>2021-10-18 20:43:13 -0500
committerMatt Strapp <matt@mattstrapp.net>2021-10-18 20:43:13 -0500
commit9d5c7eaac6e14caa0c5640efbf973e603eee0cf8 (patch)
tree2326363e9690ca2facb7bed0c7c7c5c14f5a1d64 /dev/a3-earthquake/earth.h
parentDo w3 (diff)
downloadcsci4611-9d5c7eaac6e14caa0c5640efbf973e603eee0cf8.tar
csci4611-9d5c7eaac6e14caa0c5640efbf973e603eee0cf8.tar.gz
csci4611-9d5c7eaac6e14caa0c5640efbf973e603eee0cf8.tar.bz2
csci4611-9d5c7eaac6e14caa0c5640efbf973e603eee0cf8.tar.lz
csci4611-9d5c7eaac6e14caa0c5640efbf973e603eee0cf8.tar.xz
csci4611-9d5c7eaac6e14caa0c5640efbf973e603eee0cf8.tar.zst
csci4611-9d5c7eaac6e14caa0c5640efbf973e603eee0cf8.zip
Diffstat (limited to 'dev/a3-earthquake/earth.h')
-rw-r--r--dev/a3-earthquake/earth.h33
1 files changed, 23 insertions, 10 deletions
diff --git a/dev/a3-earthquake/earth.h b/dev/a3-earthquake/earth.h
index 2091c11..877b8ab 100644
--- a/dev/a3-earthquake/earth.h
+++ b/dev/a3-earthquake/earth.h
@@ -15,14 +15,14 @@ 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);
+ 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);
+ 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
@@ -31,25 +31,38 @@ public:
/// 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);
-
+ void DrawDebugInfo(const Matrix4& model_matrix, const Matrix4& view_matrix, const Matrix4& proj_matrix);
+
+ /// Drawing either plane or sphere
+ void set_globe_mode(bool mode);
+
protected:
-
+ const int nslices = 10;
+ const int nstacks = 10;
+
// 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_;
+
+ //Helper values needed for making earth
+ std::vector<unsigned int> indices_;
+ std::vector<Point3> vertices_;
+ std::vector<Point3> sphVertices_;
+ std::vector<Vector3> normals_;
+ std::vector<Vector3> sphNormals_;
+ std::vector<Point2> tex_;
};