Sha256: 8ce1e6f4cff0d924eee4fdc6f511dedf198f242908dc9fe9909bdf4462c32a00

Contents?: true

Size: 1.21 KB

Versions: 36

Compression:

Stored size: 1.21 KB

Contents

# -*- encoding : utf-8 -*-
# Export for 3DE v4 point files. 3DE always starts frames at 1.
class Tracksperanto::Export::Equalizer4 < Tracksperanto::Export::Base
  
  def self.desc_and_extension
    "3de_v4.txt"
  end
  
  def self.human_name
    "3DE v4 point export .txt file"
  end
  
  def start_export( img_width, img_height)
    # 3DE needs to know the number of points in advance,
    # so we will just buffer to a StringIO
    @internal_io, @num_of_trackers = Tracksperanto::BufferIO.new, 0
  end
  
  def start_tracker_segment(tracker_name)
    @internal_io.puts(tracker_name)
    @num_of_trackers += 1
    @tracker_buffer, @num_of_kfs = Tracksperanto::BufferIO.new, 0
  end
  
  def export_point(frame, abs_float_x, abs_float_y, float_residual)
    @tracker_buffer.puts("%d %.15f %.15f" % [frame + 1, abs_float_x, abs_float_y])
    @num_of_kfs += 1
  end
  
  def end_tracker_segment
    @tracker_buffer.rewind
    @internal_io.puts("0") # Color of the point, 0 is red
    @internal_io.puts(@num_of_kfs)
    @internal_io.puts(@tracker_buffer.read)
    @tracker_buffer.close!
  end
  
  def end_export
    @internal_io.rewind
    @io.puts(@num_of_trackers)
    @io.puts(@internal_io.read)
    @internal_io.close!
  end
  
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
tracksperanto-3.2.2 lib/export/equalizer4.rb
tracksperanto-3.2.1 lib/export/equalizer4.rb
tracksperanto-3.2.0 lib/export/equalizer4.rb
tracksperanto-3.1.0 lib/export/equalizer4.rb
tracksperanto-3.0.1 lib/export/equalizer4.rb
tracksperanto-3.0.0 lib/export/equalizer4.rb
tracksperanto-2.12.0 lib/export/equalizer4.rb
tracksperanto-2.11.3 lib/export/equalizer4.rb
tracksperanto-2.11.2 lib/export/equalizer4.rb
tracksperanto-2.11.1 lib/export/equalizer4.rb
tracksperanto-2.11.0 lib/export/equalizer4.rb
tracksperanto-2.10.0 lib/export/equalizer4.rb
tracksperanto-2.9.9 lib/export/equalizer4.rb
tracksperanto-2.9.8 lib/export/equalizer4.rb
tracksperanto-2.9.7 lib/export/equalizer4.rb
tracksperanto-2.9.6 lib/export/equalizer4.rb