X-Git-Url: http://git.localhorst.tv/?p=blobs.git;a=blobdiff_plain;f=src%2Fworld%2FPlanet.hpp;h=c109934d40e012989cfc6b806610df8821213327;hp=28ecaa03cd206a0e254685928dabeb398203af07;hb=dd8b3145a03ed676b0ae6311c29fc3d68f666b15;hpb=6c1097479fd1ea41f0f76b91e67613822acf2e90 diff --git a/src/world/Planet.hpp b/src/world/Planet.hpp index 28ecaa0..c109934 100644 --- a/src/world/Planet.hpp +++ b/src/world/Planet.hpp @@ -75,6 +75,19 @@ public: // center point of tile on surface at elevation glm::dvec3 TileCenter(int surface, int x, int y, double elevation = 0.0) const noexcept; + static glm::dvec3 SurfaceNormal(int srf) noexcept { + glm::dvec3 nrm(0.0); + nrm[(srf + 2) % 3] = srf < 3 ? 1.0 : -1.0; + return nrm; + } + static glm::dmat3 SurfaceOrientation(int srf) noexcept { + glm::dmat3 mat(0.0); + mat[(srf + 0) % 3][0] = 1.0; + mat[(srf + 2) % 3][1] = srf < 3 ? 1.0 : -1.0; + mat[(srf + 1) % 3][2] = srf < 3 ? 1.0 : -1.0; + return mat; + } + void BuildVAO(const Set &); void Draw(app::Assets &, graphics::Viewport &) override;