// File: tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Brdf.cpp
// Function: gaps::R3Brdf::Draw(int) const
void R3Brdf::
Draw(RNBoolean force) const
{
    // Check if same brdf
    static const R3Brdf *R3current_brdf = NULL;
    if (!force && (this == R3current_brdf)) return;

    // Set brdf attributes
    GLfloat c[4];
    c[0] = Ambient().R();
    c[1] = Ambient().G();
    c[2] = Ambient().B();
    c[3] = Opacity();
    glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, c);
    c[0] = Diffuse().R();
    c[1] = Diffuse().G();
    c[2] = Diffuse().B();
    c[3] = Opacity();
    glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, c);
    c[0] = Specular().R();
    c[1] = Specular().G();
    c[2] = Specular().B();
    c[3] = Opacity();
    glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, c);
    c[0] = Emission().R();
    c[1] = Emission().G();
    c[2] = Emission().B();
    c[3] = Opacity();
    glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, c);
    glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, Shininess());
    if (IsTransparent()) {
      glDepthMask(FALSE);
      glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
      glEnable(GL_BLEND);
    }
    else {
      glDisable(GL_BLEND);
      glBlendFunc(GL_ONE, GL_ZERO);
      glDepthMask(TRUE);
    }

    // Remember brdf
    R3current_brdf = this;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movl %esi, 0x2c(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpl $0x0, 0x2c(%rsp)
jne 0x65481
movq 0x8(%rsp), %rax
cmpq 0x197f1e(%rip), %rax    # 0x1fd398
jne 0x65481
jmp 0x656eb
movq 0x8(%rsp), %rdi
callq 0x488e0
movq %rax, %rdi
callq 0x2b4a0
movq 0x8(%rsp), %rdi
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x10(%rsp)
callq 0x488e0
movq %rax, %rdi
callq 0x2b4b0
movq 0x8(%rsp), %rdi
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x14(%rsp)
callq 0x488e0
movq %rax, %rdi
callq 0x2b4c0
movq 0x8(%rsp), %rdi
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x18(%rsp)
callq 0x48a50
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x1c(%rsp)
leaq 0x10(%rsp), %rdx
movl $0x408, %edi            # imm = 0x408
movl $0x1200, %esi           # imm = 0x1200
callq 0x234a0
movq 0x8(%rsp), %rdi
callq 0x48930
movq %rax, %rdi
callq 0x2b4a0
movq 0x8(%rsp), %rdi
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x10(%rsp)
callq 0x48930
movq %rax, %rdi
callq 0x2b4b0
movq 0x8(%rsp), %rdi
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x14(%rsp)
callq 0x48930
movq %rax, %rdi
callq 0x2b4c0
movq 0x8(%rsp), %rdi
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x18(%rsp)
callq 0x48a50
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x1c(%rsp)
leaq 0x10(%rsp), %rdx
movl $0x408, %edi            # imm = 0x408
movl $0x1201, %esi           # imm = 0x1201
callq 0x234a0
movq 0x8(%rsp), %rdi
callq 0x48980
movq %rax, %rdi
callq 0x2b4a0
movq 0x8(%rsp), %rdi
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x10(%rsp)
callq 0x48980
movq %rax, %rdi
callq 0x2b4b0
movq 0x8(%rsp), %rdi
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x14(%rsp)
callq 0x48980
movq %rax, %rdi
callq 0x2b4c0
movq 0x8(%rsp), %rdi
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x18(%rsp)
callq 0x48a50
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x1c(%rsp)
leaq 0x10(%rsp), %rdx
movl $0x408, %edi            # imm = 0x408
movl $0x1202, %esi           # imm = 0x1202
callq 0x234a0
movq 0x8(%rsp), %rdi
callq 0x2bea0
movq %rax, %rdi
callq 0x2b4a0
movq 0x8(%rsp), %rdi
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x10(%rsp)
callq 0x2bea0
movq %rax, %rdi
callq 0x2b4b0
movq 0x8(%rsp), %rdi
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x14(%rsp)
callq 0x2bea0
movq %rax, %rdi
callq 0x2b4c0
movq 0x8(%rsp), %rdi
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x18(%rsp)
callq 0x48a50
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x1c(%rsp)
leaq 0x10(%rsp), %rdx
movl $0x408, %edi            # imm = 0x408
movl $0x1600, %esi           # imm = 0x1600
callq 0x234a0
movq 0x8(%rsp), %rdi
callq 0x48ae0
cvtsd2ss %xmm0, %xmm0
movl $0x408, %edi            # imm = 0x408
movl $0x1601, %esi           # imm = 0x1601
callq 0x229b0
movq 0x8(%rsp), %rdi
callq 0x489d0
cmpl $0x0, %eax
je 0x656bf
xorl %edi, %edi
callq 0x225b0
movl $0x302, %edi            # imm = 0x302
movl $0x303, %esi            # imm = 0x303
callq 0x22790
movl $0xbe2, %edi            # imm = 0xBE2
callq 0x22910
jmp 0x656df
movl $0xbe2, %edi            # imm = 0xBE2
callq 0x22230
movl $0x1, %edi
xorl %esi, %esi
callq 0x22790
movl $0x1, %edi
callq 0x225b0
movq 0x8(%rsp), %rax
movq %rax, 0x197cad(%rip)    # 0x1fd398
addq $0x38, %rsp
retq