Lums
Namespaces | Classes | Typedefs | Enumerations | Functions
lm Namespace Reference

The Lums namespace. More...

Namespaces

 Vertex
 Describe a vertex type.
 

Classes

class  Angle
 A class used to represent arbitrary angles. More...
 
class  BaseProvider
 A basic abstract class for providers. More...
 
class  Component
 A class that defines behavior and attributes for a GameObject. More...
 
class  Core
 This class defines a core. More...
 
struct  Event
 A struct describing an event. More...
 
class  Font
 A class describing a font. More...
 
class  GameObject
 A composite class representing any object in a game. More...
 
class  GameState
 This class represents a GameState. More...
 
struct  Glyph
 A struct describing a single character from a font. More...
 
class  Image
 This class represents an image in memory. More...
 
class  Matrix
 A class representing a square matrix. More...
 
class  Music
 A class used to represent music. More...
 
struct  Projection
 An helper struct used to define a projection. More...
 
class  Provider
 A provider for assets that are loaded once. More...
 
struct  Rect
 A struct defining a rectangle. More...
 
class  Sfx
 A class used to represent sound effect. More...
 
class  Shader
 A class representing a shader. More...
 
class  ShaderPipeline
 A class describing a chain of shaders. More...
 
class  ShaderProgram
 A class representing a linked shader. More...
 
class  Singleton
 An helper template for creating singletons. More...
 
class  Sound
 An abstract class for sounds. More...
 
class  Sprite
 A class representing a sprite. More...
 
class  SpriteBatch
 A class representing a dynamic batch of bidimensional graphical elements. More...
 
class  StaticSpriteBatch
 A class representing a static batch of bidimensional graphical elements. More...
 
class  StreamProvider
 A provider for assets that are loaded and unloaded at runtime. More...
 
class  Texture
 A class representing a texture in the GPU. More...
 
class  Vector
 A class representing a Vector. More...
 
class  VertexBuffer
 A class representing a buffer of vertices. More...
 
class  Window
 This class defines a Window. More...
 

Typedefs

using VertexBufferP2T2C4 = VertexBuffer< Vertex::Position, 2, Vertex::Texture, 2, Vertex::Color, 4 >
 
using VertexBufferP3C4 = VertexBuffer< Vertex::Position, 3, Vertex::Color, 4 >
 
using Matrix4f = Matrix< 4, float >
 
using Rect2f = Rect2< float >
 
using Rect2i = Rect2< int >
 
using Vector2f = Vector2< float >
 
using Vector2i = Vector2< int >
 
using Vector2b = Vector2< bool >
 
using Vector2a = Vector2< Angle >
 
using Vector3f = Vector3< float >
 
using Vector3i = Vector3< int >
 
using Vector3b = Vector3< bool >
 
using Vector3a = Vector3< Angle >
 
using Vector4f = Vector4< float >
 
using Vector4i = Vector4< int >
 
using Vector4b = Vector4< bool >
 
using Vector4a = Vector4< Angle >
 
using ShaderProvider = Provider< ShaderProgram >
 
using ImageProvider = StreamProvider< Image >
 
using TextureProvider = StreamProvider< Texture >
 
using FontProvider = StreamProvider< Font >
 
using SfxProvider = StreamProvider< Sfx >
 
using MusicProvider = StreamProvider< Music >
 

Enumerations

enum  Key
 A class representing a simple key via its scancode.
 
enum  Module { Core, Graphics, Audio, All }
 

Functions

constexpr std::size_t sym (const char *str)
 
Matrix4f frustum (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat znear, GLfloat zfar)
 
Matrix4f perspective (GLfloat fov, GLfloat aspect, GLfloat znear, GLfloat zfar)
 
Matrix4f ortho (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top)
 
void translate (Matrix4f &matrix, GLfloat x, GLfloat y, GLfloat z)
 
void translate (Matrix4f &matrix, Vector3f vec)
 
void rotate (Matrix4f &matrix, float angle, Vector3f v)
 
Matrix4f lookAt (Vector3f eye, Vector3f center, Vector3f up)
 
template<typename T >
void uniform (ShaderProgram &program, const char *name, T &value)
 
template<typename... Modules>
void enableModule (Module module, Modules...modules)
 
template<std::size_t N, typename T >
float squareDist (const Vector< N, T > &v1, const Vector< N, T > &v2)
 
template<std::size_t N, typename T >
float dist (const Vector< N, T > &v1, const Vector< N, T > &v2)
 
template<std::size_t N, typename T >
float squareLength (const Vector< N, T > &vect)
 
template<std::size_t N, typename T >
float length (const Vector< N, T > &vect)
 
template<std::size_t N, typename T >
Vector< N, T > normal (const Vector< N, T > &vect)
 
template<typename T >
Vector3< T > cross (const Vector3< T > &u, const Vector3< T > &v)
 
template<std::size_t N, typename T >
dot (const Vector< N, T > &lhs, const Vector< N, T > &rhs)
 
template<std::size_t N, typename T >
bool null (const Vector< N, T > &vect)
 
template<std::size_t N, typename T >
Matrix< N, T > operator* (const Matrix< N, T > &lhs, const Matrix< N, T > &rhs)
 
template<std::size_t N, typename T >
Matrix< N, T > operator* (const Matrix< N, T > &lhs, T rhs)
 
template<std::size_t N, typename T >
Matrix< N, T > operator* (T lhs, const Matrix< N, T > &rhs)
 
template<std::size_t N, typename T >
Vector< N, T > & operator+= (Vector< N, T > &lhs, const Vector< N, T > &rhs)
 
template<std::size_t N, typename T >
Vector< N, T > & operator-= (Vector< N, T > &lhs, const Vector< N, T > &rhs)
 
template<std::size_t N, typename T , typename U >
Vector< N, T > & operator*= (Vector< N, T > &lhs, U rhs)
 
template<std::size_t N, typename T , typename U >
Vector< N, T > & operator/= (Vector< N, T > &lhs, U rhs)
 
template<std::size_t N, typename T >
Vector< N, T > operator+ (const Vector< N, T > &lhs, const Vector< N, T > &rhs)
 
template<std::size_t N, typename T >
Vector< N, T > operator- (const Vector< N, T > &lhs, const Vector< N, T > &rhs)
 
template<std::size_t N, typename T >
Vector< N, T > operator* (const Vector< N, T > &lhs, float rhs)
 
template<std::size_t N, typename T >
Vector< N, T > operator/ (const Vector< N, T > &lhs, float rhs)
 
template<std::size_t N, typename T >
Vector< N, T > operator+ (const Vector< N, T > &vect)
 
template<std::size_t N, typename T >
Vector< N, T > operator- (const Vector< N, T > &vect)
 
const std::string & resourcePath ()
 

Detailed Description

The Lums namespace.

Typedef Documentation

A stream provider for fonts

A stream provider for images

using lm::Matrix4f = typedef Matrix<4, float>

A 4x4 float matrix

A stream provider for musics

using lm::Rect2f = typedef Rect2<float>

A rectangle of floats

using lm::Rect2i = typedef Rect2<int>

A rectangle of ints

A stream provider for sound effects

A provider for shader programs

A stream provider for textures

using lm::Vector2a = typedef Vector2<Angle>

A 2D vector of angles

using lm::Vector2b = typedef Vector2<bool>

A 2D vector of bools

using lm::Vector2f = typedef Vector2<float>

A 2D vector of floats

using lm::Vector2i = typedef Vector2<int>

A 2D vector of ints

using lm::Vector3a = typedef Vector3<Angle>

A 3D vector of angles

using lm::Vector3b = typedef Vector3<bool>

A 3D vector of bools

using lm::Vector3f = typedef Vector3<float>

A 3D vector of floats

using lm::Vector3i = typedef Vector3<int>

A 3D vector of ints

using lm::Vector4a = typedef Vector4<Angle>

A 4D vector of angles

using lm::Vector4b = typedef Vector4<bool>

A 4D vector of bools

using lm::Vector4f = typedef Vector4<float>

A 4D vector of floats

using lm::Vector4i = typedef Vector4<int>

A 4D vector of ints

using lm::VertexBufferP2T2C4 = typedef VertexBuffer<Vertex::Position, 2, Vertex::Texture, 2, Vertex::Color, 4>

A vertex buffer with 2 values for position, 2 for texture, and 4 for color

using lm::VertexBufferP3C4 = typedef VertexBuffer<Vertex::Position, 3, Vertex::Color, 4>

A vertex buffer with 3 values for position, and 4 for color

Enumeration Type Documentation

enum lm::Module
strong

This enum defines a Module. A module can be loaded using enableModule().

Function Documentation

template<typename T >
Vector3<T> lm::cross ( const Vector3< T > &  u,
const Vector3< T > &  v 
)

Compute the cross product between two vectors

Parameters
uThe first vector
vThe second vector
Returns
The cross product between two vectors
template<std::size_t N, typename T >
float lm::dist ( const Vector< N, T > &  v1,
const Vector< N, T > &  v2 
)

Compute the distance between two points

Parameters
v1The first point
v2The second point
Returns
The distance between two points
template<std::size_t N, typename T >
T lm::dot ( const Vector< N, T > &  lhs,
const Vector< N, T > &  rhs 
)

Compute the dot product between two vectors

Parameters
lhsThe first vector
rhsThe second vector
Returns
The dot product between two vectors
template<typename... Modules>
void lm::enableModule ( Module  module,
Modules...  modules 
)
inline

Enable one or more modules. You can use the special enum member Module::All to enable every module.

Matrix4f lm::frustum ( GLfloat  left,
GLfloat  right,
GLfloat  bottom,
GLfloat  top,
GLfloat  znear,
GLfloat  zfar 
)
inline

Create a frustum projection matrix

Parameters
leftThe left position
rightThe right position
bottomThe bottom position
topThe top position
znearThe near clipping plane
zfarThe far clipping plane
Returns
A frustum projection matrix
template<std::size_t N, typename T >
float lm::length ( const Vector< N, T > &  vect)

Compute the length of a vector

Parameters
vectThe vector
Returns
The length of the vector
Matrix4f lm::lookAt ( Vector3f  eye,
Vector3f  center,
Vector3f  up 
)
inline

Create a view matrix

Parameters
eyeThe eye position
centerThe field of view center in space coordinates
upThe up vector
Returns
A view matrix
template<std::size_t N, typename T >
Vector<N, T> lm::normal ( const Vector< N, T > &  vect)

Compute the normal of a vector

Parameters
vectThe vector
Returns
The normal of the vector
template<std::size_t N, typename T >
bool lm::null ( const Vector< N, T > &  vect)

Check wether a vector is the null vector

Parameters
vectThe vector
Returns
True if the vector is null
template<std::size_t N, typename T >
Matrix<N, T> lm::operator* ( const Matrix< N, T > &  lhs,
const Matrix< N, T > &  rhs 
)

Multiply two matrices

Parameters
lhsThe left matrix
rhsThe right matrix
Returns
The product of the matrices
template<std::size_t N, typename T >
Matrix<N, T> lm::operator* ( const Matrix< N, T > &  lhs,
rhs 
)

Multiply a matrix and a scalar

Parameters
lhsThe matrix
rhsThe scalar
Returns
The product
template<std::size_t N, typename T >
Matrix<N, T> lm::operator* ( lhs,
const Matrix< N, T > &  rhs 
)

Multiply a matrix and a scalar

Parameters
lhsThe scalar
rhsThe matrix
Returns
The product
template<std::size_t N, typename T >
Vector<N, T> lm::operator* ( const Vector< N, T > &  lhs,
float  rhs 
)

Multiply a vector and a scalar

Parameters
lhsThe vector
rhsThe scalar
Returns
The product
template<std::size_t N, typename T , typename U >
Vector<N, T>& lm::operator*= ( Vector< N, T > &  lhs,
rhs 
)

Multiply and assign a vector and a scalar

Parameters
lhsThe vector
rhsThe scalar
Returns
The vector
template<std::size_t N, typename T >
Vector<N, T> lm::operator+ ( const Vector< N, T > &  lhs,
const Vector< N, T > &  rhs 
)

Add vectors

Parameters
lhsThe first vector
rhsThe second vector
Returns
The sum
template<std::size_t N, typename T >
Vector<N, T> lm::operator+ ( const Vector< N, T > &  vect)

Unary plus

Parameters
vectA vector
Returns
The same vector
template<std::size_t N, typename T >
Vector<N, T>& lm::operator+= ( Vector< N, T > &  lhs,
const Vector< N, T > &  rhs 
)

Add and assign vectors

Parameters
lhsThe first vector
rhsThe second vector
Returns
The first vector
template<std::size_t N, typename T >
Vector<N, T> lm::operator- ( const Vector< N, T > &  lhs,
const Vector< N, T > &  rhs 
)

Substract vectors

Parameters
lhsThe first vector
rhsThe second vector
Returns
The difference
template<std::size_t N, typename T >
Vector<N, T> lm::operator- ( const Vector< N, T > &  vect)

Unary minus

Parameters
vectA vector
Returns
The opposite vector
template<std::size_t N, typename T >
Vector<N, T>& lm::operator-= ( Vector< N, T > &  lhs,
const Vector< N, T > &  rhs 
)

Substract and assign vectors

Parameters
lhsThe first vector
rhsThe second vector
Returns
The first vector
template<std::size_t N, typename T >
Vector<N, T> lm::operator/ ( const Vector< N, T > &  lhs,
float  rhs 
)

Divide and assign a vector and a scalar

Parameters
lhsThe vector
rhsThe scalar
Returns
The quotient
template<std::size_t N, typename T , typename U >
Vector<N, T>& lm::operator/= ( Vector< N, T > &  lhs,
rhs 
)

Divide and assign a vector and a scalar

Parameters
lhsThe vector
rhsThe scalar
Returns
The vector
Matrix4f lm::ortho ( GLfloat  left,
GLfloat  right,
GLfloat  bottom,
GLfloat  top 
)
inline

Create a orthogonal projection matrix

Parameters
leftThe left position
rightThe right position
bottomThe bottom position
topThe top position
Returns
A orthogonal projection matrix
Matrix4f lm::perspective ( GLfloat  fov,
GLfloat  aspect,
GLfloat  znear,
GLfloat  zfar 
)
inline

Create a perspective projection matrix

Parameters
fovThe field of view in degrees
aspectThe aspect ratio
znearThe near clipping plane
zfarThe far clipping plane
Returns
A perspective projection matrix
const std::string& lm::resourcePath ( )

Get the program resource path. On Mac OS X, this is the Resource folder if the program is a bundle. Else, it's the folder containing the executable.

Returns
A const reference to a resource path string.
void lm::rotate ( Matrix4f matrix,
float  angle,
Vector3f  v 
)
inline

Rotate a matrix by an angle around a vector

Parameters
matrixThe matrix to be rotated
angleThe angle in degrees
vThe up vector
template<std::size_t N, typename T >
float lm::squareDist ( const Vector< N, T > &  v1,
const Vector< N, T > &  v2 
)

Compute the square distance between two points

Parameters
v1The first point
v2The second point
Returns
The square distance between two points
template<std::size_t N, typename T >
float lm::squareLength ( const Vector< N, T > &  vect)

Compute the square length of a vector

Parameters
vectThe vector
Returns
The square length of the vector
constexpr std::size_t lm::sym ( const char *  str)
inline

Return a hash from a string. This function can be used to compute compile-time hashes.

Parameters
strThe string to be hashed.
Returns
A hash
void lm::translate ( Matrix4f matrix,
GLfloat  x,
GLfloat  y,
GLfloat  z 
)
inline

Translate a matrix by an offset

Parameters
matrixThe matrix to be translated
xThe x offset
yThe y offset
zThe z offset
void lm::translate ( Matrix4f matrix,
Vector3f  vec 
)
inline

Translate a matrix by a vector

Parameters
matrixThe matrix to be translated
vecThe translation vector
template<typename T >
void lm::uniform ( ShaderProgram program,
const char *  name,
T &  value 
)
inline

Set the value of an uniform

Template Parameters
TThe type of the value
Parameters
programThe shader
nameThe uniform name
valueThe value