mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Redid SpecialThreeDScene low quality configuration
This commit is contained in:
parent
03d8bab065
commit
72d5bb2702
1 changed files with 37 additions and 46 deletions
|
@ -108,20 +108,6 @@ class ThreeDScene(Scene):
|
||||||
class SpecialThreeDScene(ThreeDScene):
|
class SpecialThreeDScene(ThreeDScene):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"cut_axes_at_radius": True,
|
"cut_axes_at_radius": True,
|
||||||
}
|
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
|
||||||
digest_config(self, kwargs)
|
|
||||||
if self.frame_duration == PRODUCTION_QUALITY_FRAME_DURATION:
|
|
||||||
high_quality = True
|
|
||||||
else:
|
|
||||||
high_quality = False
|
|
||||||
default_config = self.get_quality_dependent_config(high_quality)
|
|
||||||
config = merge_config([self.CONFIG, kwargs, default_config])
|
|
||||||
ThreeDScene.__init__(self, **config)
|
|
||||||
|
|
||||||
def get_quality_dependent_config(self, high_quality=True):
|
|
||||||
hq_config = {
|
|
||||||
"camera_config": {
|
"camera_config": {
|
||||||
"should_apply_shading": True,
|
"should_apply_shading": True,
|
||||||
"exponential_projection": True,
|
"exponential_projection": True,
|
||||||
|
@ -130,7 +116,6 @@ class SpecialThreeDScene(ThreeDScene):
|
||||||
"num_axis_pieces": 1,
|
"num_axis_pieces": 1,
|
||||||
"number_line_config": {
|
"number_line_config": {
|
||||||
"unit_size": 2,
|
"unit_size": 2,
|
||||||
# "tick_frequency": 0.5,
|
|
||||||
"tick_frequency": 1,
|
"tick_frequency": 1,
|
||||||
"numbers_with_elongated_ticks": [0, 1, 2],
|
"numbers_with_elongated_ticks": [0, 1, 2],
|
||||||
"stroke_width": 2,
|
"stroke_width": 2,
|
||||||
|
@ -139,9 +124,14 @@ class SpecialThreeDScene(ThreeDScene):
|
||||||
"sphere_config": {
|
"sphere_config": {
|
||||||
"radius": 2,
|
"radius": 2,
|
||||||
"resolution": (24, 48),
|
"resolution": (24, 48),
|
||||||
}
|
},
|
||||||
}
|
"default_angled_camera_position": {
|
||||||
lq_added_config = {
|
"phi": 70 * DEGREES,
|
||||||
|
"theta": -110 * DEGREES,
|
||||||
|
},
|
||||||
|
# When scene is extracted with -l flag, this
|
||||||
|
# configuration will override the above configuration.
|
||||||
|
"low_quality_config": {
|
||||||
"camera_config": {
|
"camera_config": {
|
||||||
"should_apply_shading": False,
|
"should_apply_shading": False,
|
||||||
},
|
},
|
||||||
|
@ -152,13 +142,15 @@ class SpecialThreeDScene(ThreeDScene):
|
||||||
"resolution": (12, 24),
|
"resolution": (12, 24),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if high_quality:
|
}
|
||||||
return hq_config
|
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
digest_config(self, kwargs)
|
||||||
|
if self.frame_duration == PRODUCTION_QUALITY_FRAME_DURATION:
|
||||||
|
config = {}
|
||||||
else:
|
else:
|
||||||
return merge_config([
|
config = self.low_quality_config
|
||||||
lq_added_config,
|
ThreeDScene.__init__(self, **merge_config([kwargs, config]))
|
||||||
hq_config
|
|
||||||
])
|
|
||||||
|
|
||||||
def get_axes(self):
|
def get_axes(self):
|
||||||
axes = ThreeDAxes(**self.three_d_axes_config)
|
axes = ThreeDAxes(**self.three_d_axes_config)
|
||||||
|
@ -181,16 +173,15 @@ class SpecialThreeDScene(ThreeDScene):
|
||||||
))
|
))
|
||||||
return axes
|
return axes
|
||||||
|
|
||||||
def get_sphere(self):
|
def get_sphere(self, **kwargs):
|
||||||
return Sphere(**self.sphere_config)
|
config = dict(self.sphere_config)
|
||||||
|
config.update(kwargs)
|
||||||
|
return Sphere(**config)
|
||||||
|
|
||||||
def get_default_camera_position(self):
|
def get_default_camera_position(self):
|
||||||
return {
|
return self.default_angled_camera_position
|
||||||
"phi": 70 * DEGREES,
|
|
||||||
"theta": -110 * DEGREES,
|
|
||||||
}
|
|
||||||
|
|
||||||
def set_camera_to_default_position(self):
|
def set_camera_to_default_position(self):
|
||||||
self.set_camera_orientation(
|
self.set_camera_orientation(
|
||||||
**self.get_default_camera_position()
|
**self.default_angled_camera_position
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue