Mostly fixes rotation shit and other obscure bugs

This commit is contained in:
2024-09-29 01:31:59 -04:00
parent af2cd5db61
commit c6236eda98
41 changed files with 623 additions and 797 deletions

View File

@@ -14,3 +14,4 @@ target_link_libraries(TitorEditor PRIVATE FGLEngine)
target_include_directories(TitorEditor PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_compile_definitions(TitorEditor PUBLIC TITOR_EDITOR)
target_compile_features(TitorEditor PRIVATE cxx_std_23)
target_link_libraries(TitorEditor PRIVATE glfw ImGui)

View File

@@ -4,8 +4,8 @@
#include "engine/gameobjects/components/ModelComponent.hpp"
#include "engine/gameobjects/components/drawers.hpp"
#include "engine/assets/model/Model.hpp"
#include "engine/gameobjects/components/drawers.hpp"
#include "gui/safe_include.hpp"
namespace fgl::engine
@@ -16,15 +16,25 @@ namespace fgl::engine
{
drawComponentTransform( m_transform );
ImGui::Text( "MODEL COMPONENT WOOOOOO" );
//ImGui::Text( "MODEL COMPONENT WOOOOOO" );
// TODO: If the model is not set then we should be able to set it to one from the file selection
if ( this->m_model == nullptr )
{
ImGui::Text( "Undefined model" );
return;
}
const auto& model { *this->m_model };
ImGui::Text( "%i primitives", model.m_primitives.size() );
}
std::string_view ModelComponent::name() const
{
if ( m_model )
return m_model->getName();
else
return "Empty Model";
if ( !m_model ) return "Empty";
return m_model->getName();
}
#endif

View File

@@ -28,24 +28,26 @@ namespace fgl::engine::gui
constexpr double pitch_rate { 1.0 };
constexpr double yaw_rate { 1.0 };
if ( ImGui::IsKeyDown( ImGuiKey_DownArrow ) )
{
yaw_change.pitch() -= ( delta_time * pitch_rate );
}
if ( ImGui::IsKeyDown( ImGuiKey_UpArrow ) )
{
yaw_change.pitch() += ( delta_time * pitch_rate );
// yaw_change.xAngle() += ( delta_time * pitch_rate );
yaw_change.addY( delta_time * pitch_rate );
}
if ( ImGui::IsKeyDown( ImGuiKey_LeftArrow ) )
if ( ImGui::IsKeyDown( ImGuiKey_DownArrow ) )
{
pitch_change.yaw() -= ( delta_time * yaw_rate );
// yaw_change.xAngle() -= ( delta_time * pitch_rate );
yaw_change.addY( -( delta_time * pitch_rate ) );
}
if ( ImGui::IsKeyDown( ImGuiKey_RightArrow ) )
{
pitch_change.yaw() += ( delta_time * yaw_rate );
pitch_change.addZ( delta_time * yaw_rate );
}
if ( ImGui::IsKeyDown( ImGuiKey_LeftArrow ) )
{
pitch_change.addZ( -( delta_time * yaw_rate ) );
}
Vector move_dir { 0.0f };

View File

@@ -44,17 +44,17 @@ namespace fgl::engine::gui
if ( changed[ Pitch ] )
{
rot.pitch() = dat[ Pitch ];
//TODO: rot.xAngle() = dat[ Pitch ];
}
if ( changed[ Roll ] )
{
rot.roll() = dat[ Roll ];
//TODO: rot.zAngle() = dat[ Roll ];
}
if ( changed[ Yaw ] )
{
rot.yaw() = dat[ Yaw ];
//TODO: rot.yAngle() = dat[ Yaw ];
}
}