Better Gizmos
Gizmos now display half opacity when occluded, same for lines Improved editor camera, should keep updating even if not controlled Viewport should not grab input when another imgui element is over it
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include <glm/trigonometric.hpp>
|
||||
|
||||
#include "src/Core/Logger.h"
|
||||
#include <src/Vendors/imgui/imgui.h>
|
||||
|
||||
namespace Nuake
|
||||
{
|
||||
@@ -79,7 +80,8 @@ namespace Nuake
|
||||
mouseLastY = y;
|
||||
}
|
||||
|
||||
if (hover && Input::IsMouseButtonDown(1))
|
||||
|
||||
if (controlled && Input::IsMouseButtonDown(1))
|
||||
{
|
||||
// Should probably not have speed binding in here.
|
||||
if (Input::YScroll != 0)
|
||||
@@ -131,7 +133,6 @@ namespace Nuake
|
||||
firstMouse = false;
|
||||
}
|
||||
|
||||
// mouse
|
||||
float diffx = x - mouseLastX;
|
||||
float diffy = mouseLastY - y;
|
||||
mouseLastX = x;
|
||||
@@ -159,31 +160,32 @@ namespace Nuake
|
||||
SetDirection(glm::normalize(Direction));
|
||||
Right = glm::normalize(glm::cross(Up, Direction));
|
||||
|
||||
if (hover)
|
||||
|
||||
if (Input::IsMouseButtonDown(2))
|
||||
{
|
||||
if (Input::IsMouseButtonDown(2))
|
||||
{
|
||||
Vector3 movement = Vector3(0);
|
||||
const float deltaX = x - mouseLastX;
|
||||
const float deltaY = y - mouseLastY;
|
||||
movement += Right * (deltaX * ts);
|
||||
movement += Up * (deltaY * ts);
|
||||
Translation += Vector3(movement) * 0.5f;
|
||||
Vector3 movement = Vector3(0);
|
||||
const float deltaX = x - mouseLastX;
|
||||
const float deltaY = y - mouseLastY;
|
||||
movement += Right * (deltaX * ts);
|
||||
movement += Up * (deltaY * ts);
|
||||
Translation += Vector3(movement) * 0.5f;
|
||||
|
||||
mouseLastX = x;
|
||||
mouseLastY = y;
|
||||
controlled = true;
|
||||
mouseLastX = x;
|
||||
mouseLastY = y;
|
||||
controlled = true;
|
||||
|
||||
SetDirection(glm::normalize(Direction));
|
||||
}
|
||||
else if (Input::YScroll != 0)
|
||||
{
|
||||
Translation += Vector3(Direction) * Input::YScroll;
|
||||
Input::YScroll = 0.0f;
|
||||
}
|
||||
SetDirection(glm::normalize(Direction));
|
||||
}
|
||||
else if (Input::YScroll != 0)
|
||||
{
|
||||
Translation += Vector3(Direction) * Input::YScroll;
|
||||
Input::YScroll = 0.0f;
|
||||
}
|
||||
|
||||
|
||||
SetDirection(glm::normalize(Direction));
|
||||
|
||||
|
||||
mouseLastX = x;
|
||||
mouseLastY = y;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,11 @@ namespace Nuake
|
||||
{
|
||||
class EditorCamera : public Camera
|
||||
{
|
||||
private:
|
||||
bool m_IsFlying = false;
|
||||
|
||||
public:
|
||||
|
||||
EditorCamera()
|
||||
{
|
||||
Yaw = 0.0f;
|
||||
@@ -27,6 +31,7 @@ namespace Nuake
|
||||
void SetYaw(float yaw);
|
||||
void SetPitch(float pitch);
|
||||
|
||||
bool IsFlying() const { return m_IsFlying; }
|
||||
private:
|
||||
bool controlled = false;
|
||||
bool firstMouse = false;
|
||||
|
||||
@@ -597,10 +597,14 @@ namespace Nuake {
|
||||
});
|
||||
}
|
||||
|
||||
for (int i = 0; i < (face_geo_inst->vertex_count - 2) * 3; ++i)
|
||||
for (int i = 0; i < (face_geo_inst->vertex_count - 2) * 3; i += 3)
|
||||
{
|
||||
uint32_t index = face_geo_inst->indices[i];
|
||||
indices.push_back((unsigned int)index);
|
||||
uint32_t i1 = face_geo_inst->indices[i];
|
||||
uint32_t i2 = face_geo_inst->indices[i + 1];
|
||||
uint32_t i3 = face_geo_inst->indices[i + 2];
|
||||
indices.push_back(i3);
|
||||
indices.push_back(i2);
|
||||
indices.push_back(i1);
|
||||
}
|
||||
|
||||
m_StaticWorld[currentMaterial].push_back({vertices, indices});
|
||||
|
||||
Reference in New Issue
Block a user