#define BLANK_WORLD_ENTITY_HPP_
#include "Chunk.hpp"
+#include "EntityDerivative.hpp"
#include "EntityState.hpp"
+#include "Steering.hpp"
#include "../geometry/primitive.hpp"
#include "../model/Instance.hpp"
class DirectionalLighting;
class EntityController;
class Shape;
+class World;
class Entity {
Entity(const Entity &) noexcept;
Entity &operator =(const Entity &) = delete;
+ Steering &GetSteering() noexcept { return steering; }
+ const Steering &GetSteering() const noexcept { return steering; }
+
bool HasController() const noexcept { return ctrl; }
// entity takes over ownership of controller
void SetController(EntityController *c) noexcept;
bool Dead() const noexcept { return dead; }
bool CanRemove() const noexcept { return dead && ref_count <= 0; }
- void Update(float dt);
+ void Update(World &, float dt);
void Render(const glm::mat4 &M, DirectionalLighting &prog) noexcept {
if (model) model.Render(M, prog);
}
private:
+ void UpdatePhysics(World &, float dt);
void UpdateTransforms() noexcept;
void UpdateHeading() noexcept;
void UpdateModel(float dt) noexcept;
private:
void OrientHead(float dt) noexcept;
+ EntityDerivative CalculateStep(
+ World &,
+ const EntityState &cur,
+ float dt,
+ const EntityDerivative &prev
+ ) const;
+
+
private:
+ Steering steering;
EntityController *ctrl;
Instance model;
// TODO: I'd prefer a drag solution
float max_vel;
+ // TODO: split max_force into (local) axes?
+ // e.g. players may want to disable vertical thrust under certain
+ // conditions (e.g. "walking" ^^)
float max_force;
int ref_count;