Adding basic impl of Jolt
Update positions on 60tps, position of objects can be modified while physic simulation is running. Position is owned by transform comps but the truth is held by the physics engine for affected entities
This commit is contained in:
@@ -95,6 +95,7 @@ namespace OpenEngine {
|
||||
if (ImGui::InputText("##tagEditor", buffer, sizeof(buffer), ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_AutoSelectAll)
|
||||
|| (!ImGui::IsItemActive() && ImGui::IsMouseClicked(0)))
|
||||
tag = buffer;
|
||||
ImGui::Spacing();
|
||||
};
|
||||
|
||||
void TransformOnImGuiRender(entt::registry& registry, entt::entity entity)
|
||||
@@ -221,16 +222,27 @@ namespace OpenEngine {
|
||||
{
|
||||
auto& material = registry.get<MaterialComponent>(entity).material;
|
||||
|
||||
auto& albedo = material.albedo;
|
||||
auto& roughness = material.roughness;
|
||||
auto& metallic = material.metallic;
|
||||
auto& ambient = material.ambient_strength;
|
||||
auto& specular = material.specular_strength;
|
||||
ImGui::SliderFloat4("Albedo", glm::value_ptr(material.albedo), 0, 1);
|
||||
ImGui::SliderFloat("Roughness", &material.roughness, 0, 1);
|
||||
ImGui::SliderFloat("Metallic", &material.metallic, 0, 1);
|
||||
ImGui::SliderFloat("Ambient strength", &material.ambient_strength, 0, 1);
|
||||
ImGui::SliderFloat("Specular strength", &material.specular_strength, 0, 10);
|
||||
}
|
||||
|
||||
ImGui::SliderFloat4("Albedo", glm::value_ptr(albedo), 0, 1);
|
||||
ImGui::SliderFloat("Roughness", &roughness, 0, 1);
|
||||
ImGui::SliderFloat("Metallic", &metallic, 0, 1);
|
||||
ImGui::SliderFloat("Ambient strength", &ambient, 0, 1);
|
||||
ImGui::SliderFloat("Specular strength", &specular, 0, 10);
|
||||
void BodyOnImGuiRender(entt::registry ®istry, entt::entity entity)
|
||||
{
|
||||
auto& body_comp = registry.get<PhysicsBodyComponent>(entity);
|
||||
|
||||
ImGui::SliderFloat("Linear damping", &body_comp.linear_damping, 0, 1);
|
||||
ImGui::SliderFloat("Angular damping", &body_comp.angular_damping, 0, 1);
|
||||
ImGui::SliderFloat("Gravity factor", &body_comp.gravity_factor, 0, 1);
|
||||
}
|
||||
|
||||
void ShapeOnImGuiRender(entt::registry ®istry, entt::entity entity)
|
||||
{
|
||||
auto& shape_comp = registry.get<PhysicsShapeComponent>(entity);
|
||||
|
||||
ImGui::SliderFloat("Bounciness", &shape_comp.restitution, 0, 1);
|
||||
ImGui::SliderFloat("Friction", &shape_comp.friction, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user