mirror of
https://github.com/3b1b/manim.git
synced 2025-04-13 09:47:07 +00:00
Merge pull request #2061 from floatwoozy/dev
Error effect when rendering the same ImageMobject
This commit is contained in:
commit
9011c864fd
1 changed files with 5 additions and 3 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Reference in a new issue