// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::DrawNormals() const
void R3SurfelViewer::
DrawNormals(void) const
{
  // Check stuff
  if (!scene) return;
  if (!normal_visibility) return;

  // Draw normals
  glDisable(GL_LIGHTING);
  RNLoadRgb(normal_color);
  RNLength r = 0.00025 * scene->BBox().DiagonalRadius();
  for (int i = 0; i < resident_nodes.NNodes(); i++) {
    R3SurfelNode *node = resident_nodes.Node(i);
    if (!NodeVisibility(node)) continue;
    for (int j = 0; j < node->NBlocks(); j++) {
      R3SurfelBlock *block = node->Block(j);
      const R3Point& block_origin = block->PositionOrigin();
      glPushMatrix();
      glTranslated(block_origin.X(), block_origin.Y(), block_origin.Z());
      RNGrfxBegin(RN_GRFX_LINES);
      for (int k = 0; k < block->NSurfels(); k++) {
        const R3Surfel *surfel = block->Surfel(k);
        double px = surfel->X();
        double py = surfel->Y();
        double pz = surfel->Z();
        double nx = surfel->NX();
        double ny = surfel->NY();
        double nz = surfel->NZ();
        R3LoadPoint(px, py, pz);
        R3LoadPoint(px + r * nx, py + r * ny, pz + r * nz);
      }
      RNGrfxEnd();
      glPopMatrix();
    }
  }
}

// Assembly:
cmpq $0x0, 0x8(%rdi)
je 0x2daed
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
cmpl $0x0, 0x2f4(%rdi)
je 0x2dadf
movl $0xb50, %edi            # imm = 0xB50
callq 0x27220
leaq 0x368(%rbx), %rdi
callq 0x32b06
movq 0x8(%rbx), %rdi
callq 0x32960
movq %rax, %rdi
callq 0x32b1a
mulsd 0xeca80(%rip), %xmm0    # 0x11a3e8
movsd %xmm0, 0x10(%rsp)
xorl %ecx, %ecx
pushq $0x14
popq %r15
movq %rbx, (%rsp)
movslq 0x24(%rbx), %rax
cmpq %rax, %rcx
jge 0x2dadf
movq 0x18(%rbx), %rax
movq %rcx, 0x8(%rsp)
movq (%rax,%rcx,8), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2c136
testl %eax, %eax
je 0x2dace
xorl %r13d, %r13d
movslq 0x4c(%r14), %rax
cmpq %rax, %r13
jge 0x2dace
movq 0x40(%r14), %rax
movq (%rax,%r13,8), %rbx
callq 0x27fe0
movsd 0x10(%rbx), %xmm0
movsd 0x18(%rbx), %xmm1
movsd 0x20(%rbx), %xmm2
callq 0x279d0
pushq $0x1
popq %rdi
callq 0x271a0
movq %r15, %r12
xorl %ebp, %ebp
movslq 0x8(%rbx), %rax
cmpq %rax, %rbp
jge 0x2dabc
movq (%rbx), %rax
cvtss2sd -0x14(%rax,%r12), %xmm0
movsd %xmm0, 0x18(%rsp)
cvtss2sd -0x10(%rax,%r12), %xmm3
movsd %xmm3, 0x20(%rsp)
movswl -0x4(%rax,%r12), %ecx
cvtsi2ss %ecx, %xmm5
cvtss2sd -0xc(%rax,%r12), %xmm2
movsd %xmm2, 0x28(%rsp)
movss 0xecab4(%rip), %xmm4    # 0x11a4e0
mulss %xmm4, %xmm5
cvtss2sd %xmm5, %xmm1
movsd %xmm1, 0x40(%rsp)
movswl -0x2(%rax,%r12), %ecx
cvtsi2ss %ecx, %xmm5
movswl (%rax,%r12), %eax
cvtsi2ss %eax, %xmm1
mulss %xmm4, %xmm5
cvtss2sd %xmm5, %xmm5
movsd %xmm5, 0x30(%rsp)
mulss %xmm4, %xmm1
cvtss2sd %xmm1, %xmm1
movsd %xmm1, 0x38(%rsp)
movaps %xmm3, %xmm1
callq 0x27ee0
movsd 0x10(%rsp), %xmm2
movsd 0x40(%rsp), %xmm0
mulsd %xmm2, %xmm0
addsd 0x18(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
mulsd %xmm2, %xmm1
addsd 0x20(%rsp), %xmm1
movsd 0x38(%rsp), %xmm3
mulsd %xmm2, %xmm3
addsd 0x28(%rsp), %xmm3
movapd %xmm3, %xmm2
callq 0x27ee0
incq %rbp
addq $0x30, %r12
jmp 0x2d9e3
callq 0x27cc0
callq 0x28240
incq %r13
jmp 0x2d9a8
movq 0x8(%rsp), %rcx
incq %rcx
movq (%rsp), %rbx
jmp 0x2d978
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq