Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from 3b1b:master #26

Merged
merged 38 commits into from
Jan 27, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
3339aad
Separate CameraFrame into its own file
3b1b Jan 25, 2023
8c1e5f3
Change use_clip_plane to be a function
3b1b Jan 25, 2023
80729c0
Only initialize ShaderWrappers as needed
3b1b Jan 25, 2023
16d773f
Remove refresh_shader_data
3b1b Jan 25, 2023
1004777
Have ShaderWrapper track OpenGL context
3b1b Jan 25, 2023
3299741
Move program code to ShaderWrapper, away from Camera
3b1b Jan 25, 2023
c94d8fd
Move Texture handling and vao creation outside of Camera
3b1b Jan 25, 2023
2c737ed
Move most of rendering logic to ShaderWrapper
3b1b Jan 25, 2023
424707d
Move rendering more fully away from Camera to Mobject and ShaderWrapper
3b1b Jan 25, 2023
4dfabc1
Make sure FillShaderWrapper works without a window
3b1b Jan 25, 2023
d2af6a5
Keep track of when Mobject data has changed, and used that to determi…
3b1b Jan 26, 2023
018b072
Change how joint_products are updated in pointwise_become_partial
3b1b Jan 26, 2023
7609b1d
Set up by-hand anti-aliasing for FillShaderWrapper
3b1b Jan 26, 2023
2beb557
Change naming logic for recorded inserts
3b1b Jan 26, 2023
3c8e379
Remove references to refresh_static_mobjects
3b1b Jan 26, 2023
f96a697
Use become for interpolating at 0 or 1
3b1b Jan 26, 2023
a601384
Remove stray imports
3b1b Jan 26, 2023
88590e5
Remove serializing deepcopy
3b1b Jan 26, 2023
cb36fda
In interpolate, only update data status if some keys are unlocked
3b1b Jan 26, 2023
a68bc12
Have FillShaders all share the same texture used for intermediary ren…
3b1b Jan 26, 2023
a1595a9
Use separate fbo for writing to file when window is active
3b1b Jan 26, 2023
72590a8
Note that using winding fill changes data
3b1b Jan 26, 2023
05dd399
Ensure svgs have positive orientation by default
3b1b Jan 26, 2023
f5cb2bf
Check for mismatched keys in uniform interpolation
3b1b Jan 26, 2023
c6c23a1
Unnecessary refresh_bounding_box
3b1b Jan 26, 2023
a33b243
Fix non-winding-fill orientation
3b1b Jan 26, 2023
3f5df43
Consider winding_fill alphas pre-multiplied
3b1b Jan 26, 2023
37f0bf8
Fix winding fill blending
3b1b Jan 26, 2023
14cda7e
Don't show progress bar in embed by default
3b1b Jan 26, 2023
65afed1
Move shading from fill geom to fill frag shader
3b1b Jan 26, 2023
a8da171
Make sure a group inherits the fixed_in_frame status of its parts
3b1b Jan 26, 2023
8ef71bb
Don't use 'become' for interpolate at alpha = 0 or 1
3b1b Jan 27, 2023
164c9ba
Use copy in set_data
3b1b Jan 27, 2023
28c875c
Finish Transforms with a call to Mobject.become
3b1b Jan 27, 2023
6d47825
Account for null fill cases in invinisble_copy
3b1b Jan 27, 2023
9696827
Allow for adding null subpath
3b1b Jan 27, 2023
acdc265
Account for 'target_mobject is None' case
3b1b Jan 27, 2023
adfef48
Merge pull request #1973 from 3b1b/video-work
3b1b Jan 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change use_clip_plane to be a function
  • Loading branch information
3b1b committed Jan 25, 2023
commit 8c1e5f3b42dd187583737939e74402375fc7850a
2 changes: 1 addition & 1 deletion manimlib/camera/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def render(self, render_group: dict[str, Any]) -> None:
primitive = int(shader_wrapper.render_primitive)
self.set_shader_uniforms(shader_program, shader_wrapper)
self.set_ctx_depth_test(shader_wrapper.depth_test)
self.set_ctx_clip_plane(shader_wrapper.use_clip_plane)
self.set_ctx_clip_plane(shader_wrapper.use_clip_plane())

if shader_wrapper.is_fill:
self.render_fill(render_group["vao"], primitive, shader_wrapper.vert_indices)
Expand Down
2 changes: 0 additions & 2 deletions manimlib/mobject/types/surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,10 @@ def set_clip_plane(
self.uniforms["clip_plane"][:3] = vect
if threshold is not None:
self.uniforms["clip_plane"][3] = threshold
self.shader_wrapper.use_clip_plane = True
return self

def deactivate_clip_plane(self):
self.uniforms["clip_plane"][:] = 0
self.shader_wrapper.use_clip_plane = False
return self

def get_shader_vert_indices(self) -> np.ndarray:
Expand Down
7 changes: 5 additions & 2 deletions manimlib/shader_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def __init__(
uniforms: dict[str, float | np.ndarray] | None = None, # A dictionary mapping names of uniform variables
texture_paths: dict[str, str] | None = None, # A dictionary mapping names to filepaths for textures.
depth_test: bool = False,
use_clip_plane: bool = False,
render_primitive: int = moderngl.TRIANGLE_STRIP,
is_fill: bool = False,
):
Expand All @@ -43,7 +42,6 @@ def __init__(
self.uniforms = uniforms or dict()
self.texture_paths = texture_paths or dict()
self.depth_test = depth_test
self.use_clip_plane = use_clip_plane
self.render_primitive = str(render_primitive)
self.is_fill = is_fill
self.init_program_code()
Expand Down Expand Up @@ -132,6 +130,11 @@ def replace_code(self, old: str, new: str) -> None:
code_map[name] = re.sub(old, new, code_map[name])
self.refresh_id()

def use_clip_plane(self):
if "clip_plane" not in self.uniforms:
return False
return any(self.uniforms["clip_plane"])

def combine_with(self, *shader_wrappers: ShaderWrapper) -> ShaderWrapper:
if len(shader_wrappers) > 0:
data_list = [self.vert_data, *(sw.vert_data for sw in shader_wrappers)]
Expand Down