2021-01-26 23:28:20 -06:00
|
|
|
/**
|
|
|
|
@file
|
|
|
|
@author Dane Johnson <dane@danejohnson.org>
|
|
|
|
|
|
|
|
@section LICENSE
|
|
|
|
|
|
|
|
Couch Copyright (C) 2021 Dane Johnson
|
|
|
|
|
|
|
|
This program comes with ABSOLUTELY NO WARRANTY; without event the
|
|
|
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the GNU General Public License for details at
|
|
|
|
https://www.gnu.org/licenses/gpl-3.0.html
|
|
|
|
|
|
|
|
This is free software, and you are welcome to redistribute it
|
|
|
|
under the terms of the GNU General Public License as published
|
|
|
|
by the Free Software Foundation; either version 3 of the License,
|
|
|
|
or (at your option) any later version.
|
|
|
|
|
|
|
|
@section DESCRIPTION
|
|
|
|
|
|
|
|
A transform represents various aspects of 3d space.
|
|
|
|
*/
|
2021-01-12 14:09:38 -06:00
|
|
|
#ifndef TRANSFORM_H
|
|
|
|
#define TRANSFORM_H
|
|
|
|
|
|
|
|
#include "types.h"
|
|
|
|
|
2021-01-26 23:28:20 -06:00
|
|
|
/**
|
|
|
|
A Transform represents a position, rotation, and scale in 3D space.
|
|
|
|
*/
|
2021-01-12 14:09:38 -06:00
|
|
|
struct Transform {
|
2021-01-13 10:42:57 -06:00
|
|
|
Transform();
|
2021-01-13 20:08:39 -06:00
|
|
|
Transform(Vector3 position, Vector3 rotation);
|
2021-01-20 17:18:39 -06:00
|
|
|
Transform(Vector3 position, Vector3 rotation, Vector3 scale);
|
2021-01-26 23:28:20 -06:00
|
|
|
/**
|
|
|
|
The position, according to the left-hand rule
|
|
|
|
*/
|
2021-01-13 10:42:57 -06:00
|
|
|
Vector3 position;
|
2021-01-26 23:28:20 -06:00
|
|
|
/**
|
|
|
|
The rotation, in Euler angles
|
|
|
|
*/
|
2021-01-13 20:08:39 -06:00
|
|
|
Vector3 rotation;
|
2021-01-26 23:28:20 -06:00
|
|
|
/**
|
|
|
|
Scaling along the specified axis
|
|
|
|
*/
|
2021-01-20 17:18:39 -06:00
|
|
|
Vector3 scale;
|
2021-01-26 23:28:20 -06:00
|
|
|
/**
|
|
|
|
Returns a vector that is -Z, rotated by @ref rotation.
|
|
|
|
*/
|
2021-01-15 17:51:19 -06:00
|
|
|
Vector3 Forward();
|
2021-01-26 23:28:20 -06:00
|
|
|
/**
|
|
|
|
Returns a vector that is +X, rotated by @ref rotation.
|
|
|
|
*/
|
2021-01-21 11:12:45 -06:00
|
|
|
Vector3 Right();
|
2021-01-26 23:28:20 -06:00
|
|
|
/**
|
|
|
|
Returns a vector that is +Y, rotated by @ref rotation.
|
|
|
|
*/
|
2021-01-21 11:12:45 -06:00
|
|
|
Vector3 Up();
|
2021-01-26 23:28:20 -06:00
|
|
|
/**
|
|
|
|
Returns a matrix that, when multiplied by a @ref Vector3
|
|
|
|
gives a Vector rotated by @ref rotation
|
|
|
|
*/
|
2021-01-21 11:12:45 -06:00
|
|
|
Matrix RotationMatrix();
|
2021-01-13 10:42:57 -06:00
|
|
|
};
|
2021-01-12 14:09:38 -06:00
|
|
|
|
|
|
|
#endif /* TRANSFORM_H */
|