// File: /workspace/github_cpp_makefile_star2_O3/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 0x2fe66
cmpl $0x0, 0x98(%rsi)
jle 0x2fe66
cmpl $0x0, 0x9c(%rsi)
jle 0x2fe66
movq %rdi, %rbx
cmpl $0x0, 0x330(%rdi)
je 0x2fe66
cmpl $0x4, 0x2c(%rsi)
jl 0x2fe66
movq 0x20(%rsi), %rax
movq 0x18(%rax), %rbp
testq %rbp, %rbp
je 0x2fe66
cmpl $0x0, 0xc0(%rbp)
jle 0x2fe66
cmpl $0x0, 0xc4(%rbp)
jle 0x2fe66
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x4410c
cmpl $0x0, (%r14)
jle 0x2fe5c
cmpl $0x0, 0x14(%rsp)
jle 0x2fe5c
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 0x2fe4a
movq $0x0, (%rsp)
leaq 0x58(%rsp), %r12
cmpl $0x0, 0x98(%rax)
jle 0x2fe34
movq (%rsp), %rcx
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
movsd %xmm0, 0x8(%rsp)
movslq %ecx, %r15
xorl %r13d, %r13d
movq 0xb8(%rbp), %rcx
movslq 0xc8(%rbp), %rdx
imulq %r15, %rdx
addq %r13, %rdx
movsd (%rcx,%rdx,8), %xmm0
ucomisd 0x108640(%rip), %xmm0   # 0x1383b8
jne 0x2fd80
jnp 0x2fe24
leaq 0x18d401(%rip), %rcx    # 0x1bd188
movsd (%rcx), %xmm1
movapd %xmm0, %xmm2
cmplepd %xmm1, %xmm2
xorpd 0x1086f4(%rip), %xmm1   # 0x138490
cmplepd %xmm0, %xmm1
andpd %xmm2, %xmm1
movd %xmm1, %ecx
testb $0x1, %cl
jne 0x2fe24
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
movq %r12, %rdi
movsd 0x8(%rsp), %xmm1
callq 0xde1e6
movq 0x2d0(%rbx), %rsi
leaq 0x40(%rsp), %rdi
movq %r12, %r14
movq %r12, %rdx
movsd 0x10825a(%rip), %xmm0   # 0x138038
callq 0x45664
leaq 0x28(%rsp), %rdi
leaq 0x10(%rsp), %rsi
movl %r13d, %edx
movq (%rsp), %rcx
callq 0xdf002
movsd 0x28(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
movsd 0x38(%rsp), %xmm2
callq 0x27ed0
leaq 0x40(%rsp), %rdi
callq 0x271c0
movq 0x2d0(%rbx), %rax
movq %r14, %r12
incq %r13
cmpl 0x98(%rax), %r13d
jl 0x2fd56
movq (%rsp), %rcx
incl %ecx
movq %rcx, (%rsp)
cmpl 0x9c(%rax), %ecx
jl 0x2fd32
callq 0x27cb0
movss 0x1081e9(%rip), %xmm0   # 0x138040
callq 0x270a0
leaq 0x10(%rsp), %rdi
callq 0xdeff4
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2fe7b
jmp 0x2fe7b
jmp 0x2fe7b
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xdeff4
movq %rbx, %rdi
callq 0x28120