Sha256: 1e90a07064663dde1b06bd775ba3c330be05dd4759479d4ab5021e7aa43b6eb5

Contents?: true

Size: 1.32 KB

Versions: 5

Compression:

Stored size: 1.32 KB

Contents

# The base middleware class works just like a Tracksperanto::Export::Base, but it only wraps another exporting object and does not get registered on it's own
# as an export format. Middleware can be used to massage the tracks being exported in various interesting ways - like moving the coordinates, clipping the keyframes,
# scaling the whole export or even reversing the trackers to go backwards
class Tracksperanto::Middleware::Base
  include Tracksperanto::Casts
  include Tracksperanto::BlockInit
  
  def initialize(exporter, *args_for_block_init)
    @exporter = exporter
    super(*args_for_block_init)
  end
  
  # Called on export start
  def start_export( img_width, img_height)
    @exporter.start_export(img_width, img_height)
  end
  
  # Called on export end
  def end_export
    @exporter.end_export
  end
  
  # Called on tracker start, one for each tracker. Start of the next tracker
  # signifies that the previous tracker has passed by
  def start_tracker_segment(tracker_name)
    @exporter.start_tracker_segment(tracker_name)
  end
  
  # Called on tracker end
  def end_tracker_segment
    @exporter.end_tracker_segment
  end
  
  # Called for each tracker keyframe
  def export_point(at_frame_i, abs_float_x, abs_float_y, float_residual)
    @exporter.export_point(at_frame_i, abs_float_x, abs_float_y, float_residual)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tracksperanto-1.2.4 lib/middleware/base.rb
tracksperanto-1.2.3 lib/middleware/base.rb
tracksperanto-1.2.2 lib/middleware/base.rb
tracksperanto-1.2.1 lib/middleware/base.rb
tracksperanto-1.2.0 lib/middleware/base.rb