/*
 * 3D Engine 
 * camera.h: 
 * Based on pikuma.com 3D software renderer in C
 * Copyright (c) 2021 986-Studio. All rights reserved.
 *
 * Created by Manoël Trapier on 11/03/2021.
 */

#ifndef THREEDENGINE_SOURCE_INCLUDE_CAMERA_H
#define THREEDENGINE_SOURCE_INCLUDE_CAMERA_H

#include <vector.h>
#include <matrix.h>

/***********************************************************************************************************************
 * Data types
 **********************************************************************************************************************/
typedef struct camera_t
{
    vec3_t position;
    vec3_t direction;
    vec4_t target;
    vec3_t up;

    double yawAngle;
    double pitchAngle;
} camera_t;

/***********************************************************************************************************************
 * Prototypes
 **********************************************************************************************************************/
void createCamera(camera_t *camera);
void cameraSetTarget(camera_t *camera, vec3_t target);
void cameraSetUp(camera_t *camera, vec3_t up);

void cameraSetDirection(camera_t *camera, vec3_t direction);
void cameraMoveForward(camera_t *camera, double distance);
void cameraMoveBackward(camera_t *camera, double distance);
void cameraMoveRelative(camera_t *camera, double x, double y, double z);
void cameraRotateBy(camera_t *camera, double yaw, double pitch);

matrix4_t cameraGetViewMatrix(camera_t *camera);

#endif /* THREEDENGINE_SOURCE_INCLUDE_CAMERA_H */
