// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3TriangleArray.cpp
// Function: gaps::R3TriangleArray::DrawVBO(gaps::RNFlags) const
void R3TriangleArray::
DrawVBO(const R3DrawFlags draw_flags) const
{
#if (RN_3D_GRFX == RN_OPENGL)
  // Update vbo
  ((R3TriangleArray *) this)->UpdateVBO();

  // Check vbo
  if (vbo_id == 0) return;
  if (vbo_size == 0) return;

  // Bind vbo
  glBindBuffer(GL_ARRAY_BUFFER, vbo_id);

  // Set pointers
  static const unsigned int vertex_size = 12 * sizeof(GLfloat);
  glVertexPointer(3, GL_FLOAT, vertex_size, (char *) NULL);
  glNormalPointer(GL_FLOAT, vertex_size, (char *) NULL + 3 * sizeof(GLfloat));
  glColorPointer(3, GL_FLOAT, vertex_size, (char *) NULL + 6 * sizeof(GLfloat));
  glTexCoordPointer(2, GL_FLOAT, vertex_size, (char *) NULL + 9 * sizeof(GLfloat));

  // Enable client states
  R3DrawFlags flags(Flags() & draw_flags);
  glEnableClientState(GL_VERTEX_ARRAY);
  if (flags[R3_SURFACE_NORMALS_DRAW_FLAG] || flags[R3_VERTEX_NORMALS_DRAW_FLAG])
    glEnableClientState(GL_NORMAL_ARRAY);
  else glDisable(GL_NORMAL_ARRAY);
  if (flags[R3_VERTEX_COLORS_DRAW_FLAG])
    glEnableClientState(GL_COLOR_ARRAY);
  else glDisable(GL_COLOR_ARRAY);
  if (flags[R3_SURFACE_TEXTURE_DRAW_FLAG] || flags[R3_VERTEX_TEXTURE_COORDS_DRAW_FLAG])
    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
  else glDisable(GL_TEXTURE_COORD_ARRAY);
  
  // Draw triangles
  int nvertices = vbo_size / vertex_size;
  assert(nvertices == 3 * NTriangles());
  glDrawArrays(GL_TRIANGLES, 0, nvertices);
  
  // Disable client states
  glDisableClientState(GL_VERTEX_ARRAY);
  glDisableClientState(GL_NORMAL_ARRAY);
  glDisableClientState(GL_COLOR_ARRAY);
  glDisableClientState(GL_TEXTURE_COORD_ARRAY);

  glBindBuffer(GL_ARRAY_BUFFER, 0);

#endif
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %rax
callq *0x258(%rax)
movl 0x68(%rbx), %esi
testl %esi, %esi
je 0x5332f
cmpl $0x0, 0x6c(%rbx)
je 0x5332f
movq 0x91d00(%rip), %r15     # 0xe4fa8
movl $0x8892, %edi           # imm = 0x8892
callq *(%r15)
movl $0x3, %edi
movl $0x1406, %esi           # imm = 0x1406
movl $0x30, %edx
xorl %ecx, %ecx
callq 0xe470
movl $0xc, %edx
movl $0x1406, %edi           # imm = 0x1406
movl $0x30, %esi
callq 0xe7c0
movl $0x18, %ecx
movl $0x3, %edi
movl $0x1406, %esi           # imm = 0x1406
movl $0x30, %edx
callq 0xe460
movl $0x24, %ecx
movl $0x2, %edi
movl $0x1406, %esi           # imm = 0x1406
movl $0x30, %edx
callq 0xe8e0
andq 0x60(%rbx), %r14
movl $0x8074, %edi           # imm = 0x8074
callq 0xe2c0
movl $0x8075, %edi           # imm = 0x8075
testl $0x120, %r14d           # imm = 0x120
je 0x53335
callq 0xe2c0
jmp 0x5333a
popq %rbx
popq %r14
popq %r15
retq
callq 0xe140
movl $0x8076, %edi           # imm = 0x8076
btl $0xa, %r14d
jb 0x5334d
callq 0xe140
jmp 0x53352
callq 0xe2c0
movl $0x8078, %edi           # imm = 0x8078
testl $0x230, %r14d           # imm = 0x230
je 0x53367
callq 0xe2c0
jmp 0x5336c
callq 0xe140
movl 0x6c(%rbx), %eax
movl $0xaaaaaaab, %edx       # imm = 0xAAAAAAAB
imulq %rax, %rdx
shrq $0x25, %rdx
movl $0x4, %edi
xorl %esi, %esi
callq 0xe060
movl $0x8074, %edi           # imm = 0x8074
callq 0xe2a0
movl $0x8075, %edi           # imm = 0x8075
callq 0xe2a0
movl $0x8076, %edi           # imm = 0x8076
callq 0xe2a0
movl $0x8078, %edi           # imm = 0x8078
callq 0xe2a0
movq (%r15), %rax
movl $0x8892, %edi           # imm = 0x8892
xorl %esi, %esi
popq %rbx
popq %r14
popq %r15
jmpq *%rax
nopl (%rax)