Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2021-01-21 16:21:49 +0300
committerBrecht Van Lommel <brecht@blender.org>2021-01-21 16:21:49 +0300
commit84702bd3d8aecb0ff546c5f0805651c2426644e7 (patch)
tree75f2fbe7e5b2c42c35e381a1cce0901ab458de0b /source/blender/freestyle
parentaff7d5998653d6d7ba682b29187e70998b4ee4e3 (diff)
Fix T84242: freestyle animated camera shift lags behind in animation render
Diffstat (limited to 'source/blender/freestyle')
-rw-r--r--source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp30
1 files changed, 10 insertions, 20 deletions
diff --git a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
index 65fa193f92f..f45ff77cf41 100644
--- a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
+++ b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
@@ -178,24 +178,6 @@ static void init_view(Render *re)
}
}
-static void init_camera(Render *re)
-{
- // It is assumed that imported meshes are in the camera coordinate system.
- // Therefore, the view point (i.e., camera position) is at the origin, and
- // the model-view matrix is simply the identity matrix.
-
- zero_v3(g_freestyle.viewpoint);
-
- unit_m4(g_freestyle.mv);
-
- copy_m4_m4(g_freestyle.proj, re->winmat);
-
-#if 0
- print_m4("mv", g_freestyle.mv);
- print_m4("proj", g_freestyle.proj);
-#endif
-}
-
static char *escape_quotes(char *name)
{
char *s = (char *)MEM_mallocN(strlen(name) * 2 + 1, "escape_quotes");
@@ -632,9 +614,8 @@ void FRS_init_stroke_renderer(Render *re)
controller->ResetRenderCount();
}
-void FRS_begin_stroke_rendering(Render *re)
+void FRS_begin_stroke_rendering(Render *UNUSED(re))
{
- init_camera(re);
}
void FRS_do_stroke_rendering(Render *re, ViewLayer *view_layer)
@@ -657,6 +638,15 @@ void FRS_do_stroke_rendering(Render *re, ViewLayer *view_layer)
Depsgraph *depsgraph = DEG_graph_new(re->main, re->scene, scene_view_layer, DAG_EVAL_RENDER);
BKE_scene_graph_update_for_newframe(depsgraph);
+ /* Init camera
+ * Objects are transformed into camera coordinate system, therefore the camera position
+ * is zero and the modelview matrix is the identity matrix. */
+ Object *ob_camera_orig = RE_GetCamera(re);
+ Object *ob_camera_eval = DEG_get_evaluated_object(depsgraph, ob_camera_orig);
+ zero_v3(g_freestyle.viewpoint);
+ unit_m4(g_freestyle.mv);
+ RE_GetCameraWindow(re, ob_camera_eval, g_freestyle.proj);
+
// prepare Freestyle:
// - load mesh
// - add style modules