feat(physics): Enhance physics bridge service with new functionalities

- Added SetGravity method to adjust the gravity in the physics world.
- Introduced AddSphereRigidBody method for creating sphere rigid bodies.
- Implemented RemoveRigidBody method to delete existing rigid bodies.
- Added SetRigidBodyTransform method to update the position and rotation of rigid bodies.
- Included ApplyForce and ApplyImpulse methods for applying forces and impulses to rigid bodies.
- Added SetLinearVelocity method to set the linear velocity of rigid bodies.
- Enhanced StepSimulation method to accept a maxSubSteps parameter.
- Implemented GetBodyCount method to retrieve the number of rigid bodies in the world.
- Added Clear method to remove all rigid bodies from the physics world.
- Updated the script engine service to bind new physics methods to Lua.
- Enhanced material configuration handling in shader script service.
- Introduced MaterialXMaterialConfig structure for better material management.
- Added texture binding support in ShaderPaths structure.
- Included stb_image implementation for image loading support.
This commit is contained in:
2026-01-07 00:20:19 +00:00
parent ffeba6c142
commit cb5b58ca9e
42 changed files with 3168 additions and 226 deletions

View File

@@ -136,6 +136,24 @@ std::vector<GuiCommand> GuiScriptService::LoadGuiCommands() {
} else if (std::strcmp(typeName, "text") == 0) {
command.type = GuiCommand::Type::Text;
ReadStringField(L, commandIndex, "text", command.text);
bool hasX = false;
bool hasY = false;
lua_getfield(L, commandIndex, "x");
if (lua_isnumber(L, -1)) {
command.rect.x = static_cast<float>(lua_tonumber(L, -1));
hasX = true;
}
lua_pop(L, 1);
lua_getfield(L, commandIndex, "y");
if (lua_isnumber(L, -1)) {
command.rect.y = static_cast<float>(lua_tonumber(L, -1));
hasY = true;
}
lua_pop(L, 1);
if (logger_ && (!hasX || !hasY)) {
logger_->Trace("GuiScriptService", "LoadGuiCommands",
"Text command missing x/y; defaulting to 0");
}
lua_getfield(L, commandIndex, "fontSize");
if (lua_isnumber(L, -1)) {
command.fontSize = static_cast<float>(lua_tonumber(L, -1));
@@ -163,7 +181,17 @@ std::vector<GuiCommand> GuiScriptService::LoadGuiCommands() {
command.color = ReadColorField(L, commandIndex, "color", GuiColor{1.0f, 1.0f, 1.0f, 1.0f});
} else if (std::strcmp(typeName, "clip_push") == 0) {
command.type = GuiCommand::Type::ClipPush;
command.rect = ReadRect(L, commandIndex);
lua_getfield(L, commandIndex, "rect");
if (lua_istable(L, -1)) {
command.rect = ReadRect(L, -1);
} else {
command.rect = ReadRect(L, commandIndex);
if (logger_) {
logger_->Trace("GuiScriptService", "LoadGuiCommands",
"clipPushFallback=true");
}
}
lua_pop(L, 1);
} else if (std::strcmp(typeName, "clip_pop") == 0) {
command.type = GuiCommand::Type::ClipPop;
} else if (std::strcmp(typeName, "svg") == 0) {