1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-23 15:16:17 +00:00

Fix 2d software skinning relative transforms

All my earlier test cases for software skinning had the polys parent transform to be identity. This works fine until you had cases where the user had moved the transform of the parent nodes of skinned polys.

This PR fixes this situation by taking into account the final (concatenated) transform of the polys RELATIVE to the skeleton base transform. It does this by applying the inverse skeleton base transform to the poly final transform.
This commit is contained in:
lawnjelly
2021-05-03 12:18:56 +01:00
parent c37464bd12
commit f33e22001f
3 changed files with 33 additions and 12 deletions

View File

@@ -1487,7 +1487,7 @@ void RasterizerCanvasGLES3::render_joined_item(const BItemJoined &p_bij, RenderI
}
if (unshaded || (state.canvas_item_modulate.a > 0.001 && (!r_ris.shader_cache || r_ris.shader_cache->canvas_item.light_mode != RasterizerStorageGLES3::Shader::CanvasItem::LIGHT_MODE_LIGHT_ONLY) && !p_ci->light_masked)) {
RasterizerStorageGLES3::Material *material_ptr = nullptr;
render_joined_item_commands(p_bij, NULL, reclip, material_ptr, false);
render_joined_item_commands(p_bij, NULL, reclip, material_ptr, false, r_ris);
}
if ((blend_mode == RasterizerStorageGLES3::Shader::CanvasItem::BLEND_MODE_MIX || blend_mode == RasterizerStorageGLES3::Shader::CanvasItem::BLEND_MODE_PMALPHA) && r_ris.item_group_light && !unshaded) {
@@ -1602,10 +1602,10 @@ void RasterizerCanvasGLES3::render_joined_item(const BItemJoined &p_bij, RenderI
// this can greatly reduce fill rate ..
// at the cost of glScissor commands, so is optional
if (!bdata.settings_scissor_lights || r_ris.current_clip) {
render_joined_item_commands(p_bij, NULL, reclip, nullptr, true);
render_joined_item_commands(p_bij, NULL, reclip, nullptr, true, r_ris);
} else {
bool scissor = _light_scissor_begin(p_bij.bounding_rect, light->xform_cache, light->rect_cache);
render_joined_item_commands(p_bij, NULL, reclip, nullptr, true);
render_joined_item_commands(p_bij, NULL, reclip, nullptr, true, r_ris);
if (scissor) {
glDisable(GL_SCISSOR_TEST);
}