mirror of
https://github.com/3b1b/manim.git
synced 2025-07-30 13:34:19 +08:00
Change ImageMobject rendering mode to TRIANGLES
And add vertices
This commit is contained in:
@ -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:
|
||||
|
Reference in New Issue
Block a user