@@ -38,6 +38,10 @@ class OpenGLMobject:
38
38
"""
39
39
Mathematical Object
40
40
"""
41
+ shader_dtype = [
42
+ ("point" , np .float32 , (3 ,)),
43
+ ]
44
+ shader_folder = ""
41
45
42
46
def __init__ (
43
47
self ,
@@ -50,16 +54,12 @@ def __init__(
50
54
# Positive shadow up to 1 makes a side opposite the light darker
51
55
shadow = 0.0 ,
52
56
# For shaders
53
- shader_folder = "" ,
54
57
render_primitive = moderngl .TRIANGLE_STRIP ,
55
58
texture_paths = None ,
56
59
depth_test = False ,
57
60
# If true, the mobject will not get rotated according to camera position
58
61
is_fixed_in_frame = False ,
59
62
# Must match in attributes of vert shader
60
- shader_dtype = [
61
- ("point" , np .float32 , (3 ,)),
62
- ],
63
63
# Event listener
64
64
listen_to_events = False ,
65
65
** kwargs
@@ -74,14 +74,12 @@ def __init__(
74
74
# Positive shadow up to 1 makes a side opposite the light darker
75
75
self .shadow = shadow
76
76
# For shaders
77
- self .shader_folder = shader_folder
78
77
self .render_primitive = render_primitive
79
78
self .texture_paths = texture_paths
80
79
self .depth_test = depth_test
81
80
# If true, the mobject will not get rotated according to camera position
82
81
self .is_fixed_in_frame = is_fixed_in_frame
83
82
# Must match in attributes of vert shader
84
- self .shader_dtype = shader_dtype
85
83
# Event listener
86
84
self .listen_to_events = listen_to_events
87
85
@@ -817,7 +815,7 @@ def space_out_submobjects(self, factor=1.5, **kwargs):
817
815
def move_to (
818
816
self , point_or_mobject , aligned_edge = ORIGIN , coor_mask = np .array ([1 , 1 , 1 ])
819
817
):
820
- if isinstance (point_or_mobject , Mobject ):
818
+ if isinstance (point_or_mobject , OpenGLMobject ):
821
819
target = point_or_mobject .get_bounding_box_point (aligned_edge )
822
820
else :
823
821
target = point_or_mobject
@@ -1384,11 +1382,11 @@ def set_color_by_xyz_func(
1384
1382
1385
1383
def init_shader_data (self ):
1386
1384
# TODO, only call this when needed?
1387
- self .shader_data = np .zeros (len (self .get_points ()), dtype = self .shader_dtype )
1385
+ self .shader_data = np .zeros (len (self .get_points ()), dtype = self .__class__ . shader_dtype )
1388
1386
self .shader_indices = None
1389
1387
self .shader_wrapper = ShaderWrapper (
1390
1388
vert_data = self .shader_data ,
1391
- shader_folder = self .shader_folder ,
1389
+ shader_folder = self .__class__ . shader_folder ,
1392
1390
texture_paths = self .texture_paths ,
1393
1391
depth_test = self .depth_test ,
1394
1392
render_primitive = self .render_primitive ,
@@ -1404,8 +1402,9 @@ def get_shader_wrapper(self):
1404
1402
vert_indices = self .get_shader_vert_indices (),
1405
1403
uniforms = self .get_shader_uniforms (),
1406
1404
depth_test = self .depth_test ,
1405
+ texture_paths = self .texture_paths ,
1407
1406
render_primitive = self .render_primitive ,
1408
- shader_folder = self .shader_folder ,
1407
+ shader_folder = self .__class__ . shader_folder ,
1409
1408
)
1410
1409
return self .shader_wrapper
1411
1410
0 commit comments