// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::DrawImagePoints() const
void R3SurfelViewer::
DrawImagePoints(void) const
{
  // Get/check stuff
  if (!selected_image) return;
  if (selected_image->ImageWidth() <= 0) return;
  if (selected_image->ImageHeight()<= 0) return;
  if (!image_points_visibility) return;

  // Get depth and color channels
  const R2Grid *depth_channel = selected_image->DepthChannel();
  if (!depth_channel) return;
  if (depth_channel->XResolution() <= 0) return;
  if (depth_channel->YResolution() <= 0) return;
  const R2Image color_channels = selected_image->ColorChannels();
  if (color_channels.Width() <= 0) return;
  if (color_channels.Height() <= 0) return;

  // Draw image points
  glDisable(GL_LIGHTING);
  glPointSize(surfel_size);
  RNGrfxBegin(RN_GRFX_POINTS);
  for (int iy = 0; iy < selected_image->ImageHeight(); iy++) {
    for (int ix = 0; ix < selected_image->ImageWidth(); ix++) {
      RNScalar depth = depth_channel->GridValue(ix, iy);
      if (RNIsZero(depth) || (depth == R2_GRID_UNKNOWN_VALUE)) continue;
      R2Point image_position(ix, iy);
      R3Point world_position = selected_image->TransformFromImageToWorld(image_position);
      RNLoadRgb(color_channels.PixelRGB(ix, iy));
      R3LoadPoint(world_position);
    }
  }
  RNGrfxEnd();
  glPointSize(1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq 0x2d0(%rdi), %rsi
testq %rsi, %rsi
je 0x2eb98
cmpl $0x0, 0x98(%rsi)
jle 0x2eb98
cmpl $0x0, 0x9c(%rsi)
jle 0x2eb98
movq %rdi, %rbx
cmpl $0x0, 0x330(%rdi)
je 0x2eb98
cmpl $0x4, 0x2c(%rsi)
jl 0x2eb98
movq 0x20(%rsi), %rax
movq 0x18(%rax), %r15
testq %r15, %r15
je 0x2eb98
cmpl $0x0, 0xc0(%r15)
jle 0x2eb98
cmpl $0x0, 0xc4(%r15)
jle 0x2eb98
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x40a18
cmpl $0x0, (%r14)
jle 0x2eb8e
cmpl $0x0, 0x14(%rsp)
jle 0x2eb8e
movl $0xb50, %edi            # imm = 0xB50
callq 0x27220
cvtsd2ss 0x2e8(%rbx), %xmm0
callq 0x270a0
xorl %r14d, %r14d
xorl %edi, %edi
callq 0x271a0
movq 0x2d0(%rbx), %rax
leaq 0x40(%rsp), %r13
cmpl 0x9c(%rax), %r14d
jge 0x2eb7c
cvtsi2sd %r14d, %xmm0
movsd %xmm0, 0x8(%rsp)
movq %r14, (%rsp)
movslq %r14d, %r12
xorl %ebp, %ebp
cmpl 0x98(%rax), %ebp
jge 0x2eb70
movq 0xb8(%r15), %rcx
movslq 0xc8(%r15), %rdx
imulq %r12, %rdx
addq %rbp, %rdx
movsd (%rcx,%rdx,8), %xmm0
ucomisd 0xeb8eb(%rip), %xmm0    # 0x11a3b8
jne 0x2ead5
jnp 0x2eb68
leaq 0x1796cc(%rip), %rcx    # 0x1a81a8
movsd (%rcx), %xmm1
movapd %xmm0, %xmm2
cmplepd %xmm1, %xmm2
xorpd 0xeb99f(%rip), %xmm1    # 0x11a490
cmplepd %xmm0, %xmm1
andpd %xmm2, %xmm1
movd %xmm1, %ecx
testb $0x1, %cl
jne 0x2eb68
cvtsi2sd %ebp, %xmm0
movq %r13, %rdi
movsd 0x8(%rsp), %xmm1
callq 0xc9fbc
movq 0x2d0(%rbx), %rsi
leaq 0x28(%rsp), %rdi
movq %r13, %r14
movq %r13, %rdx
movsd 0xeb509(%rip), %xmm0    # 0x11a038
callq 0x41c42
leaq 0x50(%rsp), %r13
movq %r13, %rdi
leaq 0x10(%rsp), %rsi
movl %ebp, %edx
movq (%rsp), %rcx
callq 0xcad9e
movq %r13, %rdi
callq 0x32b06
leaq 0x28(%rsp), %rdi
callq 0x271c0
movq 0x2d0(%rbx), %rax
movq %r14, %r13
incq %rbp
jmp 0x2ea9f
movq (%rsp), %r14
incl %r14d
jmp 0x2ea7e
callq 0x27cc0
movss 0xeb4b7(%rip), %xmm0    # 0x11a040
callq 0x270a0
leaq 0x10(%rsp), %rdi
callq 0xcad90
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2ebad
jmp 0x2ebad
jmp 0x2ebad
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xcad90
movq %rbx, %rdi
callq 0x28140