change render switches
This commit is contained in:
parent
8bcca04ecc
commit
dc5e2ff28c
5 changed files with 54 additions and 51 deletions
|
@ -79,6 +79,7 @@ class AnimationRenderer:
|
||||||
|
|
||||||
display = pyglet.canvas.get_display()
|
display = pyglet.canvas.get_display()
|
||||||
screen = display.get_screens()[0]
|
screen = display.get_screens()[0]
|
||||||
|
print(display.get_screens())
|
||||||
|
|
||||||
if self.streaming_process is not None:
|
if self.streaming_process is not None:
|
||||||
self.window = pyglet.window.Window(width=self.frame_size[0], height=self.frame_size[1], config=config, fullscreen=False, screen=screen)
|
self.window = pyglet.window.Window(width=self.frame_size[0], height=self.frame_size[1], config=config, fullscreen=False, screen=screen)
|
||||||
|
|
|
@ -336,8 +336,8 @@ render_parser.add_argument("--render-file",
|
||||||
render_parser.add_argument("--render-window",
|
render_parser.add_argument("--render-window",
|
||||||
help="Render a previewing to a window",
|
help="Render a previewing to a window",
|
||||||
action='store_true')
|
action='store_true')
|
||||||
render_parser.add_argument("--render-no-preview",
|
render_parser.add_argument("--render-animation",
|
||||||
help="No preview, but only animation",
|
help="Render animation (pyglet)",
|
||||||
action='store_true')
|
action='store_true')
|
||||||
render_parser.add_argument("--render-debug-shapes",
|
render_parser.add_argument("--render-debug-shapes",
|
||||||
help="Lines and points for debugging/mapping",
|
help="Lines and points for debugging/mapping",
|
||||||
|
|
|
@ -442,7 +442,7 @@ colorset = [
|
||||||
# ]
|
# ]
|
||||||
|
|
||||||
def get_opacity(track: Track, current_frame: Frame):
|
def get_opacity(track: Track, current_frame: Frame):
|
||||||
fade_duration = current_frame.camera.fps * 3
|
fade_duration = current_frame.camera.fps * 1.5
|
||||||
diff = current_frame.index - track.history[-1].frame_nr
|
diff = current_frame.index - track.history[-1].frame_nr
|
||||||
return max(0, 1 - diff / fade_duration)
|
return max(0, 1 - diff / fade_duration)
|
||||||
# track.history[-1].frame_nr < (current_frame.index - current_frame.camera.fps * 3)
|
# track.history[-1].frame_nr < (current_frame.index - current_frame.camera.fps * 3)
|
||||||
|
|
|
@ -92,13 +92,13 @@ def start():
|
||||||
ExceptionHandlingProcess(target=run_tracker, kwargs={'config': args, 'is_running': isRunning}, name='tracker'),
|
ExceptionHandlingProcess(target=run_tracker, kwargs={'config': args, 'is_running': isRunning}, name='tracker'),
|
||||||
]
|
]
|
||||||
|
|
||||||
if args.render_file or args.render_url or args.render_window:
|
# if args.render_file or args.render_url or args.render_window:
|
||||||
if not args.render_no_preview: #or args.render_file or args.render_url:
|
if args.render_window or args.render_file or args.render_url:
|
||||||
procs.append(
|
procs.append(
|
||||||
# ExceptionHandlingProcess(target=run_cv_renderer, kwargs={'config': args, 'is_running': isRunning}, name='preview')
|
# ExceptionHandlingProcess(target=run_cv_renderer, kwargs={'config': args, 'is_running': isRunning}, name='preview')
|
||||||
ExceptionHandlingProcess(target=run_cv_renderer, kwargs={'config': args, 'is_running': isRunning}, name='preview')
|
ExceptionHandlingProcess(target=run_cv_renderer, kwargs={'config': args, 'is_running': isRunning}, name='preview')
|
||||||
)
|
)
|
||||||
if args.render_no_preview:
|
if args.render_animation:
|
||||||
procs.append(
|
procs.append(
|
||||||
ExceptionHandlingProcess(target=run_animation_renderer, kwargs={'config': args, 'is_running': isRunning}, name='renderer')
|
ExceptionHandlingProcess(target=run_animation_renderer, kwargs={'config': args, 'is_running': isRunning}, name='renderer')
|
||||||
)
|
)
|
||||||
|
|
|
@ -185,6 +185,7 @@ class DrawnTrack:
|
||||||
self.shapes = self.shapes[:len(drawn_positions)]
|
self.shapes = self.shapes[:len(drawn_positions)]
|
||||||
|
|
||||||
# for i, pos in drawn_positions.enumerate():
|
# for i, pos in drawn_positions.enumerate():
|
||||||
|
if True:
|
||||||
for ci in range(1, len(drawn_positions)):
|
for ci in range(1, len(drawn_positions)):
|
||||||
x, y = [int(p) for p in drawn_positions[ci-1]]
|
x, y = [int(p) for p in drawn_positions[ci-1]]
|
||||||
x2, y2 = [int(p) for p in drawn_positions[ci]]
|
x2, y2 = [int(p) for p in drawn_positions[ci]]
|
||||||
|
@ -195,7 +196,7 @@ class DrawnTrack:
|
||||||
|
|
||||||
if ci >= len(self.shapes):
|
if ci >= len(self.shapes):
|
||||||
# TODO: add color2
|
# TODO: add color2
|
||||||
line = self.renderer.gradientLine(x, y, x2, y2, 3, color, color, batch=self.renderer.batch_anim)
|
# line = self.renderer.gradientLine(x, y, x2, y2, 3, color, color, batch=self.renderer.batch_anim)
|
||||||
line = pyglet.shapes.Arc(x2, y2, 10, thickness=2, color=color, batch=self.renderer.batch_anim)
|
line = pyglet.shapes.Arc(x2, y2, 10, thickness=2, color=color, batch=self.renderer.batch_anim)
|
||||||
line.opacity = 20
|
line.opacity = 20
|
||||||
self.shapes.append(line)
|
self.shapes.append(line)
|
||||||
|
@ -203,7 +204,7 @@ class DrawnTrack:
|
||||||
else:
|
else:
|
||||||
line = self.shapes[ci-1]
|
line = self.shapes[ci-1]
|
||||||
line.x, line.y = x, y
|
line.x, line.y = x, y
|
||||||
line.x2, line.y2 = x2, y2
|
# line.x2, line.y2 = x2, y2
|
||||||
line.radius = int(exponentialDecay(line.radius, 1.5, 3, dt))
|
line.radius = int(exponentialDecay(line.radius, 1.5, 3, dt))
|
||||||
line.color = color
|
line.color = color
|
||||||
line.opacity = int(exponentialDecay(line.opacity, 180, 8, dt))
|
line.opacity = int(exponentialDecay(line.opacity, 180, 8, dt))
|
||||||
|
@ -216,6 +217,7 @@ class DrawnTrack:
|
||||||
self.pred_history_shapes = self.pred_history_shapes[:len(drawn_pred_history)]
|
self.pred_history_shapes = self.pred_history_shapes[:len(drawn_pred_history)]
|
||||||
|
|
||||||
# for i, pos in drawn_pred_history.enumerate():
|
# for i, pos in drawn_pred_history.enumerate():
|
||||||
|
if False:
|
||||||
for ci in range(1, len(drawn_pred_history)):
|
for ci in range(1, len(drawn_pred_history)):
|
||||||
x, y = [int(p) for p in drawn_pred_history[ci-1]]
|
x, y = [int(p) for p in drawn_pred_history[ci-1]]
|
||||||
x2, y2 = [int(p) for p in drawn_pred_history[ci]]
|
x2, y2 = [int(p) for p in drawn_pred_history[ci]]
|
||||||
|
|
Loading…
Reference in a new issue