// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::R3SurfelViewer(gaps::R3SurfelScene*)
R3SurfelViewer::
R3SurfelViewer(R3SurfelScene *scene)
  : scene(NULL),
    resident_nodes(),
    viewer(),
    viewing_extent(FLT_MAX, FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX, -FLT_MAX),
    elevation_range(FLT_MAX, -FLT_MAX),
    viewing_frustum(),
    center_point(0,0,0),
    selected_point(NULL),
    selected_image(NULL),
    image_inset_size(0.2),
    image_plane_depth(2),
    surfel_size(2),
    surfel_visibility(1),
    normal_visibility(0),
    backfacing_visibility(1),
    aerial_visibility(1),
    terrestrial_visibility(1),
    human_labeled_object_visibility(1),
    object_principal_axes_visibility(0),
    object_oriented_bbox_visibility(0),
    object_relationship_visibility(0),
    object_bbox_visibility(0),
    node_bbox_visibility(0),
    block_bbox_visibility(0),
    scan_viewpoint_visibility(0),
    image_viewpoint_visibility(1),
    image_plane_visibility(0),
    image_inset_visibility(1),
    image_points_visibility(0),
    center_point_visibility(0),
    viewing_extent_visibility(1),
    axes_visibility(0),
    label_visibilities(),
    attribute_visibility_flags(0xFFFFFFFF),
    surfel_color_scheme(R3_SURFEL_VIEWER_COLOR_BY_RGB),
    normal_color(0,1,0),
    background_color(0,0,0),
    object_principal_axes_color(0,1,1),
    object_oriented_bbox_color(0.75,0.0,0.75),
    object_bbox_color(0,1,1),
    node_bbox_color(0,0,1),
    block_bbox_color(0,1,0),
    scan_viewpoint_color(0,1,1),
    image_viewpoint_color(0,1,1),
    center_point_color(0,0,0.5),
    shape_draw_flags(0),
    adapt_working_set_automatically(0),
    target_resolution(100),
    last_target_resolution(0),
    focus_radius(0),
    last_focus_radius(0),
    adapt_subsampling_automatically(0),
    subsampling_factor(1),
    subsampling_multiplier_when_mouse_down(1),
    window_height(0),
    window_width(0),
    shift_down(0),
    ctrl_down(0),
    alt_down(0),
    start_timer(),
    frame_timer(),
    frame_time(-1),
    screenshot_name(NULL),
    ground_z_grid(),
    selected_image_color_pixels(),
    previous_color_image(NULL),
    selected_image_texture_id(0),
    previous_texture_image(NULL),
    vbo_position_buffer(0),
    vbo_normal_buffer(0),
    vbo_color_buffer(0),
    vbo_nsurfels(0),
    shader_program(0),
    vertex_shader(0),
    fragment_shader(0)
{
  // Initialize mouse button state
  mouse_button[0] = 0;
  mouse_button[1] = 0;
  mouse_button[2] = 0;

  // Initialize mouse positions
  mouse_position[0] = 0;
  mouse_position[1] = 0;

  // Initialize mouse positions
  mouse_down_position[0] = 0;
  mouse_down_position[1] = 0;

  // Initialize mouse drag distance
  mouse_drag_distance_squared = 0;

  // Initialize timers
  start_timer.Read();
  frame_timer.Read();

  // Set the scene
  if (scene) SetScene(scene);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbp
movq %rdi, %r12
leaq 0x172f45(%rip), %rax    # 0x19eb00
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
leaq 0x10(%rdi), %rbx
movq %rbx, %rdi
callq 0x3e044
leaq 0x78(%r12), %r14
movq %r14, %rdi
movq %rbx, 0x20(%rsp)
callq 0x6e812
leaq 0x120(%r12), %r15
movsd 0xee747(%rip), %xmm0    # 0x11a338
movsd 0xee747(%rip), %xmm3    # 0x11a340
movq %r15, %rdi
movaps %xmm0, %xmm1
movaps %xmm0, %xmm2
movaps %xmm3, %xmm4
movaps %xmm3, %xmm5
movq %r14, 0x18(%rsp)
callq 0x9defa
leaq 0x158(%r12), %rdi
movsd 0xee716(%rip), %xmm0    # 0x11a338
movsd 0xee716(%rip), %xmm1    # 0x11a340
movq %r15, 0x10(%rsp)
callq 0xd27cc
leaq 0x168(%r12), %r13
movq %r13, %rdi
callq 0x9ad9c
leaq 0x2b0(%r12), %rdi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
movq %r13, 0x8(%rsp)
callq 0xb2320
xorps %xmm0, %xmm0
movups %xmm0, 0x2c8(%r12)
movaps 0xee7de(%rip), %xmm1    # 0x11a450
movups %xmm1, 0x2d8(%r12)
movabsq $0x4000000000000000, %rax # imm = 0x4000000000000000
movq %rax, 0x2e8(%r12)
movaps 0xee7cc(%rip), %xmm1    # 0x11a460
movups %xmm1, 0x2f0(%r12)
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x300(%r12)
movups %xmm0, 0x308(%r12)
movups %xmm0, 0x314(%r12)
movaps 0xee7a8(%rip), %xmm1    # 0x11a470
movups %xmm1, 0x324(%r12)
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, 0x334(%r12)
movups %xmm0, 0x33c(%r12)
movups %xmm0, 0x348(%r12)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, 0x358(%r12)
andl $0x0, 0x360(%r12)
leaq 0x368(%r12), %rdi
movsd 0xee2ed(%rip), %xmm1    # 0x11a008
xorps %xmm0, %xmm0
xorps %xmm2, %xmm2
callq 0xd08da
leaq 0x380(%r12), %rdi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
callq 0xd08da
leaq 0x398(%r12), %rdi
movsd 0xee2bc(%rip), %xmm1    # 0x11a008
xorps %xmm0, %xmm0
movaps %xmm1, %xmm2
callq 0xd08da
leaq 0x3b0(%r12), %rdi
movsd 0xee5e1(%rip), %xmm0    # 0x11a348
xorps %xmm1, %xmm1
movaps %xmm0, %xmm2
callq 0xd08da
leaq 0x3c8(%r12), %rdi
movsd 0xee286(%rip), %xmm1    # 0x11a008
xorps %xmm0, %xmm0
movaps %xmm1, %xmm2
callq 0xd08da
leaq 0x3e0(%r12), %rdi
movsd 0xee26b(%rip), %xmm2    # 0x11a008
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
callq 0xd08da
leaq 0x3f8(%r12), %rdi
movsd 0xee250(%rip), %xmm1    # 0x11a008
xorps %xmm0, %xmm0
xorps %xmm2, %xmm2
callq 0xd08da
leaq 0x410(%r12), %rdi
movsd 0xee235(%rip), %xmm1    # 0x11a008
xorps %xmm0, %xmm0
movaps %xmm1, %xmm2
callq 0xd08da
leaq 0x428(%r12), %rdi
movsd 0xee21a(%rip), %xmm1    # 0x11a008
xorps %xmm0, %xmm0
movaps %xmm1, %xmm2
callq 0xd08da
leaq 0x440(%r12), %rdi
movsd 0xee207(%rip), %xmm2    # 0x11a010
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
callq 0xd08da
andq $0x0, 0x458(%r12)
andl $0x0, 0x460(%r12)
movabsq $0x4059000000000000, %rax # imm = 0x4059000000000000
movq %rax, 0x468(%r12)
xorps %xmm0, %xmm0
movups %xmm0, 0x470(%r12)
movups %xmm0, 0x47c(%r12)
movsd 0xee62b(%rip), %xmm0    # 0x11a480
movups %xmm0, 0x48c(%r12)
andq $0x0, 0x4bc(%r12)
andl $0x0, 0x4c4(%r12)
leaq 0x4c8(%r12), %r14
movq %r14, %rdi
callq 0xd051a
leaq 0x4d8(%r12), %r15
movq %r15, %rdi
callq 0xd051a
movabsq $-0x4010000000000000, %rax # imm = 0xBFF0000000000000
movq %rax, 0x4e8(%r12)
andq $0x0, 0x4f0(%r12)
leaq 0x4f8(%r12), %rbx
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xb9df8
leaq 0x5c8(%r12), %r13
movq %r13, %rdi
callq 0xca844
andq $0x0, 0x5e0(%r12)
andl $0x0, 0x5e8(%r12)
xorps %xmm0, %xmm0
movups %xmm0, 0x49c(%r12)
movups %xmm0, 0x4ac(%r12)
movups %xmm0, 0x5f0(%r12)
movups %xmm0, 0x600(%r12)
andl $0x0, 0x610(%r12)
movq %r14, %rdi
callq 0x2baa4
movq %r15, %rdi
callq 0x2baa4
testq %rbp, %rbp
je 0x2bf36
movq (%r12), %rax
movq %r12, %rdi
movq %rbp, %rsi
callq *0x350(%rax)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbp
movq %r13, %rdi
callq 0xcad90
jmp 0x2bf55
movq %rax, %rbp
movq %rbx, %rdi
callq 0xba93c
jmp 0x2bf76
movq %rax, %rbp
jmp 0x2bf85
movq %rax, %rbp
jmp 0x2bf99
movq %rax, %rbp
jmp 0x2bfa3
movq %rax, %rbp
jmp 0x2bf8f
movq %rax, %rbp
addq $0x340, %r12            # imm = 0x340
movq %r12, %rdi
callq 0x33292
movq 0x8(%rsp), %rdi
callq 0x9eb12
movq 0x10(%rsp), %rdi
callq 0x9eb12
movq 0x18(%rsp), %rdi
callq 0x6e8e6
movq 0x20(%rsp), %rdi
callq 0x3e156
movq %rbp, %rdi
callq 0x28140
nop