AGL
A graphics library
aglm.h File Reference

Global utilities and common third party includes. More...

#include <stdio.h>
#include <iostream>
#include <limits>
#include <memory>
#include <random>
#include <cmath>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtx/norm.hpp>
#include <glm/gtx/quaternion.hpp>
#include <glm/gtc/epsilon.hpp>

Go to the source code of this file.

Typedefs

using glm::point3 = glm::vec3
 
using glm::color = glm::vec3
 

Functions

std::ostream & operator<< (std::ostream &o, const glm::mat4 &m)
 Print a matrix. More...
 
std::ostream & operator<< (std::ostream &o, const glm::mat3 &m)
 Print a matrix. More...
 
std::ostream & operator<< (std::ostream &o, const glm::vec3 &v)
 Print a vector. More...
 
std::ostream & operator<< (std::ostream &o, const glm::vec4 &v)
 Print a vector. More...
 
std::ostream & operator<< (std::ostream &o, const glm::vec2 &v)
 Print a vector. More...
 
std::ostream & operator<< (std::ostream &o, const glm::quat &v)
 Print a quaternion. More...
 
float agl::random ()
 Return a random number between 0 and 1 [0, 1)
 
float agl::random (float min, float max)
 Return a random number between min and max [min, max)
 
glm::vec3 agl::randomUnitCube ()
 Return a random direction in a unit cube.
 
glm::vec3 agl::randomUnitSquare ()
 Return a random direction in a unit square in the XY plane.
 
glm::vec3 agl::randomUnitSphere ()
 Return a random direction in a unit sphere.
 
glm::vec3 agl::randomUnitDisk ()
 Return a random direction in a unit disk in the XY plane.
 
glm::vec3 agl::randomHemisphere (const glm::vec3 &normal)
 Generate random direction in hemisphere around normal. More...
 
glm::vec3 agl::randomUnitVector ()
 Generate random unit vector. More...
 

Variables

const float kPI = glm::pi<float>()
 
const float kINFINITY = std::numeric_limits<float>::infinity()
 

Detailed Description

Global utilities and common third party includes.

Function Documentation

◆ operator<<() [1/6]

std::ostream& operator<< ( std::ostream &  o,
const glm::mat3 &  m 
)

Print a matrix.

std::cout << mat3(1.0) << std::endl;

◆ operator<<() [2/6]

std::ostream& operator<< ( std::ostream &  o,
const glm::mat4 &  m 
)

Print a matrix.

std::cout << mat4(1.0) << std::endl;

◆ operator<<() [3/6]

std::ostream& operator<< ( std::ostream &  o,
const glm::quat &  v 
)

Print a quaternion.

quat q(m);
std::cout << q << std::endl;

◆ operator<<() [4/6]

std::ostream& operator<< ( std::ostream &  o,
const glm::vec2 &  v 
)

Print a vector.

std::cout << vec2(-2.0, 1.0) << std::endl;

◆ operator<<() [5/6]

std::ostream& operator<< ( std::ostream &  o,
const glm::vec3 &  v 
)

Print a vector.

std::cout << vec3(1.0, -3.0, 50.0) << std::endl;

◆ operator<<() [6/6]

std::ostream& operator<< ( std::ostream &  o,
const glm::vec4 &  v 
)

Print a vector.

std::cout << vec4(0.2, 0.3, 0.8, 1.0) << std::endl;

◆ randomHemisphere()

glm::vec3 agl::randomHemisphere ( const glm::vec3 &  normal)
inline

Generate random direction in hemisphere around normal.

Author
Peter Shirley https://raytracing.github.io/books/RayTracingInOneWeekend.html

◆ randomUnitVector()

glm::vec3 agl::randomUnitVector ( )
inline

Generate random unit vector.

Author
Peter Shirley https://raytracing.github.io/books/RayTracingInOneWeekend.html