From 5a499a0f2c74bd7b89b80215216212f56966355e Mon Sep 17 00:00:00 2001 From: Jennifer Taylor Date: Sat, 17 Apr 2021 23:33:04 +0000 Subject: [PATCH] Fix rotation origin so some bishi bashi levels will render. --- bemani/format/afp/render.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bemani/format/afp/render.py b/bemani/format/afp/render.py index b552ea4..0302f29 100644 --- a/bemani/format/afp/render.py +++ b/bemani/format/afp/render.py @@ -258,9 +258,8 @@ class AFPRenderer(VerboseOutput): self.vprint(" Nothing to render!") return - # Look up the affine transformation matrix and rotation/origin. + # Look up the affine transformation matrix for this object. transform = parent_transform.multiply(tag.transform or Matrix.identity()) - origin = parent_origin.add(tag.rotation_offset or Point.identity()) # Calculate the inverse so we can map canvas space back to texture space. inverse = transform.inverse() @@ -272,7 +271,7 @@ class AFPRenderer(VerboseOutput): for obj in self.__placed_objects: if obj.parent_clip == tag.source_tag_id: self.vprint(f" Rendering placed object ID {obj.object_id} from sprite {obj.parent_clip} onto Depth {obj.depth}") - self.__render_object(img, obj.tag, transform, origin) + self.__render_object(img, obj.tag, transform, parent_origin.add(tag.rotation_offset or Point.identity())) found_one = True if not found_one: @@ -308,6 +307,9 @@ class AFPRenderer(VerboseOutput): texture = self.textures[params.region] if texture is not None: + # If the origin is not specified, assume it is the center of the texture. + origin = parent_origin.add(tag.rotation_offset or Point(texture.width / 2, texture.height / 2)) + # See if we can cheat and use the faster blitting method. if ( add_color == (0, 0, 0, 0) and