// File: /workspace/github_cpp_makefile_star2_O2/SpiritLooper[P]RDV_OBJRender/camera.cpp
// Function: Camera::Camera(Vec3<float>, Image, int)
Camera::Camera(Vec3f position, Image i, int m) : eye(position), mode(m) {
    ViewPort = Matrix::identity(4);
    
    int x , y , h, w;
    x = i.get_width()  / 8;
    y = i.get_height() / 8;
    w = i.get_width()  * 3/4;
    h = i.get_height() * 3/4;

    ViewPort[0][3] = x+w/2.f;
    ViewPort[1][3] = y+h/2.f;
    ViewPort[2][3] = depth/2.f;
    
    ViewPort[0][0] = w/2.f;
    ViewPort[1][1] = h/2.f;
    ViewPort[2][2] = depth/2.f;

    Projection = Matrix::identity(4);
    Projection[3][2] = -1.f/position.z;

    center = Vec3f(0, 0, 0);
    up = Vec3f(0, 1, 0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edx, %ebp
movq %rsi, %r12
movq %rdi, %r14
movlps %xmm0, (%rdi)
movss %xmm1, 0xc(%rsp)
movss %xmm1, 0x8(%rdi)
leaq 0x28(%rdi), %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0xc(%rdi)
andq $0x0, 0x1c(%rdi)
pushq $0x4
popq %r15
movq %rbx, %rdi
movl %r15d, %esi
movl %r15d, %edx
callq 0x24dc
leaq 0x48(%r14), %rdi
movq %rdi, 0x10(%rsp)
movl %r15d, %esi
movl %r15d, %edx
callq 0x24dc
movl %ebp, 0x68(%r14)
leaq 0x18(%rsp), %rdi
pushq $0x4
popq %rsi
callq 0x2550
leaq 0x18(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x38e0
movq %r15, %rdi
callq 0x2be2
movq %r12, %rdi
callq 0x3b60
pushq $0x8
popq %rbp
cltd
idivl %ebp
movl %eax, %r15d
movq %r12, %rdi
callq 0x3b64
cltd
idivl %ebp
movl %eax, %r13d
movq %r12, %rdi
callq 0x3b60
movl %eax, %ebp
movq %r12, %rdi
callq 0x3b64
movl %eax, %r12d
leal (%rbp,%rbp,2), %eax
cltd
pushq $0x4
popq %rcx
idivl %ecx
movl %eax, %ebp
movq %rbx, %rdi
xorl %esi, %esi
callq 0x25d2
movq %rax, %rcx
cvtsi2ss %ebp, %xmm1
mulss 0x4154(%rip), %xmm1     # 0x70e8
cvtsi2ss %r15d, %xmm0
movss %xmm1, 0x8(%rsp)
addss %xmm1, %xmm0
leal (%r12,%r12,2), %eax
cltd
pushq $0x4
popq %rsi
idivl %esi
movl %eax, %ebp
movq (%rcx), %rax
movss %xmm0, 0xc(%rax)
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x25d2
cvtsi2ss %ebp, %xmm1
mulss 0x411a(%rip), %xmm1     # 0x70e8
cvtsi2ss %r13d, %xmm0
movss %xmm1, 0x4(%rsp)
addss %xmm1, %xmm0
movq (%rax), %rax
movss %xmm0, 0xc(%rax)
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x25d2
movq (%rax), %rax
movl $0x42ff0000, 0xc(%rax)  # imm = 0x42FF0000
movq %rbx, %rdi
xorl %esi, %esi
callq 0x25d2
movq (%rax), %rax
movss 0x8(%rsp), %xmm0
movss %xmm0, (%rax)
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x25d2
movq (%rax), %rax
movss 0x4(%rsp), %xmm0
movss %xmm0, 0x4(%rax)
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x25d2
movq (%rax), %rax
movl $0x42ff0000, 0x8(%rax)  # imm = 0x42FF0000
leaq 0x18(%rsp), %rdi
pushq $0x4
popq %rsi
callq 0x2550
leaq 0x18(%rsp), %r15
movq 0x10(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x38e0
movq %r15, %rdi
callq 0x2be2
pushq $0x3
popq %rsi
movq %r12, %rdi
callq 0x25d2
leaq 0xc(%r14), %rcx
movss 0x406c(%rip), %xmm0     # 0x70ec
divss 0xc(%rsp), %xmm0
movq (%rax), %rax
movss %xmm0, 0x8(%rax)
xorps %xmm0, %xmm0
movups %xmm0, (%rcx)
movss 0x3f68(%rip), %xmm0     # 0x7004
movlps %xmm0, 0x1c(%r14)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x30b9
jmp 0x30b9
movq %rax, %r14
jmp 0x30c6
movq %rax, %r14
movq 0x10(%rsp), %rdi
callq 0x2be2
movq %rbx, %rdi
callq 0x2be2
movq %r14, %rdi
callq 0x22b0