// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Draw.cpp
// Function: gaps::R3Cone::Draw(gaps::RNFlags) const
void R3Cone::
Draw(const R3DrawFlags draw_flags) const
{
#if (RN_3D_GRFX == RN_OPENGL)
    // Create GLU quadric
    // Should create GLU quadric for each draw style ???
    static GLUquadricObj *cone = gluNewQuadric(); 

    // Push matrix
    R4Matrix matrix = R4identity_matrix;
    matrix.Translate(axis.Start().Vector());
    matrix.Rotate(R3posz_vector, axis.Vector());
    matrix.Push();

    // Draw surface
    if (draw_flags[R3_SURFACES_DRAW_FLAG]) {
	if (draw_flags[R3_VERTEX_NORMALS_DRAW_FLAG]) gluQuadricNormals(cone, (GLenum) GLU_SMOOTH);
	else if (draw_flags[R3_SURFACE_NORMALS_DRAW_FLAG]) gluQuadricNormals(cone, (GLenum) GLU_FLAT);
	if (draw_flags[R3_VERTEX_TEXTURE_COORDS_DRAW_FLAG]) gluQuadricTexture(cone, GL_TRUE);
	else gluQuadricTexture(cone, GL_FALSE);
	gluQuadricDrawStyle(cone, (GLenum) GLU_FILL);
	gluCylinder(cone, Radius(), 0.0, Height(), 16, 1);
	gluQuadricOrientation(cone, (GLenum) GLU_INSIDE);
	gluDisk(cone, 0.0, Radius(), 16, 1);
	gluQuadricOrientation(cone, (GLenum) GLU_OUTSIDE);
    }

    // Draw edges
    if (draw_flags[R3_EDGES_DRAW_FLAG]) {
	gluQuadricNormals(cone, (GLenum) GLU_NONE);
	gluQuadricTexture(cone, GL_FALSE);
	gluQuadricDrawStyle(cone, (GLenum) GLU_SILHOUETTE);
	gluCylinder(cone, Radius(), 0.0, Height(), 16, 1);
    }

    // Pop matrix
    matrix.Pop();
#else
    RNAbort("Not Implemented");
#endif
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xa0, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movb 0x49f457(%rip), %al     # 0x4dbd30
testb %al, %al
je 0x3ca49
leaq 0x57508(%rip), %rsi     # 0x93df0
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0x2967c
leaq 0x8(%rbx), %rsi
leaq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0x212f8
movq %r15, %rdi
movq %r12, %rsi
callq 0x2a5cc
leaq 0x20(%rbx), %rdx
leaq 0x5cdd4(%rip), %rsi     # 0x996f0
movq %r15, %rdi
callq 0x2aa9a
movq %r15, %rdi
callq 0x3b398
testb $0x2, %r14b
je 0x3c9df
movl $0x186a0, %esi          # imm = 0x186A0
btl $0x8, %r14d
jb 0x3c94d
movl $0x186a1, %esi          # imm = 0x186A1
testb $0x20, %r14b
je 0x3c959
movq 0x49f3d4(%rip), %rdi    # 0x4dbd28
callq 0xe1d0
movl %r14d, %esi
shrl $0x9, %esi
movq 0x49f3c2(%rip), %rdi    # 0x4dbd28
andl $0x1, %esi
callq 0xe860
movq 0x49f3b3(%rip), %rdi    # 0x4dbd28
movl $0x186ac, %esi          # imm = 0x186AC
callq 0xe7a0
movq 0x49f3a2(%rip), %rdi    # 0x4dbd28
movsd 0x50(%rbx), %xmm2
movsd 0x78(%rbx), %xmm0
pushq $0x10
popq %rbp
pushq $0x1
popq %r15
xorps %xmm1, %xmm1
movl %ebp, %esi
movl %r15d, %edx
callq 0xe090
movq 0x49f37d(%rip), %rdi    # 0x4dbd28
movl $0x186b5, %esi          # imm = 0x186B5
callq 0xe150
movq 0x49f36c(%rip), %rdi    # 0x4dbd28
movsd 0x78(%rbx), %xmm1
xorps %xmm0, %xmm0
movl %ebp, %esi
movl %r15d, %edx
callq 0xe4d0
movq 0x49f353(%rip), %rdi    # 0x4dbd28
movl $0x186b4, %esi          # imm = 0x186B4
callq 0xe150
testb $0x1, %r14b
je 0x3ca34
movq 0x49f33c(%rip), %rdi    # 0x4dbd28
movl $0x186a2, %esi          # imm = 0x186A2
callq 0xe1d0
movq 0x49f32b(%rip), %rdi    # 0x4dbd28
xorl %esi, %esi
callq 0xe860
movq 0x49f31d(%rip), %rdi    # 0x4dbd28
movl $0x186ad, %esi          # imm = 0x186AD
callq 0xe7a0
movq 0x49f30c(%rip), %rdi    # 0x4dbd28
movsd 0x50(%rbx), %xmm2
movsd 0x78(%rbx), %xmm0
pushq $0x10
popq %rsi
pushq $0x1
popq %rdx
xorps %xmm1, %xmm1
callq 0xe090
callq 0xe880
addq $0xa0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x49f2e0(%rip), %rdi    # 0x4dbd30
callq 0xe840
testl %eax, %eax
je 0x3c8e1
callq 0xe520
movq %rax, 0x49f2bf(%rip)    # 0x4dbd28
leaq 0x49f2c0(%rip), %rdi    # 0x4dbd30
callq 0xe2f0
jmp 0x3c8e1
movq %rax, %rbx
leaq 0x49f2ac(%rip), %rdi    # 0x4dbd30
callq 0xe2e0
movq %rbx, %rdi
callq 0xe810
nop