X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fui%2Fui.cpp;h=e7e6b0c7725a36264222a08633119d4f443ba6d2;hb=75172fd735e34082c34b47ae7c194445b53038d9;hp=5b0eec8b1dac47bb7b1798e51dbfb4d814892893;hpb=4da2ae6f12d7cf4594edb2d560c5c112e9bcd094;p=blank.git diff --git a/src/ui/ui.cpp b/src/ui/ui.cpp index 5b0eec8..e7e6b0c 100644 --- a/src/ui/ui.cpp +++ b/src/ui/ui.cpp @@ -85,7 +85,8 @@ void PlayerController::Invalidate() noexcept { 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(); @@ -251,21 +252,21 @@ HUD::HUD(Environment &env, Config &config, const Player &player) messages.Background(glm::vec4(0.5f)); // crosshair - OutlineMesh::Buffer buf; + PrimitiveMesh::Buffer buf; buf.vertices = std::vector({ { -10.0f, 0.0f, 0.0f }, { 10.0f, 0.0f, 0.0f }, { 0.0f, -10.0f, 0.0f }, { 0.0f, 10.0f, 0.0f }, }); - buf.indices = std::vector({ + buf.indices = std::vector({ 0, 1, 2, 3 }); - buf.colors.resize(4, { 10.0f, 10.0f, 10.0f }); + buf.colors.resize(4, { 10.0f, 10.0f, 10.0f, 1.0f }); crosshair.Update(buf); } namespace { -OutlineMesh::Buffer outl_buf; +PrimitiveMesh::Buffer outl_buf; } @@ -273,7 +274,7 @@ void HUD::FocusBlock(const Chunk &chunk, int index) { const Block &block = chunk.BlockAt(index); const BlockType &type = chunk.Type(index); outl_buf.Clear(); - type.FillOutlineMesh(outl_buf); + type.OutlinePrimitiveMesh(outl_buf); outline.Update(outl_buf); outline_transform = chunk.Transform(player.GetEntity().ChunkCoords()); outline_transform *= chunk.ToTransform(Chunk::ToPos(index), index); @@ -376,9 +377,9 @@ void HUD::Update(int dt) { void HUD::Render(Viewport &viewport) noexcept { // block focus if (outline_visible && config.video.world) { - PlainColor &outline_prog = viewport.WorldOutlineProgram(); + PlainColor &outline_prog = viewport.WorldColorProgram(); outline_prog.SetM(outline_transform); - outline.Draw(); + outline.DrawLines(); } // clear depth buffer so everything renders above the world @@ -404,11 +405,11 @@ void HUD::Render(Viewport &viewport) noexcept { } // crosshair - PlainColor &outline_prog = viewport.HUDOutlineProgram(); + PlainColor &outline_prog = viewport.HUDColorProgram(); viewport.EnableInvertBlending(); viewport.SetCursor(glm::vec3(0.0f), Gravity::CENTER); outline_prog.SetM(viewport.Cursor()); - crosshair.Draw(); + crosshair.DrawLines(); } // debug overlay