add ve name

This commit is contained in:
2025-03-13 15:29:33 +03:00
parent 77b626fb8c
commit c3ee3d3942
9 changed files with 58 additions and 40 deletions

View File

@@ -21,17 +21,17 @@ namespace sandbox
struct camera
{
// Начальное положение камеры
mt::vec3 m_pos = mt::vec3{ 0.0f, 0.0f, 3.0f };
mt::vec3 m_front = mt::vec3{ 0.0f, 0.0f, -1.0f };
mt::vec3 m_up = mt::vec3{ 0.0f, 1.0f, 0.0f };
glm::vec3 m_pos = glm::vec3{ 0.0f, 0.0f, 3.0f };
glm::vec3 m_front = glm::vec3{ 0.0f, 0.0f, -1.0f };
glm::vec3 m_up = glm::vec3{ 0.0f, 1.0f, 0.0f };
float m_speed = 0.05f;
glm::mat4 m_view, m_projection;
void up() { m_pos += m_speed * m_front; }
void down() { m_pos -= m_speed * m_front; }
void left() { m_pos -= mt::normalize(mt::cross(m_front, m_up)) * m_speed; }
void right() { m_pos += mt::normalize(mt::cross(m_front, m_up)) * m_speed; }
void left() { m_pos -= glm::normalize(glm::cross(m_front, m_up)) * m_speed; }
void right() { m_pos += glm::normalize(glm::cross(m_front, m_up)) * m_speed; }
template<typename T>
void update(const T& obj)
@@ -41,7 +41,7 @@ namespace sandbox
static_cast<float>(VE::application::get()->get_glfw()->width()) / VE::application::get()->get_glfw()->height(),
0.1f, 100.0f);
glUniformMatrix4fv(glGetUniformLocation(obj.get_id(), "view"), 1, GL_FALSE, mt::value_ptr(m_view));
glUniformMatrix4fv(glGetUniformLocation(obj.get_id(), "view"), 1, GL_FALSE, glm::value_ptr(m_view));
glUniformMatrix4fv(glGetUniformLocation(obj.get_id(), "projection"), 1, GL_FALSE, glm::value_ptr(m_projection));
}
@@ -75,11 +75,11 @@ namespace sandbox
if (m_pitch > 89.0f) m_pitch = 89.0f;
if (m_pitch < -89.0f) m_pitch = -89.0f;
mt::vec3 front;
front.x = std::cos(mt::radians(m_yaw)) * std::cos(mt::radians(m_pitch));
front.y = std::sin(mt::radians(m_pitch));
front.z = std::sin(mt::radians(m_yaw)) * std::cos(mt::radians(m_pitch));
m_front = mt::normalize(front);
glm::vec3 front;
front.x = std::cos(glm::radians(m_yaw)) * std::cos(glm::radians(m_pitch));
front.y = std::sin(glm::radians(m_pitch));
front.z = std::sin(glm::radians(m_yaw)) * std::cos(glm::radians(m_pitch));
m_front = glm::normalize(front);
}
};