#pragma once

#include "body.hpp"

namespace physics {

  struct force_generator
  {
    virtual void update_force(rigid_body * body, float duration) = 0;
  };

  struct gravity : force_generator
  {
    vec3 gravity;

    void update_force(rigid_body * body, float duration) override;
  };

  struct spring : force_generator
  {
    // local coordinates
    vec3 connection_point;

    // other local coordinates
    vec3 other_connection_point;

    rigid_body * other;

    float spring_constant;
    float rest_length;

    void update_force(rigid_body * body, float duration) override;
  };

  struct buoyancy : force_generator
  {
    float max_depth;

    float volume;

    float water_height;

    float liquid_density;

    vec3 center_of_buoyancy;

    void update_force(rigid_body * body, float duration) override;
  };
}
