-Subproject commit ed7b81207b13b87a3a9097b9e25ebd06aa814d97
+Subproject commit 00b0cac2c26af161cc436d404d033e242a00c5a6
const Model &GetModel() const noexcept { return *model; }
glm::mat4 EyesTransform() const noexcept;
+ Part::State &EyesState() noexcept;
void Render(const glm::mat4 &, DirectionalLighting &);
const Part &GetPart(std::size_t i) const noexcept { return *part[i]; }
void SetEyes(std::uint16_t id) { eyes_id = id; }
-
const Part &GetEyesPart() const noexcept { return GetPart(eyes_id); }
void Enumerate();
std::uint16_t Enumerate(std::uint16_t) noexcept;
void Index(std::vector<Part *> &) noexcept;
+ std::uint16_t ID() const noexcept { return id; }
+
glm::mat4 LocalTransform(const Instance &) const noexcept;
glm::mat4 GlobalTransform(const Instance &) const noexcept;
}
+Part::State &Instance::EyesState() noexcept {
+ return state[model->GetEyesPart().ID()];
+}
+
glm::mat4 Instance::EyesTransform() const noexcept {
return model->GetEyesPart().GlobalTransform(*this);
}
void PlayerController::UpdatePlayer() noexcept {
constexpr float max_vel = 5.0f; // in m/s
if (dirty) {
- player.GetEntity().Orientation(glm::quat(glm::vec3(pitch, yaw, 0.0f)));
+ player.GetEntity().Orientation(glm::quat(glm::vec3(0.0f, yaw, 0.0f)));
+ player.GetEntity().GetModel().EyesState().orientation = glm::quat(glm::vec3(pitch, 0.0f, 0.0f));
player.GetEntity().TargetVelocity(glm::rotateY(move_dir * max_vel, yaw));
Ray aim = player.Aim();