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,16 +92,16 @@ 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')
|
||||||
)
|
)
|
||||||
|
|
||||||
if not args.bypass_prediction:
|
if not args.bypass_prediction:
|
||||||
procs.append(
|
procs.append(
|
||||||
|
|
|
@ -185,28 +185,29 @@ 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():
|
||||||
for ci in range(1, len(drawn_positions)):
|
if True:
|
||||||
x, y = [int(p) for p in drawn_positions[ci-1]]
|
for ci in range(1, len(drawn_positions)):
|
||||||
x2, y2 = [int(p) for p in drawn_positions[ci]]
|
x, y = [int(p) for p in drawn_positions[ci-1]]
|
||||||
|
x2, y2 = [int(p) for p in drawn_positions[ci]]
|
||||||
|
|
||||||
y, y2 = self.renderer.window.height - y, self.renderer.window.height - y2
|
y, y2 = self.renderer.window.height - y, self.renderer.window.height - y2
|
||||||
color = [100+155*ci // len(drawn_positions)]*3
|
color = [100+155*ci // len(drawn_positions)]*3
|
||||||
# print(x,y,x2,y2,color)
|
# print(x,y,x2,y2,color)
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
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))
|
||||||
|
|
||||||
# TODO: basically a duplication of the above, do this smarter?
|
# TODO: basically a duplication of the above, do this smarter?
|
||||||
# TODO: add intermediate segment
|
# TODO: add intermediate segment
|
||||||
|
@ -216,26 +217,27 @@ 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():
|
||||||
for ci in range(1, len(drawn_pred_history)):
|
if False:
|
||||||
x, y = [int(p) for p in drawn_pred_history[ci-1]]
|
for ci in range(1, len(drawn_pred_history)):
|
||||||
x2, y2 = [int(p) for p in drawn_pred_history[ci]]
|
x, y = [int(p) for p in drawn_pred_history[ci-1]]
|
||||||
|
x2, y2 = [int(p) for p in drawn_pred_history[ci]]
|
||||||
|
|
||||||
y, y2 = self.renderer.window.height - y, self.renderer.window.height - y2
|
y, y2 = self.renderer.window.height - y, self.renderer.window.height - y2
|
||||||
|
|
||||||
if ci >= len(self.pred_history_shapes):
|
if ci >= len(self.pred_history_shapes):
|
||||||
# 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.Line(x,y ,x2, y2, 2.5, color, batch=self.renderer.batch_anim)
|
line = pyglet.shapes.Line(x,y ,x2, y2, 2.5, 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 = 120
|
line.opacity = 120
|
||||||
self.pred_history_shapes.append(line)
|
self.pred_history_shapes.append(line)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
line = self.pred_history_shapes[ci-1]
|
line = self.pred_history_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))
|
||||||
|
|
||||||
|
|
||||||
for a, drawn_prediction in enumerate(drawn_predictions):
|
for a, drawn_prediction in enumerate(drawn_predictions):
|
||||||
|
|
Loading…
Reference in a new issue