ui, camera
This commit is contained in:
@ -1313,7 +1313,7 @@ void DebugDraw::DrawString(const b3Color& color, const char* text, ...)
|
||||
va_list args;
|
||||
va_start(args, text);
|
||||
|
||||
ImGui::SetNextWindowPos(ImVec2(0.0f, 20.0f));
|
||||
ImGui::SetNextWindowPos(ImVec2(0.0f, 40.0f));
|
||||
ImGui::SetNextWindowSize(ImVec2(g_camera->m_width, g_camera->m_height));
|
||||
|
||||
ImGui::Begin(g_overlayName, NULL, ImVec2(0.0f, 0.0f), 0.0f, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoScrollbar);
|
||||
|
@ -1321,7 +1321,7 @@ void DebugDraw::DrawString(const b3Color& color, const char* text, ...)
|
||||
va_list args;
|
||||
va_start(args, text);
|
||||
|
||||
ImGui::SetNextWindowPos(ImVec2(0.0f, 20.0f));
|
||||
ImGui::SetNextWindowPos(ImVec2(0.0f, 40.0f));
|
||||
ImGui::SetNextWindowSize(ImVec2(g_camera->m_width, g_camera->m_height));
|
||||
|
||||
ImGui::Begin(g_overlayName, NULL, ImVec2(0.0f, 0.0f), 0.0f, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoScrollbar);
|
||||
|
@ -113,50 +113,55 @@ inline void Model::Action_SingleStep()
|
||||
inline void Model::Action_DefaultCamera()
|
||||
{
|
||||
m_camera.m_q = b3QuatRotationX(-0.125f * B3_PI);
|
||||
|
||||
b3Quat d = b3QuatRotationY(0.125f * B3_PI);
|
||||
|
||||
m_camera.m_q = d * m_camera.m_q;
|
||||
m_camera.m_q.Normalize();
|
||||
m_camera.m_center.SetZero();
|
||||
m_camera.m_zoom = 20.0f;
|
||||
m_camera.m_zoom = 50.0f;
|
||||
}
|
||||
|
||||
inline void Model::Action_LeftCamera()
|
||||
{
|
||||
m_camera.m_q.Set(b3Vec3(0.0f, 1.0f, 0.0f), 0.5f * B3_PI);
|
||||
m_camera.m_q = b3QuatRotationX(0.5f * B3_PI);
|
||||
m_camera.m_center.SetZero();
|
||||
m_camera.m_zoom = 20.0f;
|
||||
m_camera.m_zoom = 50.0f;
|
||||
}
|
||||
|
||||
inline void Model::Action_RightCamera()
|
||||
{
|
||||
m_camera.m_q.Set(b3Vec3(0.0f, 1.0f, 0.0f), -0.5f * B3_PI);
|
||||
m_camera.m_q = b3QuatRotationX(-0.5f * B3_PI);
|
||||
m_camera.m_center.SetZero();
|
||||
m_camera.m_zoom = 20.0f;
|
||||
m_camera.m_zoom = 50.0f;
|
||||
}
|
||||
|
||||
inline void Model::Action_BottomCamera()
|
||||
{
|
||||
m_camera.m_q.Set(b3Vec3(1.0f, 0.0f, 0.0f), 0.5f * B3_PI);
|
||||
m_camera.m_q = b3QuatRotationX(0.5f * B3_PI);
|
||||
m_camera.m_center.SetZero();
|
||||
m_camera.m_zoom = 20.0f;
|
||||
m_camera.m_zoom = 50.0f;
|
||||
}
|
||||
|
||||
inline void Model::Action_TopCamera()
|
||||
{
|
||||
m_camera.m_q.Set(b3Vec3(1.0f, 0.0f, 0.0f), -0.5f * B3_PI);
|
||||
m_camera.m_q = b3QuatRotationX(-0.5f * B3_PI);
|
||||
m_camera.m_center.SetZero();
|
||||
m_camera.m_zoom = 20.0f;
|
||||
m_camera.m_zoom = 50.0f;
|
||||
}
|
||||
|
||||
inline void Model::Action_BackCamera()
|
||||
{
|
||||
m_camera.m_q.Set(b3Vec3(0.0f, 1.0f, 0.0f), -B3_PI);
|
||||
m_camera.m_q = b3QuatRotationX(-B3_PI);
|
||||
m_camera.m_center.SetZero();
|
||||
m_camera.m_zoom = 20.0f;
|
||||
m_camera.m_zoom = 50.0f;
|
||||
}
|
||||
|
||||
inline void Model::Action_FrontCamera()
|
||||
{
|
||||
m_camera.m_q.SetIdentity();
|
||||
m_camera.m_center.SetZero();
|
||||
m_camera.m_zoom = 20.0f;
|
||||
m_camera.m_zoom = 50.0f;
|
||||
}
|
||||
|
||||
inline void Model::Command_Press_Key(int button)
|
||||
|
@ -139,6 +139,8 @@ View::~View()
|
||||
void View::Command_PreDraw()
|
||||
{
|
||||
ImGui_GLFW_GL_NewFrame();
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
|
||||
}
|
||||
|
||||
void View::Command_Draw()
|
||||
@ -146,14 +148,9 @@ void View::Command_Draw()
|
||||
Camera& camera = m_model->m_camera;
|
||||
Settings& settings = m_model->m_settings;
|
||||
|
||||
ImVec2 buttonSize(-1.0f, 0.0f);
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
|
||||
|
||||
bool openAbout = false;
|
||||
if (ImGui::BeginMainMenuBar())
|
||||
{
|
||||
|
||||
if (ImGui::BeginMenu("File"))
|
||||
{
|
||||
if (ImGui::MenuItem("Save"))
|
||||
@ -216,9 +213,10 @@ void View::Command_Draw()
|
||||
if (openAbout)
|
||||
{
|
||||
ImGui::OpenPopup("About Bounce Testbed");
|
||||
openAbout = false;
|
||||
}
|
||||
|
||||
ImVec2 buttonSize(-1.0f, 0.0f);
|
||||
|
||||
if (ImGui::BeginPopupModal("About Bounce Testbed", NULL, ImGuiWindowFlags_Popup | ImGuiWindowFlags_NoResize))
|
||||
{
|
||||
extern b3Version b3_version;
|
||||
@ -236,70 +234,87 @@ void View::Command_Draw()
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
ImGui::SetNextWindowPos(ImVec2(camera.m_width - 250.0f, 0.0f));
|
||||
ImGui::SetNextWindowSize(ImVec2(250.0f, camera.m_height));
|
||||
ImGui::SetNextWindowPos(ImVec2(0.0f, 20.0f));
|
||||
ImGui::SetNextWindowSize(ImVec2(g_camera->m_width, 20.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowMinSize, ImVec2(0.0f, 0.0f));
|
||||
|
||||
ImGui::Begin("Test", NULL, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize);
|
||||
ImGui::Begin("##ToolBar", NULL, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_MenuBar);
|
||||
|
||||
if (ImGui::BeginMenuBar())
|
||||
{
|
||||
ImGui::PushItemWidth(250.0f);
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::Combo("##Test", &settings.testID, GetTestName, NULL, g_testCount, g_testCount))
|
||||
{
|
||||
m_model->Action_SelectTest(settings.testID);
|
||||
}
|
||||
|
||||
ImGui::PopItemWidth();
|
||||
|
||||
ImVec2 menuButtonSize(100.0f, 0.0f);
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::Button("Previous", menuButtonSize))
|
||||
{
|
||||
m_model->Action_PreviousTest();
|
||||
}
|
||||
|
||||
if (ImGui::Button("Next", menuButtonSize))
|
||||
{
|
||||
m_model->Action_NextTest();
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::Button("Play/Pause", menuButtonSize))
|
||||
{
|
||||
m_model->Action_PlayPause();
|
||||
}
|
||||
|
||||
if (ImGui::Button("Single Step", menuButtonSize))
|
||||
{
|
||||
m_model->Action_SingleStep();
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::Button("Restart", menuButtonSize))
|
||||
{
|
||||
m_model->Action_RestartTest();
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::Button("Reset Camera", menuButtonSize))
|
||||
{
|
||||
m_model->Action_DefaultCamera();
|
||||
}
|
||||
|
||||
ImGui::EndMenuBar();
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
|
||||
ImGui::PopStyleVar();
|
||||
|
||||
ImGui::SetNextWindowPos(ImVec2(camera.m_width - 250.0f, 40.0f));
|
||||
ImGui::SetNextWindowSize(ImVec2(250.0f, camera.m_height - 40.0f));
|
||||
ImGui::Begin("Test Settings", NULL, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize);
|
||||
|
||||
ImGui::PushItemWidth(-1.0f);
|
||||
|
||||
if (ImGui::Combo("##Test", &settings.testID, GetTestName, NULL, g_testCount, g_testCount))
|
||||
{
|
||||
m_model->Action_SelectTest(settings.testID);
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::Button("Restart", buttonSize))
|
||||
{
|
||||
m_model->Action_RestartTest();
|
||||
}
|
||||
|
||||
if (ImGui::Button("Previous", buttonSize))
|
||||
{
|
||||
m_model->Action_PreviousTest();
|
||||
}
|
||||
|
||||
if (ImGui::Button("Next", buttonSize))
|
||||
{
|
||||
m_model->Action_NextTest();
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::Button("Play/Pause", buttonSize))
|
||||
{
|
||||
m_model->Action_PlayPause();
|
||||
}
|
||||
|
||||
if (ImGui::Button("Single Step", buttonSize))
|
||||
{
|
||||
m_model->Action_SingleStep();
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Text("Camera");
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::Button("Restart##Camera", buttonSize))
|
||||
{
|
||||
m_model->Action_DefaultCamera();
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Text("Settings");
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Text("Hertz");
|
||||
ImGui::SliderFloat("##Hertz", &settings.hertz, 0.0f, 240.0f, "%.1f");
|
||||
|
||||
ImGui::Text("Velocity Iterations");
|
||||
ImGui::SliderInt("##Velocity Iterations", &settings.velocityIterations, 0, 50);
|
||||
|
||||
ImGui::Text("Position Iterations");
|
||||
ImGui::SliderInt("#Position Iterations", &settings.positionIterations, 0, 50);
|
||||
ImGui::SliderInt("##Position Iterations", &settings.positionIterations, 0, 50);
|
||||
|
||||
ImGui::Checkbox("Sleep", &settings.sleep);
|
||||
ImGui::Checkbox("Convex Cache", &settings.convexCache);
|
||||
ImGui::Checkbox("Warm Start", &settings.warmStart);
|
||||
@ -307,12 +322,12 @@ void View::Command_Draw()
|
||||
ImGui::PopItemWidth();
|
||||
|
||||
ImGui::End();
|
||||
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
|
||||
void View::Command_PostDraw()
|
||||
{
|
||||
ImGui::PopStyleVar();
|
||||
|
||||
ImGui::Render();
|
||||
|
||||
ImGui_GLFW_GL_RenderDrawData(ImGui::GetDrawData());
|
||||
|
Reference in New Issue
Block a user