Merge pull request #2061 from floatwoozy/dev

Error effect when rendering the same ImageMobject
This commit is contained in:
Grant Sanderson 2024-09-06 09:35:31 -07:00 committed by GitHub
commit 9011c864fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2,6 +2,7 @@ from __future__ import annotations
import numpy as np
from PIL import Image
from moderngl import TRIANGLES
from manimlib.constants import DL, DR, UL, UR
from manimlib.mobject.mobject import Mobject
@ -24,6 +25,7 @@ class ImageMobject(Mobject):
('im_coords', np.float32, (2,)),
('opacity', np.float32, (1,)),
]
render_primitive: int = TRIANGLES
def __init__(
self,
@ -37,9 +39,9 @@ class ImageMobject(Mobject):
super().__init__(texture_paths={"Texture": self.image_path}, **kwargs)
def init_data(self) -> None:
super().init_data(length=4)
self.data["point"][:] = [UL, DL, UR, DR]
self.data["im_coords"][:] = [(0, 0), (0, 1), (1, 0), (1, 1)]
super().init_data(length=6)
self.data["point"][:] = [UL, DL, UR, DR, UR, DL]
self.data["im_coords"][:] = [(0, 0), (0, 1), (1, 0), (1, 1), (1, 0), (0, 1)]
self.data["opacity"][:] = self.opacity
def init_points(self) -> None: