mirror of
https://github.com/johndoe6345789/SDL3CPlusPlus.git
synced 2026-04-27 15:14:58 +00:00
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:
@@ -72,7 +72,34 @@ std::unordered_map<std::string, ShaderPaths> ShaderScriptService::LoadShaderPath
|
||||
|
||||
if (configService_) {
|
||||
const auto& materialConfig = configService_->GetMaterialXConfig();
|
||||
if (materialConfig.enabled) {
|
||||
const auto& materialOverrides = configService_->GetMaterialXMaterialConfigs();
|
||||
if (!materialOverrides.empty()) {
|
||||
for (const auto& overrideConfig : materialOverrides) {
|
||||
if (!overrideConfig.enabled) {
|
||||
continue;
|
||||
}
|
||||
MaterialXConfig resolvedConfig = materialConfig;
|
||||
resolvedConfig.enabled = true;
|
||||
resolvedConfig.documentPath = overrideConfig.documentPath;
|
||||
resolvedConfig.shaderKey = overrideConfig.shaderKey;
|
||||
resolvedConfig.materialName = overrideConfig.materialName;
|
||||
resolvedConfig.useConstantColor = overrideConfig.useConstantColor;
|
||||
resolvedConfig.constantColor = overrideConfig.constantColor;
|
||||
try {
|
||||
ShaderPaths materialShader = materialxGenerator_.Generate(
|
||||
resolvedConfig,
|
||||
engineService_ ? engineService_->GetScriptDirectory() : std::filesystem::path{});
|
||||
if (!resolvedConfig.shaderKey.empty()) {
|
||||
shaderMap[resolvedConfig.shaderKey] = std::move(materialShader);
|
||||
}
|
||||
} catch (const std::exception& ex) {
|
||||
if (logger_) {
|
||||
logger_->Error("MaterialX shader generation failed for key=" +
|
||||
overrideConfig.shaderKey + ": " + std::string(ex.what()));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (materialConfig.enabled) {
|
||||
try {
|
||||
ShaderPaths materialShader = materialxGenerator_.Generate(
|
||||
materialConfig,
|
||||
|
||||
Reference in New Issue
Block a user