]> git.localhorst.tv Git - blobs.git/blobdiff - src/world/Planet.hpp
varying material and schlick/fresnel
[blobs.git] / src / world / Planet.hpp
index 237159994c47da1c9dbd1e23bd235ffd2214cbb0..3677ca4c92aeccd29e950920bc7461ca6c7c964f 100644 (file)
@@ -36,11 +36,13 @@ public:
 
 public:
        /// surface normal
-       glm::dvec3 NormalAt(const glm::dvec3 &p) const noexcept { return normalize(p); }
+       glm::dvec3 NormalAt(const glm::dvec3 &p) const noexcept { return glm::normalize(p); }
        /// height over surface
-       double ElevationAt(const glm::dvec3 &p) const noexcept { return length(p) - Radius(); }
+       double ElevationAt(const glm::dvec3 &p) const noexcept { return glm::length(p) - Radius(); }
        /// distance to planet center
-       double DistanceAt(const glm::dvec3 &p) const noexcept { return length(p); }
+       double DistanceAt(const glm::dvec3 &p) const noexcept { return glm::length(p); }
+       /// acceleration due to gravity at given point
+       glm::dvec3 GravityAt(const glm::dvec3 &p) const noexcept { return NormalAt(p) * (-GravitationalParameter() / glm::length2(p)); }
 
        /// get ground tile
        Tile &TileAt(const glm::dvec3 &) noexcept;
@@ -58,7 +60,7 @@ public:
        // center point of tile on surface at elevation
        glm::dvec3 TileCenter(int surface, int x, int y, double elevation = 0.0) const noexcept;
 
-       void BuildVAO(const Set<TileType> &);
+       void BuildVAO();
        void Draw(app::Assets &, graphics::Viewport &) override;
 
 private:
@@ -86,6 +88,9 @@ private:
                glm::vec3 position;
                glm::vec3 normal;
                glm::vec3 tex_coord;
+               float shiny;
+               float glossy;
+               float metallic;
        };
        std::unique_ptr<graphics::SimpleVAO<Attributes, unsigned int>> vao;