68 lines
2.1 KiB
C
68 lines
2.1 KiB
C
// Copyright (c) 2021 Dominic Msters
|
|
//
|
|
// This software is released under the MIT License.
|
|
// https://opensource.org/licenses/MIT
|
|
|
|
#pragma once
|
|
#include <dawn/dawn.h>
|
|
#include "matrix.h"
|
|
|
|
/**
|
|
* Make a camera look at a position in world space while itself being positioned
|
|
* within world space.
|
|
*
|
|
* @param camera The camera to position.
|
|
* @param x The X position in world space of the camera.
|
|
* @param y The Y position in world space of the camera.
|
|
* @param z The Z position in world space of the camera.
|
|
* @param targetX The Target X position in world space of the camera.
|
|
* @param targetY The Target Y position in world space of the camera.
|
|
* @param targetZ The Target Z position in world space of the camera.
|
|
*/
|
|
void cameraLookAt(camera_t *camera,
|
|
float x, float y, float z,
|
|
float targetX, float targetY, float targetZ
|
|
);
|
|
|
|
/**
|
|
* Make a camera look in a direction based on a rotation direction.
|
|
*
|
|
* @param camera The camera to position.
|
|
* @param x The X position in world space of the camera.
|
|
* @param y The Y position in world space of the camera.
|
|
* @param z The Z position in world space of the camera.
|
|
* @param pitch The pitch of the camera.
|
|
* @param yaw The yaw of the camera.
|
|
* @param roll The roll of the camera.
|
|
*/
|
|
void cameraLook(camera_t *camera,
|
|
float x, float y, float z,
|
|
float pitch, float yaw, float roll
|
|
);
|
|
|
|
/**
|
|
* Make a camera's projection be a 3D Perspective view.
|
|
*
|
|
* @param camera The camera to project.
|
|
* @param fov The field of view of the camera (in degrees).
|
|
* @param aspect The aspect ratio of the camera (w / h)
|
|
* @param near The near plane clip.
|
|
* @param far the far plane clip.
|
|
*/
|
|
void cameraPerspective(camera_t *camera,
|
|
float fov, float aspect, float near, float far
|
|
);
|
|
|
|
/**
|
|
* Defines an orthorgonal camera matrix.
|
|
*
|
|
* @param camera Camera to position.
|
|
* @param left The left side of the viewport.
|
|
* @param right The right side of the viewport.
|
|
* @param bottom The bottom side of the viewport.
|
|
* @param near The near plane clip.
|
|
* @param far the far plane clip.
|
|
*/
|
|
void cameraOrtho(camera_t *camera,
|
|
float left, float right, float bottom, float top, float near, float far
|
|
); |