// File: /workspace/github_cpp_makefile_star2_O3/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 0x2ec1e
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
cmpl $0x0, 0x2f4(%rdi)
je 0x2ec10
movl $0xb50, %edi            # imm = 0xB50
callq 0x27200
movsd 0x368(%rbx), %xmm0
movsd 0x370(%rbx), %xmm1
movsd 0x378(%rbx), %xmm2
callq 0x27ed0
movq 0x8(%rbx), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x2ea5e
callq 0x4003c
movq %rax, %rdi
jmp 0x2ea65
leaq 0x195af3(%rip), %rdi    # 0x1c4558
callq 0xad918
cmpl $0x0, 0x24(%rbx)
jle 0x2ec10
mulsd 0x109594(%rip), %xmm0   # 0x138010
mulsd 0x109964(%rip), %xmm0   # 0x1383e8
movsd %xmm0, 0x10(%rsp)
xorl %r15d, %r15d
movq %rbx, 0x8(%rsp)
movq 0x18(%rbx), %rax
movq (%rax,%r15,8), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2ce66
testl %eax, %eax
je 0x2ebfb
cmpl $0x0, 0x4c(%r14)
jle 0x2ebfb
xorl %r12d, %r12d
movq 0x40(%r14), %rax
movq (%rax,%r12,8), %r13
callq 0x27fc0
movsd 0x10(%r13), %xmm0
movsd 0x18(%r13), %xmm1
movsd 0x20(%r13), %xmm2
callq 0x279c0
movl $0x1, %edi
callq 0x271a0
cmpl $0x0, 0x8(%r13)
movss 0x109a3a(%rip), %xmm4   # 0x138530
jle 0x2ebe1
movl $0x14, %ebp
xorl %ebx, %ebx
movq (%r13), %rax
xorps %xmm0, %xmm0
cvtss2sd -0x14(%rax,%rbp), %xmm0
movsd %xmm0, 0x18(%rsp)
xorps %xmm1, %xmm1
cvtss2sd -0x10(%rax,%rbp), %xmm1
movsd %xmm1, 0x20(%rsp)
movswl -0x4(%rax,%rbp), %ecx
xorps %xmm3, %xmm3
cvtsi2ss %ecx, %xmm3
xorps %xmm2, %xmm2
cvtss2sd -0xc(%rax,%rbp), %xmm2
movsd %xmm2, 0x28(%rsp)
mulss %xmm4, %xmm3
cvtss2sd %xmm3, %xmm3
movsd %xmm3, 0x40(%rsp)
movswl -0x2(%rax,%rbp), %ecx
xorps %xmm5, %xmm5
cvtsi2ss %ecx, %xmm5
movswl (%rax,%rbp), %eax
xorps %xmm3, %xmm3
cvtsi2ss %eax, %xmm3
mulss %xmm4, %xmm5
cvtss2sd %xmm5, %xmm5
movsd %xmm5, 0x30(%rsp)
mulss %xmm4, %xmm3
cvtss2sd %xmm3, %xmm3
movsd %xmm3, 0x38(%rsp)
callq 0x27ec0
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 0x27ec0
movss 0x109963(%rip), %xmm4   # 0x138530
incq %rbx
movslq 0x8(%r13), %rax
addq $0x30, %rbp
cmpq %rax, %rbx
jl 0x2eb03
callq 0x27cb0
callq 0x28220
incq %r12
movslq 0x4c(%r14), %rax
cmpq %rax, %r12
jl 0x2eabb
incq %r15
movq 0x8(%rsp), %rbx
movslq 0x24(%rbx), %rax
cmpq %rax, %r15
jl 0x2ea92
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop