mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Ambient light now also stable under camera rotations
This commit is contained in:
parent
75fd78cefc
commit
f178a6981c
1 changed files with 17 additions and 0 deletions
|
@ -190,6 +190,7 @@ class LightSource(VMobject):
|
||||||
R = np.array([[0,-1,0],[1,0,0],[0,0,1]])
|
R = np.array([[0,-1,0],[1,0,0],[0,0,1]])
|
||||||
self.rotation_matrix = np.dot(M,R)
|
self.rotation_matrix = np.dot(M,R)
|
||||||
|
|
||||||
|
self.update_ambient_light()
|
||||||
self.spotlight.update_sectors()
|
self.spotlight.update_sectors()
|
||||||
self.update_shadow()
|
self.update_shadow()
|
||||||
self.update_lighthouse()
|
self.update_lighthouse()
|
||||||
|
@ -276,6 +277,22 @@ class LightSource(VMobject):
|
||||||
self.lighthouse.submobjects = new_lh.submobjects
|
self.lighthouse.submobjects = new_lh.submobjects
|
||||||
|
|
||||||
|
|
||||||
|
def update_ambient_light(self):
|
||||||
|
|
||||||
|
new_ambient_light = AmbientLight(
|
||||||
|
source_point = VectorizedPoint(location = ORIGIN),
|
||||||
|
color = self.color,
|
||||||
|
num_levels = self.num_levels,
|
||||||
|
radius = self.radius,
|
||||||
|
opacity_function = self.opacity_function,
|
||||||
|
max_opacity = self.max_opacity_ambient
|
||||||
|
)
|
||||||
|
new_ambient_light.apply_matrix(self.rotation_matrix)
|
||||||
|
new_ambient_light.move_source_to(self.get_source_point())
|
||||||
|
self.ambient_light.submobjects = new_ambient_light.submobjects
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class SwitchOn(LaggedStart):
|
class SwitchOn(LaggedStart):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"lag_ratio": 0.2,
|
"lag_ratio": 0.2,
|
||||||
|
|
Loading…
Add table
Reference in a new issue