Carpenter Engine
A C++ game engine with a build once run anywhere solution
Loading...
Searching...
No Matches
Classes | Enumerations | Functions
Utils.hpp File Reference

A collection of utilities for the game engine code. More...

Go to the source code of this file.

Classes

struct  Engine::Vec2f
 A 2D vector struct with overloaded operators. More...
 
struct  Engine::Vec3f
 A 3D vector struct with overloaded operators. More...
 
struct  Engine::Color
 A color struct with 4 components: RGBA. More...
 

Enumerations

enum  Engine::Success { FAILURE = -1 , SUCCESS = -2 , WARNING = -3 }
 A generic success type. More...
 

Functions

Vec2f Engine::Rotate (Vec2f v, float angle)
 Rotates a 2D vector by an angle.
 
Vec3f Engine::Rotate (Vec3f v, Vec3f angle)
 Rotates a 3D vector in three dimensions.
 
float Engine::InvSQRT (float x)
 returns the inverse square root of a float
 

Detailed Description

A collection of utilities for the game engine code.

Author
Roberto Selles

Enumeration Type Documentation

◆ Success

A generic success type.

A generic success type that determines the stabitility of the code. This is recommended to be used as voids that need to check for errors without using try/catch blocks

  • SUCCESS - The method was run successfully
  • FAILURE - The method failed to run
  • WARNING - The method was run successfully but with warnings
Author
Roberto Selles

Function Documentation

◆ InvSQRT()

float Engine::InvSQRT ( float  x)

returns the inverse square root of a float

TODO: Use SIMD Instrinsics to accelerate the calculation

Parameters
xThe float to take the inverse square root of
Returns
The inverse square root

◆ Rotate() [1/2]

Engine::Vec2f Engine::Rotate ( Vec2f  v,
float  angle 
)

Rotates a 2D vector by an angle.

Parameters
vThe vector to rotate
angleThe angle to rotate by
Returns
The rotated vector

◆ Rotate() [2/2]

Engine::Vec3f Engine::Rotate ( Vec3f  v,
Vec3f  angle 
)

Rotates a 3D vector in three dimensions.

Parameters
vThe vector to rotate
angleThe angles to rotate by
Returns
The rotated vector