// File: /workspace/github_cpp_makefile_star2_O1/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 0x2ffc1
cmpl $0x0, 0x98(%rsi)
jle 0x2ffc1
cmpl $0x0, 0x9c(%rsi)
jle 0x2ffc1
movq %rdi, %rbx
cmpl $0x0, 0x330(%rdi)
je 0x2ffc1
cmpl $0x4, 0x2c(%rsi)
jl 0x2fdfa
movq 0x20(%rsi), %rax
movq 0x18(%rax), %rbp
jmp 0x2fdfc
xorl %ebp, %ebp
testq %rbp, %rbp
je 0x2ffc1
cmpl $0x0, 0xc0(%rbp)
jle 0x2ffc1
cmpl $0x0, 0xc4(%rbp)
jle 0x2ffc1
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x440f2
cmpl $0x0, (%r14)
jle 0x2ffb7
cmpl $0x0, 0x14(%rsp)
jle 0x2ffb7
movl $0xb50, %edi            # imm = 0xB50
callq 0x27200
cvtsd2ss 0x2e8(%rbx), %xmm0
callq 0x270a0
xorl %edi, %edi
callq 0x271a0
movq 0x2d0(%rbx), %rax
cmpl $0x0, 0x9c(%rax)
jle 0x2ffa5
movq $0x0, (%rsp)
leaq 0x58(%rsp), %r12
movq 0x2d0(%rbx), %rax
cmpl $0x0, 0x98(%rax)
jle 0x2ff88
movq (%rsp), %rax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x8(%rsp)
movslq %eax, %r15
xorl %r13d, %r13d
movq 0xb8(%rbp), %rax
movslq 0xc8(%rbp), %rcx
imulq %r15, %rcx
addq %r13, %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd 0x10b4eb(%rip), %xmm0   # 0x13b3b8
jne 0x2fed5
jnp 0x2ff71
leaq 0x1902ac(%rip), %rax    # 0x1c0188
movsd (%rax), %xmm1
movapd %xmm0, %xmm2
cmplepd %xmm1, %xmm2
xorpd 0x10b59f(%rip), %xmm1   # 0x13b490
cmplepd %xmm0, %xmm1
andpd %xmm2, %xmm1
movd %xmm1, %eax
testb $0x1, %al
jne 0x2ff71
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
movq %r12, %rdi
movsd 0x8(%rsp), %xmm1
callq 0xdf9d2
movq 0x2d0(%rbx), %rsi
leaq 0x40(%rsp), %rdi
movq %r12, %r14
movq %r12, %rdx
movsd 0x10b106(%rip), %xmm0   # 0x13b038
callq 0x45666
leaq 0x28(%rsp), %rdi
leaq 0x10(%rsp), %rsi
movl %r13d, %edx
movq (%rsp), %rcx
callq 0xe0860
movsd 0x28(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
movsd 0x38(%rsp), %xmm2
callq 0x27ee0
leaq 0x40(%rsp), %rdi
callq 0x271c0
movq %r14, %r12
movq 0x2d0(%rbx), %rax
incq %r13
cmpl 0x98(%rax), %r13d
jl 0x2feab
movq (%rsp), %rcx
incl %ecx
movq 0x2d0(%rbx), %rax
movq %rcx, (%rsp)
cmpl 0x9c(%rax), %ecx
jl 0x2fe80
callq 0x27cc0
movss 0x10b08e(%rip), %xmm0   # 0x13b040
callq 0x270a0
leaq 0x10(%rsp), %rdi
callq 0xe0852
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2ffd6
jmp 0x2ffd6
jmp 0x2ffd6
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xe0852
movq %rbx, %rdi
callq 0x28130
nop