fix capsule drawing, add quaternion convenience functions
This commit is contained in:
@ -1295,7 +1295,10 @@ void DebugDraw::DrawString(const char* text, const b3Color& color, ...)
|
||||
|
||||
void DebugDraw::DrawSphere(const b3SphereShape* s, const b3Color& c, const b3Transform& xf)
|
||||
{
|
||||
m_solid->DrawSphere(s->m_radius, c, xf);
|
||||
b3Transform xfc;
|
||||
xfc.rotation = xf.rotation;
|
||||
xfc.position = xf * s->m_center;
|
||||
m_solid->DrawSphere(s->m_radius, c, xfc);
|
||||
}
|
||||
|
||||
void DebugDraw::DrawCapsule(const b3CapsuleShape* s, const b3Color& c, const b3Transform& xf)
|
||||
@ -1317,14 +1320,15 @@ void DebugDraw::DrawCapsule(const b3CapsuleShape* s, const b3Color& c, const b3T
|
||||
{
|
||||
b3Transform xfc;
|
||||
xfc.rotation = xf.rotation;
|
||||
xfc.position = xf * c2;
|
||||
m_solid->DrawSphere(radius, c, xfc);
|
||||
xfc.position = xf * ( 0.5f * (c1 + c2) );
|
||||
m_solid->DrawCylinder(radius, height, c, xfc);
|
||||
}
|
||||
|
||||
{
|
||||
const float32 z_bias = 0.0002f;
|
||||
radius += z_bias;
|
||||
m_solid->DrawCylinder(radius, height, c, xf);
|
||||
b3Transform xfc;
|
||||
xfc.rotation = xf.rotation;
|
||||
xfc.position = xf * c2;
|
||||
m_solid->DrawSphere(radius, c, xfc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -222,8 +222,10 @@ bool GetTestName(void*, int idx, const char** name)
|
||||
|
||||
void Interface()
|
||||
{
|
||||
ImGui::SetNextWindowPos(ImVec2(g_camera.m_width - 250.0f, 0.0f));
|
||||
ImGui::SetNextWindowPos(ImVec2(g_camera.m_width, 0.0f));
|
||||
ImGui::SetNextWindowSize(ImVec2(250.0f, g_camera.m_height));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
|
||||
|
||||
ImGui::Begin("Controls", NULL, ImVec2(0.0f, 0.0f), 0.25f, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse);
|
||||
|
||||
ImGui::PushItemWidth(-1.0f);
|
||||
@ -296,6 +298,7 @@ void Interface()
|
||||
ImGui::Checkbox("Profile", &g_settings.drawProfile);
|
||||
|
||||
ImGui::End();
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
|
||||
void Step()
|
||||
@ -361,10 +364,10 @@ void Run()
|
||||
{
|
||||
int width, height;
|
||||
glfwGetWindowSize(g_window, &width, &height);
|
||||
g_camera.m_width = float32(width);
|
||||
g_camera.m_width = float32(width) - 250.0f;
|
||||
g_camera.m_height = float32(height);
|
||||
|
||||
glViewport(0, 0, width, height);
|
||||
glViewport(0, 0, width - 250, height);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
ImGui_ImplGlfwGL3_NewFrame();
|
||||
|
@ -387,6 +387,11 @@ void Test::Step()
|
||||
ImGui::SetNextWindowPos(ImVec2(0.0f, 0.0f));
|
||||
ImGui::Begin("Log", NULL, ImVec2(0, 0), 0.0f, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoScrollbar);
|
||||
|
||||
if (g_settings.pause)
|
||||
{
|
||||
ImGui::Text("*PAUSED*");
|
||||
}
|
||||
|
||||
if (g_settings.drawStats)
|
||||
{
|
||||
ImGui::Text("Bodies %d", m_world.GetBodyList().m_count);
|
||||
|
Reference in New Issue
Block a user