// File: KellerMartins[P]PDS2-Pacman/source/graphics/rendering.cpp
// Function: RenderManager::RenderBaseEffect()
void RenderBaseEffect(){
        //Render mask to _baseRT
        BeginTextureMode(_baseRT);    
            BeginMode3D(camera);  
                for(Object3D* m : _objectsToRender){
                    if(!m->HasModel() || !m->shouldRender) continue;

                    m->model.material.shader = _maskShader;
                    DrawModelEx(m->model, m->position, m->rotationAxis,m->rotationAngle,m->scale, m->model.material.maps[MAP_DIFFUSE].color);
                    m->model.material.shader = GetShaderDefault();
                } 
            EndMode3D();
        EndTextureMode();

        //Apply outline shader in _baseRT and copy to _tempRT        
        BeginTextureMode(_tempRT);
            BeginShaderMode(_outlineFilter);
                DrawTexturePro(_baseRT.texture, (Rectangle){ 0, 0, (float)_screenWidth, (float)-_screenHeight }, 
                                                (Rectangle){ 0, 0, (float)_screenWidth, (float)_screenHeight }, (Vector2){ 0, 0 }, 0,  WHITE);
            EndShaderMode();
        EndTextureMode();

        //Apply bicubic filter and copy from _tempRT to _baseRT
        BeginTextureMode(_baseRT);
            BeginShaderMode(_copyRTShader);

            Vector2 pixelSize = {1.0f/_screenWidth, 1.0f/_screenHeight};
            SetShaderValue(_copyRTShader, _copyRTPixelSizeLoc, (const float*) &pixelSize, 2);

            DrawTexturePro(_tempRT.texture, (Rectangle){ 0, 0, (float)_screenWidth, (float)-_screenHeight }, 
                                            (Rectangle){ 0, 0, (float)_screenWidth, (float)_screenHeight }, (Vector2){ 0, 0 }, 0,  WHITE);

            EndShaderMode();
        EndTextureMode();

        //Apply bicubic filter, downsample and copy _tempRT to _blurRT
        BeginTextureMode(_blurRT);
            BeginShaderMode(_copyRTShader);
            DrawTexturePro(_tempRT.texture, (Rectangle){ 0, 0, (float)_screenWidth, (float)-_screenHeight }, 
                                            (Rectangle){ 0, 0, (float)_blurRT.texture.width, 
                                                               (float)_blurRT.texture.height }, 
                                            (Vector2){ 0, 0 }, 0,  WHITE);
            EndShaderMode();
        EndTextureMode();
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa40, %rsp            # imm = 0xA40
leaq -0x30(%rbp), %rdi
leaq 0x20d8ce(%rip), %rsi    # 0x226494
movl $0x2c, %edx
callq 0x96e0
movups -0x30(%rbp), %xmm0
movups -0x20(%rbp), %xmm1
movups -0x14(%rbp), %xmm2
movq %rsp, %rax
movups %xmm2, 0x1c(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x3a4c6
leaq -0x60(%rbp), %rdi
leaq 0xcfc96(%rip), %rsi     # 0xe8890
movl $0x2c, %edx
callq 0x96e0
movups -0x60(%rbp), %xmm0
movups -0x50(%rbp), %xmm1
movups -0x44(%rbp), %xmm2
movq %rsp, %rax
movups %xmm2, 0x1c(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x3a19c
leaq 0x20d946(%rip), %rax    # 0x226570
movq %rax, -0x68(%rbp)
leaq 0x20d93b(%rip), %rdi    # 0x226570
callq 0x19c40
movq %rax, -0x70(%rbp)
leaq 0x20d92b(%rip), %rdi    # 0x226570
callq 0x19ce0
movq %rax, -0x78(%rbp)
leaq -0x70(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x19d10
testb $0x1, %al
jne 0x18c64
jmp 0x18e05
leaq -0x70(%rbp), %rdi
callq 0x19d40
movq (%rax), %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rdi
callq 0x15e70
testb $0x1, %al
jne 0x18c83
jmp 0x18c8d
movq -0x80(%rbp), %rax
testb $0x1, 0xd(%rax)
jne 0x18c92
jmp 0x18df7
movq -0x80(%rbp), %rdi
addq $0xd8, %rdi
leaq 0x20d550(%rip), %rsi    # 0x2261f4
movl $0x84, %edx
callq 0x96e0
movq -0x80(%rbp), %rsi
addq $0x38, %rsi
leaq -0x300(%rbp), %rdi
movl $0x280, %edx            # imm = 0x280
callq 0x96e0
movq -0x80(%rbp), %rax
movl 0x18(%rax), %ecx
movl %ecx, -0x308(%rbp)
movq 0x10(%rax), %rax
movq %rax, -0x310(%rbp)
movq -0x80(%rbp), %rax
movl 0x30(%rax), %ecx
movl %ecx, -0x318(%rbp)
movq 0x28(%rax), %rax
movq %rax, -0x320(%rbp)
movq -0x80(%rbp), %rax
movss 0x34(%rax), %xmm4
movl 0x24(%rax), %ecx
movl %ecx, -0x328(%rbp)
movq 0x1c(%rax), %rax
movq %rax, -0x330(%rbp)
movq -0x80(%rbp), %rax
movl 0x170(%rax), %eax
movl %eax, -0x334(%rbp)
movl -0x308(%rbp), %eax
movl %eax, -0x340(%rbp)
movq -0x310(%rbp), %rax
movq %rax, -0x348(%rbp)
movsd -0x348(%rbp), %xmm0
movss -0x340(%rbp), %xmm1
movl -0x318(%rbp), %eax
movl %eax, -0x350(%rbp)
movq -0x320(%rbp), %rax
movq %rax, -0x358(%rbp)
movsd -0x358(%rbp), %xmm2
movss -0x350(%rbp), %xmm3
movl -0x328(%rbp), %eax
movl %eax, -0x360(%rbp)
movq -0x330(%rbp), %rax
movq %rax, -0x368(%rbp)
movsd -0x368(%rbp), %xmm5
movss -0x360(%rbp), %xmm6
movl -0x334(%rbp), %eax
movl %eax, -0x780(%rbp)
movq %rsp, %rdi
movl $0x50, %ecx
leaq -0x300(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movl -0x780(%rbp), %edi
callq 0x50771
leaq -0x3ec(%rbp), %rdi
callq 0x2de02
movq -0x80(%rbp), %rdi
addq $0x38, %rdi
addq $0xa0, %rdi
leaq -0x3ec(%rbp), %rsi
movl $0x84, %edx
callq 0x96e0
leaq -0x70(%rbp), %rdi
callq 0x19d60
jmp 0x18c4e
callq 0x3a498
callq 0x3a546
movups 0x20d6c6(%rip), %xmm0   # 0x2264dc
movups %xmm0, -0x404(%rbp)
movups 0x20d6ac(%rip), %xmm0   # 0x2264d0
movaps %xmm0, -0x410(%rbp)
movups 0x20d68e(%rip), %xmm0   # 0x2264c0
movaps %xmm0, -0x420(%rbp)
movups -0x404(%rbp), %xmm0
movq %rsp, %rax
movups %xmm0, 0x1c(%rax)
movaps -0x420(%rbp), %xmm0
movaps -0x410(%rbp), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x3a4c6
leaq 0x20d494(%rip), %rsi    # 0x2262fc
leaq -0x4a8(%rbp), %rdi
movq %rdi, -0x7c0(%rbp)
movl $0x84, %edx
movq %rdx, -0x798(%rbp)
callq 0x96e0
movq -0x7c0(%rbp), %rsi
movq %rsp, %rax
movl $0x10, %ecx
movq %rcx, -0x790(%rbp)
movq %rax, %rdi
rep  movsq (%rsi), %es:(%rdi)
movl -0x428(%rbp), %ecx
movl %ecx, 0x80(%rax)
callq 0x2e4d3
movl 0x20d5ee(%rip), %eax    # 0x2264a8
movl %eax, -0x4b0(%rbp)
movups 0x20d5d1(%rip), %xmm0   # 0x226498
movaps %xmm0, -0x4c0(%rbp)
movl $0x0, -0x4d0(%rbp)
movl $0x0, -0x4cc(%rbp)
cvtsi2ssl 0x20d27a(%rip), %xmm0 # 0x226164
movss %xmm0, -0x4c8(%rbp)
movl 0x20d270(%rip), %eax    # 0x226168
negl %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x4c4(%rbp)
movl $0x0, -0x4e0(%rbp)
movl $0x0, -0x4dc(%rbp)
cvtsi2ssl 0x20d242(%rip), %xmm0 # 0x226164
movss %xmm0, -0x4d8(%rbp)
cvtsi2ssl 0x20d236(%rip), %xmm0 # 0x226168
movss %xmm0, -0x4d4(%rbp)
movl $0x0, -0x4e8(%rbp)
movl $0x0, -0x4e4(%rbp)
movb $-0x1, -0x4ec(%rbp)
movb $-0x1, -0x4eb(%rbp)
movb $-0x1, -0x4ea(%rbp)
movb $-0x1, -0x4e9(%rbp)
movsd -0x4d0(%rbp), %xmm0
movsd -0x4c8(%rbp), %xmm1
movsd -0x4e0(%rbp), %xmm2
movsd -0x4d8(%rbp), %xmm3
movsd -0x4e8(%rbp), %xmm4
movl -0x4ec(%rbp), %edi
movl -0x4b0(%rbp), %ecx
movq %rsp, %rax
movl %ecx, 0x10(%rax)
movaps -0x4c0(%rbp), %xmm5
movups %xmm5, (%rax)
xorps %xmm5, %xmm5
movss %xmm5, -0x7a4(%rbp)
callq 0x835b3
callq 0x2e516
callq 0x3a546
movups 0x20d4e1(%rip), %xmm0   # 0x2264b0
movups %xmm0, -0x504(%rbp)
movups 0x20d4c7(%rip), %xmm0   # 0x2264a4
movaps %xmm0, -0x510(%rbp)
movups 0x20d4a9(%rip), %xmm0   # 0x226494
movaps %xmm0, -0x520(%rbp)
movups -0x504(%rbp), %xmm0
movq %rsp, %rax
movups %xmm0, 0x1c(%rax)
movaps -0x520(%rbp), %xmm0
movaps -0x510(%rbp), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x3a4c6
movq -0x798(%rbp), %rdx
leaq 0x20d3dc(%rip), %rsi    # 0x226404
movq %rsi, -0x7a0(%rbp)
leaq -0x5a8(%rbp), %rdi
movq %rdi, -0x7b8(%rbp)
callq 0x96e0
movq -0x7b8(%rbp), %rsi
movq -0x790(%rbp), %rcx
movq %rsp, %rax
movq %rax, %rdi
rep  movsq (%rsi), %es:(%rdi)
movl -0x528(%rbp), %ecx
movl %ecx, 0x80(%rax)
callq 0x2e4d3
movq -0x7a0(%rbp), %rsi
movq -0x798(%rbp), %rdx
cvtsi2ssl 0x20d0e4(%rip), %xmm2 # 0x226164
movss 0x8bf88(%rip), %xmm0    # 0xa5010
movaps %xmm0, %xmm1
divss %xmm2, %xmm1
movss %xmm1, -0x5b0(%rbp)
cvtsi2ssl 0x20d0c9(%rip), %xmm1 # 0x226168
divss %xmm1, %xmm0
movss %xmm0, -0x5ac(%rbp)
leaq -0x638(%rbp), %rdi
movq %rdi, -0x7b0(%rbp)
callq 0x96e0
movq -0x7b0(%rbp), %rsi
movq -0x790(%rbp), %rcx
movl 0x20d3be(%rip), %eax    # 0x226490
movl %eax, -0x7a8(%rbp)
movq %rsp, %rax
movq %rax, %rdi
rep  movsq (%rsi), %es:(%rdi)
movl -0x7a8(%rbp), %edi
movl -0x5b8(%rbp), %ecx
movl %ecx, 0x80(%rax)
leaq -0x5b0(%rbp), %rsi
movl $0x2, %edx
callq 0x2e5d7
movss -0x7a4(%rbp), %xmm5
movl 0x20d3c2(%rip), %eax    # 0x2264d4
movl %eax, -0x640(%rbp)
movups 0x20d3a5(%rip), %xmm0   # 0x2264c4
movaps %xmm0, -0x650(%rbp)
movl $0x0, -0x660(%rbp)
movl $0x0, -0x65c(%rbp)
cvtsi2ssl 0x20d022(%rip), %xmm0 # 0x226164
movss %xmm0, -0x658(%rbp)
movl 0x20d018(%rip), %eax    # 0x226168
negl %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x654(%rbp)
movl $0x0, -0x670(%rbp)
movl $0x0, -0x66c(%rbp)
cvtsi2ssl 0x20cfea(%rip), %xmm0 # 0x226164
movss %xmm0, -0x668(%rbp)
cvtsi2ssl 0x20cfde(%rip), %xmm0 # 0x226168
movss %xmm0, -0x664(%rbp)
movl $0x0, -0x678(%rbp)
movl $0x0, -0x674(%rbp)
movb $-0x1, -0x67c(%rbp)
movb $-0x1, -0x67b(%rbp)
movb $-0x1, -0x67a(%rbp)
movb $-0x1, -0x679(%rbp)
movsd -0x660(%rbp), %xmm0
movsd -0x658(%rbp), %xmm1
movsd -0x670(%rbp), %xmm2
movsd -0x668(%rbp), %xmm3
movsd -0x678(%rbp), %xmm4
movl -0x67c(%rbp), %edi
movl -0x640(%rbp), %ecx
movq %rsp, %rax
movl %ecx, 0x10(%rax)
movaps -0x650(%rbp), %xmm6
movups %xmm6, (%rax)
callq 0x835b3
callq 0x2e516
callq 0x3a546
movups 0x20d2ec(%rip), %xmm0   # 0x226508
movups %xmm0, -0x694(%rbp)
movups 0x20d2d2(%rip), %xmm0   # 0x2264fc
movaps %xmm0, -0x6a0(%rbp)
movups 0x20d2b4(%rip), %xmm0   # 0x2264ec
movaps %xmm0, -0x6b0(%rbp)
movups -0x694(%rbp), %xmm0
movq %rsp, %rax
movups %xmm0, 0x1c(%rax)
movaps -0x6b0(%rbp), %xmm0
movaps -0x6a0(%rbp), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x3a4c6
movq -0x7a0(%rbp), %rsi
movq -0x798(%rbp), %rdx
leaq -0x738(%rbp), %rdi
movq %rdi, -0x788(%rbp)
callq 0x96e0
movq -0x790(%rbp), %rcx
movq -0x788(%rbp), %rsi
movq %rsp, %rax
movq %rax, %rdi
rep  movsq (%rsi), %es:(%rdi)
movl -0x6b8(%rbp), %ecx
movl %ecx, 0x80(%rax)
callq 0x2e4d3
movl 0x20d21e(%rip), %eax    # 0x2264d4
movl %eax, -0x740(%rbp)
movups 0x20d201(%rip), %xmm0   # 0x2264c4
movaps %xmm0, -0x750(%rbp)
movl $0x0, -0x760(%rbp)
movl $0x0, -0x75c(%rbp)
cvtsi2ssl 0x20ce7e(%rip), %xmm0 # 0x226164
movss %xmm0, -0x758(%rbp)
movl 0x20ce74(%rip), %eax    # 0x226168
negl %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x754(%rbp)
movl $0x0, -0x770(%rbp)
movl $0x0, -0x76c(%rbp)
cvtsi2ssl 0x20d1d6(%rip), %xmm0 # 0x2264f4
movss %xmm0, -0x768(%rbp)
cvtsi2ssl 0x20d1ca(%rip), %xmm0 # 0x2264f8
movss %xmm0, -0x764(%rbp)
movl $0x0, -0x778(%rbp)
movl $0x0, -0x774(%rbp)
movb $-0x1, -0x77c(%rbp)
movb $-0x1, -0x77b(%rbp)
movb $-0x1, -0x77a(%rbp)
movb $-0x1, -0x779(%rbp)
movsd -0x760(%rbp), %xmm0
movsd -0x758(%rbp), %xmm1
movsd -0x770(%rbp), %xmm2
movsd -0x768(%rbp), %xmm3
movsd -0x778(%rbp), %xmm4
movl -0x77c(%rbp), %edi
movl -0x740(%rbp), %ecx
movq %rsp, %rax
movl %ecx, 0x10(%rax)
movups -0x750(%rbp), %xmm5
movups %xmm5, (%rax)
xorps %xmm5, %xmm5
callq 0x835b3
callq 0x2e516
callq 0x3a546
addq $0xa40, %rsp            # imm = 0xA40
popq %rbp
retq
nopw %cs:(%rax,%rax)