mirror of
https://github.com/3b1b/manim.git
synced 2025-09-19 04:41:56 +00:00
Store pixel_size instead of pixel_shape
This commit is contained in:
parent
b667d89e9b
commit
6c2544098b
4 changed files with 9 additions and 8 deletions
|
@ -497,10 +497,11 @@ class Camera(object):
|
|||
perspective_transform = frame.get_perspective_transform()
|
||||
light_pos = self.light_source.get_location()
|
||||
cam_pos = self.frame.get_implied_camera_location()
|
||||
frame_shape = frame.get_shape()
|
||||
|
||||
self.perspective_uniforms = {
|
||||
"frame_shape": frame.get_shape(),
|
||||
"pixel_shape": self.get_pixel_shape(),
|
||||
"frame_shape": frame_shape,
|
||||
"pixel_size": frame_shape[0] / self.get_pixel_shape()[0],
|
||||
"perspective": tuple(perspective_transform.T.flatten()),
|
||||
"camera_position": tuple(cam_pos),
|
||||
"light_position": tuple(light_pos),
|
||||
|
|
|
@ -4,7 +4,7 @@ layout (triangles) in;
|
|||
layout (triangle_strip, max_vertices = 5) out;
|
||||
|
||||
uniform float anti_alias_width;
|
||||
uniform vec2 pixel_shape;
|
||||
uniform float pixel_size;
|
||||
|
||||
in vec3 verts[3];
|
||||
in float v_orientation[3];
|
||||
|
@ -63,7 +63,7 @@ void emit_pentagon(
|
|||
is_linear = float(angle < ANGLE_THRESHOLD);
|
||||
|
||||
bool fill_inside = orientation > 0.0;
|
||||
float aaw = anti_alias_width * frame_shape.y / pixel_shape.y;
|
||||
float aaw = anti_alias_width * pixel_size;
|
||||
vec3 corners[5] = vec3[5](p0, p0, p1, p2, p2);
|
||||
|
||||
if(fill_inside || bool(is_linear)){
|
||||
|
|
|
@ -5,7 +5,7 @@ layout (triangle_strip, max_vertices = 6) out;
|
|||
|
||||
uniform float anti_alias_width;
|
||||
uniform float flat_stroke;
|
||||
uniform vec2 pixel_shape;
|
||||
uniform float pixel_size;
|
||||
uniform float joint_type;
|
||||
|
||||
in vec3 verts[3];
|
||||
|
@ -181,7 +181,7 @@ void main() {
|
|||
mat4 xyz_to_uv = get_xyz_to_uv(p0, p1, p2, is_linear, is_linear);
|
||||
|
||||
float uv_scale_factor = length(xyz_to_uv[0].xyz);
|
||||
float scaled_aaw = anti_alias_width * (frame_shape.y / pixel_shape.y);
|
||||
float scaled_aaw = anti_alias_width * pixel_size;
|
||||
uv_anti_alias_width = uv_scale_factor * scaled_aaw;
|
||||
|
||||
vec3 corners[6];
|
||||
|
|
|
@ -4,7 +4,7 @@ layout (points) in;
|
|||
layout (triangle_strip, max_vertices = 4) out;
|
||||
|
||||
uniform float anti_alias_width;
|
||||
uniform vec2 pixel_shape;
|
||||
uniform float pixel_size;
|
||||
uniform vec3 camera_position;
|
||||
|
||||
in vec3 v_point[1];
|
||||
|
@ -24,7 +24,7 @@ void main() {
|
|||
radius = v_radius[0];
|
||||
center = v_point[0].xy;
|
||||
|
||||
scaled_aaw = (frame_shape.y / pixel_shape.y);
|
||||
scaled_aaw = anti_alias_width * pixel_size;
|
||||
radius = v_radius[0] / max(1.0 - v_point[0].z / focal_distance / frame_shape.y, 0.0);
|
||||
float rpa = radius + scaled_aaw;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue