Allolib  1.0
C++ Components For Interactive Multimedia
al Namespace Reference

Namespaces

 ipl
 Utilities for interpolation.
 
 osc
 Open Sound Control (OSC) utilities.
 
 rnd
 Random number generation utilities.
 

Classes

class  App
 Simple App class. More...
 
class  RecordingDomain
 
class  AppRecorder
 Simple App class. More...
 
class  AudioDomain
 AsynchronousDomain class. More...
 
class  GammaAudioDomain
 
class  ComputationDomain
 ComputationDomain class. More...
 
class  SynchronousDomain
 
class  AsynchronousDomain
 
class  ConsoleDomain
 ConsoleDomain class. More...
 
class  AudioControl
 
class  DistributedApp
 DistributedApp class. More...
 
class  DistributedAppWithState
 
class  FPS
 FPS class. More...
 
struct  NodeConfiguration
 The NodeConfiguration struct describes a distributed node and its capabilities. More...
 
class  GLFWOpenGLOmniRendererDomain
 GLFWOpenGLOmniRendererDomain class. More...
 
struct  WindowSetupProperties
 
class  OpenGLGraphicsDomain
 OpenGLGraphicsDomain class. More...
 
class  GLFWOpenGLWindowDomain
 Domain for a GLFW window. More...
 
class  OSCDomain
 OSCDomain class. More...
 
class  SimulationDomain
 Basic simulation domain providing a simulationFunction. More...
 
class  StateSimulationDomain
 
struct  DefaultState
 
class  StateReceiveDomain
 
class  StateSendDomain
 
class  StateDistributionDomain
 Domain for distributing state for a simulation domain. More...
 
class  BufferObject
 
struct  ShaderSources
 
struct  EasyFBOSetting
 
class  EasyFBO
 Encapsulates FBO, depth buffer, and texture. More...
 
struct  EasyVAO
 EasyVAO class. More...
 
class  RBO
 Render buffer object class. More...
 
class  FBO
 Frame buffer object class. More...
 
struct  Font
 Interface for loading fonts and rendering text. More...
 
struct  FontRenderer
 Convenience class to simplify rendering text. More...
 
class  GPUObject
 
class  Graphics
 Interface for loading fonts and rendering text. More...
 
struct  Image
 Interface for loading image files. More...
 
class  Isosurface
 Isosurface generated using marching cubes. More...
 
class  Lens
 
struct  Light
 Light class. More...
 
struct  Material
 Material class. More...
 
class  Mesh
 Stores buffers related to rendering graphical objects. More...
 
class  MatrixStack
 MatrixStack class. More...
 
class  ViewportStack
 ViewportStack class. More...
 
class  FBOStack
 
class  RenderManager
 RenderManager class. More...
 
class  ShaderBase
 
class  Shader
 Shader object. More...
 
class  ShaderProgram
 Shader program object. More...
 
class  Texture
 
class  VAO
 VAO class. More...
 
class  VAOMesh
 VAOMesh classStores gpu objects as shared pointer to that this class can be copied for moved this is useful for storing this class in std::vector, etc. More...
 
struct  Viewport
 
class  Viewpoint
 Viewpoint within a scene. More...
 
class  Arduino
 Arduino class. More...
 
class  AudioBackend
 
class  AudioDevice
 
class  AudioIO
 
class  AudioDeviceInfo
 
class  AudioIOData
 
class  AudioCallback
 
class  Nav
 
class  NavInputControl
 
class  CSVReader
 The CSVReader class reads simple CSV files. More...
 
class  FilePath
 
class  File
 File. More...
 
class  PushDirectory
 
class  Dir
 
class  FileList
 
class  SearchPaths
 
class  MIDIByte
 
class  MIDIMessage
 
class  MIDIMessageHandler
 
class  PersistentConfig
 The PersistentConfig class allows easy sotrage of persisitent values. More...
 
class  Socket
 
class  SocketClient
 Client socket. More...
 
class  SocketServer
 Server socket. More...
 
struct  TomlLoader
 TomlLoader class. More...
 
class  Keyboard
 
class  Mouse
 
class  WindowEventHandler
 Controller for handling input and window events. More...
 
class  Window
 Window with OpenGL context. More...
 
class  MinMeanMax
 
class  Complex
 
class  Polar
 
class  Frustum
 Rectangular frustum. More...
 
class  Interval
 A closed interval [min, max]. More...
 
class  Mat
 Fixed-size n-by-n square matrix. More...
 
struct  MatNoInit
 Flag type to prevent element initialization.
 
class  Matrix4
 
class  Plane
 
class  Quat
 
class  StdRnd
 
class  Ray
 
class  SphereCoord
 Spherical coordinate in terms of two complex numbers. More...
 
class  SphericalHarmonic
 Spherical harmonic evaluator using cached coefficients. More...
 
class  rand_uniformi
 
class  rand_uniformf
 
class  rand_poisson
 
class  rand_exponential
 
class  rand_normal
 
class  Vec
 Fixed-size n-vector. More...
 
struct  VecElems
 
struct  VecElems< 0, T >
 
struct  VecElems< 1, T >
 
struct  VecElems< 2, T >
 
struct  VecElems< 3, T >
 
struct  VecElems< 4, T >
 
class  Message
 
class  CommandConnection
 
class  CommandServer
 
class  CommandClient
 
struct  Serializer
 The Serializer struct. More...
 
struct  Deserializer
 The Deserializer struct. More...
 
class  DistributedScene
 The DistributedScene class. More...
 
class  PositionedVoice
 A PositionedVoice is a rendering class that can have a position and size. More...
 
struct  UpdateThreadFuncData
 
class  ThreadPool
 
class  DynamicScene
 The DynamicScene class. More...
 
class  SynthVoice
 The SynthVoice class. More...
 
class  PolySynth
 A PolySynth manages polyphony and rendering of SynthVoice instances. More...
 
class  SequencerMIDI
 The SequencerMIDI class connects PolySynth objects to MIDI messages. More...
 
class  SynthRecorder
 The SynthRecorder class records the events arriving at a PolySynth. More...
 
class  SynthSequencerEvent
 SynthSequencerEvent class. More...
 
struct  SynthEvent
 
class  SynthSequencer
 Event Sequencer triggering audio visual "notes". More...
 
class  AmbiBase
 
class  AmbiDecode
 
class  AmbiEncode
 
class  AmbisonicsSpatializer
 
struct  BiquadData
 
class  BiQuad
 The BiQuad class. More...
 
class  BiQuadNX
 
class  Crossover
 
class  Dbap
 
class  LdapRing
 
class  Lbap
 
class  StaticDelayLine
 Delay-line whose maximum size is fixed. More...
 
class  Reverb
 Plate reverberator. More...
 
struct  SoundFile
 Read sound file and store the data in float array (interleaved) More...
 
struct  SoundFilePlayer
 Soundfile player class. More...
 
class  SoundFileStreaming
 The SoundFileStreaming class provides reading soundifle directly from disk one buffer at a time. More...
 
struct  SoundFilePlayerTS
 Soundfile player class with thread-safe access to playback controls. More...
 
class  Spatializer
 
class  Speaker
 
class  SpeakerDistanceGainAdjustment
 Adjust the gain of speakers based on distance. More...
 
class  SpeakerDistanceGainAdjustmentProcessor
 This class is added for convenience to append it to AudioIO processing. More...
 
class  SpeakerDistanceTimeAdjustment
 
class  SpeakerDistanceTimeAdjustmentProcessor
 
class  StereoPanner
 The StereoPanner class. More...
 
struct  SpeakerTriple
 A triplet of speakers. More...
 
class  Vbap
 
struct  Frenet
 Frenet frame generator. More...
 
class  DistAtten
 
class  HashSpace
 The HashSpace class. More...
 
class  Pose
 A local coordinate frame. More...
 
class  SmoothPose
 A Smoothed Pose. More...
 
struct  bhlw
 
class  PerProjectionRenderConstants
 
class  ProjectionViewport
 
class  WarpBlendData
 
class  PerProjectionRender
 
class  PeriodicThread
 Thread that calls a function periodically. More...
 
struct  ThreadFunction
 Function object interface used by thread. More...
 
struct  CThreadFunction
 C-style thread function with user data. More...
 
class  Thread
 
class  Threads
 
class  Timer
 
class  DelayLockedLoop
 Self-correcting timer. More...
 
class  Clock
 
class  Watcher
 
class  RingBuffer
 Ring buffer. More...
 
class  ShiftBuffer
 Constant size shift buffer. More...
 
struct  Color
 
struct  Colori
 
struct  HSV
 Color represented by hue, saturation, and value. More...
 
struct  RGB
 Color represented by red, green, and blue components. More...
 
struct  CIE_XYZ
 
struct  Lab
 
struct  HCLab
 
struct  Luv
 
struct  HCLuv
 
struct  Twiddle
 Union for twiddling bits of floats. More...
 
struct  Twiddle< float >
 
struct  Twiddle< double >
 
class  SingleRWRingBuffer
 
struct  ValueSource
 
struct  MRCHeader
 
class  Voxels
 
struct  BoundingBoxData
 
struct  BoundingBox
 
class  CompositionStep
 
class  Composition
 
class  GUIMarker
 
class  ControlGUI
 The ControlGUI class. More...
 
class  Dialog
 
class  DiscreteParameterValues
 
class  FileSelector
 
struct  Gnomon
 
class  HtmlInterfaceServer
 The HtmlInterfaceServer class runs an interface.simpleserver.js server and builds the html interface for the registered set of controllers and presets. More...
 
class  ParameterField
 
class  ParameterMeta
 The ParameterMeta class defines the base interface for Parameter metadata. More...
 
class  ParameterWrapper
 The ParameterWrapper class provides a generic thread safe Parameter class from the ParameterType template parameter. More...
 
class  Parameter
 The Parameter class. More...
 
class  ParameterInt
 
class  ParameterBool
 
class  Trigger
 
class  ParameterString
 
class  ParameterVec3
 
class  ParameterVec4
 
class  ParameterPose
 
class  ParameterMenu
 
class  ParameterChoice
 A parameter representing selected items from a list. More...
 
class  ParameterColor
 
class  ParameterBundle
 
class  ParameterGUI
 
class  BundleGUIManager
 
class  SynthGUIManager
 
class  ParameterMIDI
 The ParameterMIDI class connects Parameter objects to MIDI messages. More...
 
class  OSCNode
 
class  OSCNotifier
 
class  ParameterServer
 The ParameterServer class creates an OSC server to receive parameter values. More...
 
struct  PickEvent
 
struct  Hit
 
struct  Pickable
 
struct  PickableBB
 
class  PickableManager
 
struct  PickableRotateHandle
 
class  PresetHandler
 The PresetHandler class handles sorting and recalling of presets. More...
 
class  PresetMapper
 The PresetMapper class allows archiving and recalling preset maps. More...
 
class  PresetMIDI
 The PresetMIDI class connects PresetHandler objects to MIDI messages. More...
 
class  PresetSequencer
 The PresetSequencer class allows triggering presets from a PresetHandler over time. More...
 
class  PresetServer
 
class  SequenceRecorder
 The SequenceRecorder class records preset changes in a ".sequence" file. More...
 
class  SequenceServer
 

Typedefs

typedef void(* audioCallback) (AudioIOData &io)
 Audio callback type.
 
typedef Polar< float > Polarf
 
typedef Polar< double > Polard
 
typedef Complex< float > Complexf
 
typedef Complex< double > Complexd
 
typedef Frustum< double > Frustumd
 Double precision frustrum.
 
typedef Mat< 2, float > Mat2f
 float 2x2 matrix
 
typedef Mat< 2, double > Mat2d
 double 2x2 matrix
 
typedef Mat< 2, int > Mat2i
 integer 2x2 matrix
 
typedef Mat< 3, float > Mat3f
 float 3x3 matrix
 
typedef Mat< 3, double > Mat3d
 double 3x3 matrix
 
typedef Mat< 3, int > Mat3i
 integer 3x3 matrix
 
typedef Mat< 4, float > Mat4f
 float 4x4 matrix
 
typedef Mat< 4, double > Mat4d
 double 4x4 matrix
 
typedef Mat< 4, int > Mat4i
 integer 4x4 matrix
 
typedef Matrix4< double > Matrix4d
 Double-precision 4-by-4 matrix.
 
typedef Matrix4< float > Matrix4f
 Single-precision 4-by-4 matrix.
 
typedef Quat< float > Quatf
 Single-precision quaternion.
 
typedef Quat< double > Quatd
 Double-precision quaternion.
 
using StdRandom = al::rnd::Random< StdRnd >
 
typedef Ray< float > Rayf
 
typedef Ray< double > Rayd
 
typedef SphereCoord< float > SphereCoordf
 float SphereCoord
 
typedef SphereCoord< double > SphereCoordd
 double SphereCoord
 
typedef Vec< 2, float > Vec2f
 float 2-vector
 
typedef Vec< 2, double > Vec2d
 double 2-vector
 
typedef Vec< 2, int > Vec2i
 integer 2-vector
 
typedef Vec< 3, float > Vec3f
 float 3-vector
 
typedef Vec< 3, double > Vec3d
 double 3-vector
 
typedef Vec< 3, int > Vec3i
 integer 3-vector
 
typedef Vec< 4, float > Vec4f
 float 4-vector
 
typedef Vec< 4, double > Vec4d
 double 4-vector
 
typedef Vec< 4, int > Vec4i
 integer 4-vector
 
typedef std::vector< SpeakerSpeakers
 A set of speakers.
 
typedef int UnitsTy
 

Enumerations

enum  Capability {
  CAP_NONE = 0 , CAP_SIMULATOR = 1 << 1 , CAP_RENDERING = 1 << 2 , CAP_OMNIRENDERING = 1 << 3 ,
  CAP_AUDIO_IO = 1 << 4 , CAP_OSC = 1 << 5 , CAP_CONSOLE_IO = 1 << 6 , CAP_2DGUI = 1 << 7 ,
  CAP_STATE_SEND = 1 << 8 , CAP_USER = 1 << 10
}
 
enum class  ShaderType : unsigned char {
  COLOR , MESH , TEXTURE , LIGHTING_COLOR ,
  LIGHTING_MESH , LIGHTING_TEXTURE , LIGHTING_MATERIAL
}
 
enum  AttribLayout : unsigned int { ATTRIB_POSITION = 0 , ATTRIB_COLOR = 1 , ATTRIB_TEXCOORD_2D = 2 , ATTRIB_NORMAL = 3 }
 
enum  SynthEventType { TRIGGER_ON , TRIGGER_OFF , PARAMETER_CHANGE }
 
enum  BIQUADTYPE {
  BIQUAD_LPF , BIQUAD_HPF , BIQUAD_BPF , BIQUAD_NOTCH ,
  BIQUAD_PEQ , BIQUAD_LSH , BIQUAD_HSH
}
 
enum  AttenuationLaw { ATTEN_NONE = 0 , ATTEN_LINEAR , ATTEN_INVERSE , ATTEN_INVERSE_SQUARE }
 Distance to attenuation laws. More...
 
enum  VoxelUnits {
  VOX_PICOMETERS = -12 , VOX_ANGSTROMS = -10 , VOX_NANOMETERS = -9 , VOX_MICROMETERS = -6 ,
  VOX_MILLIMETERS = -3 , VOX_CENTIMETERS = -2 , VOX_METERS = 0 , VOX_KILOMETERS = 3
}
 
enum  MRCMode {
  MRC_IMAGE_SINT8 = 0 , MRC_IMAGE_SINT16 = 1 , MRC_IMAGE_FLOAT32 = 2 , MRC_TRANSFORM_INT16 = 3 ,
  MRC_TRANSFORM_FLOAT32 = 4 , MRC_IMAGE_UINT16 = 6
}
 
enum class  TimeMasterMode {
  TIME_MASTER_AUDIO , TIME_MASTER_GRAPHICS , TIME_MASTER_UPDATE , TIME_MASTER_FREE ,
  TIME_MASTER_CPU
}
 
enum  PickEventType {
  Point , Pick , PickPose , Unpick ,
  Drag , TranslateRay , RotateRay , RotateRayTrackball ,
  RotateTurntable , RotatePose , Scale
}
 

Functions

void compileDefaultShader (ShaderProgram &s, ShaderType type, bool is_omni=false)
 
std::string multilight_vert_shader (ShaderType type, int num_lights, bool is_omni=false)
 
std::string multilight_frag_shader (ShaderType type, int num_lights)
 
void compileMultiLightShader (ShaderProgram &s, ShaderType type, int num_lights, bool is_omni=false)
 
const char * shaderVersionString (int major, int minor)
 
const char * stereoVertexDisplaceFunctionString (bool isOmni)
 
std::string vertexShaderStringP (int major, int minor, bool isStereo, bool isOmni, bool doLighting)
 
std::string vertexShaderStringPC (int major, int minor, bool isStereo, bool isOmni, bool doLighting)
 
std::string vertexShaderStringPT (int major, int minor, bool isStereo, bool isOmni, bool doLighting)
 
std::string fragShaderStringU (int major, int minor, bool doLighting)
 
std::string fragShaderStringC (int major, int minor, bool doLighting)
 
std::string fragShaderStringT (int major, int minor, bool doLighting)
 
ShaderSources defaultShaderUniformColor (bool isStereo, bool isOmni, bool doLighting)
 
ShaderSources defaultShaderVertexColor (bool isStereo, bool isOmni, bool doLighting)
 
ShaderSources defaultShaderTextureColor (bool isStereo, bool isOmni, bool doLighting)
 
int addTetrahedron (Mesh &m, float radius=1)
 Add tetrahedron as indexed triangles. More...
 
int addCube (Mesh &m, bool withNormalsAndTexcoords=false, float radius=M_SQRT_1_3)
 Add cube as indexed triangles. More...
 
int addOctahedron (Mesh &m, float radius=1)
 Add octahedron as triangle vertices and indices. More...
 
int addDodecahedron (Mesh &m, float radius=1)
 Add dodecahedron as indexed triangles. More...
 
int addIcosahedron (Mesh &m, float radius=1)
 Add icosahedron as indexed triangles. More...
 
int addIcosphere (Mesh &m, double radius=1, int divisions=2)
 Add sphere produced from subdivided icosahedron as indexed triangles. More...
 
int addSphere (Mesh &m, double radius=1, int slices=16, int stacks=16)
 Add sphere as indexed triangles. More...
 
int addSphereWithTexcoords (Mesh &m, double radius=1, int bands=16)
 
int addWireBox (Mesh &m, float width, float height, float depth)
 Add wireframe box as indexed lines. More...
 
int addWireBox (Mesh &m, float size=1)
 
int addCone (Mesh &m, float radius=1, const Vec3f &apex=Vec3f(0, 0, 2), unsigned slices=16, unsigned cycles=1)
 Add a cone/pyramid as indexed triangles. More...
 
int addDisc (Mesh &m, float radius=1, unsigned slices=16)
 Add a disc/regular polygon as indexed triangles. More...
 
int addPrism (Mesh &m, float btmRadius=1, float topRadius=1, float height=2, unsigned slices=16, float twist=0)
 Add a prism as an indexed triangle strip. More...
 
int addAnnulus (Mesh &m, float inRadius=0.5, float outRadius=1, unsigned slices=16, float twist=0)
 Add an annulus ("little ring") as an indexed triangle strip. More...
 
int addCylinder (Mesh &m, float radius=1, float height=2, unsigned slices=16, float twist=0)
 Add an open cylinder as an indexed triangle strip. More...
 
int addSurface (Mesh &m, int Nx, int Ny, double width=2, double height=2, double x=0, double y=0)
 Add a tessellated rectangular surface as an indexed triangle strip. More...
 
int addSurfaceLoop (Mesh &m, int Nx, int Ny, int loopMode, double width=2, double height=2, double x=0, double y=0)
 Add a tessellated rectangular surface with connected edges. More...
 
int addTorus (Mesh &m, double minRadius=0.3, double majRadius=0.7, int Nmin=16, int Nmaj=16, double minPhase=0)
 Add a torus as an indexed triangle strip. More...
 
int addTexQuad (Mesh &m, float half_width=1, float half_height=1)
 
int addQuad (Mesh &m, float half_width=1, float half_height=1)
 
int addRect (Mesh &m, float x, float y, float w, float h)
 
int addTexRect (Mesh &m, float x, float y, float w, float h)
 
Matrix4f view_mat (Pose const &)
 
AudioDevice::StreamMode operator| (const AudioDevice::StreamMode &a, const AudioDevice::StreamMode &b)
 
AudioDeviceInfo::StreamMode operator| (const AudioDeviceInfo::StreamMode &a, const AudioDeviceInfo::StreamMode &b)
 
std::string demangle (const char *name)
 
FileList itemListInDir (std::string const &dir)
 
FileList fileListFromDir (std::string const &dir)
 
FilePath searchFileFromDir (std::string const &filename, std::string const &dir)
 
FileList filterInDir (std::string const &dir, std::function< bool(FilePath const &)> f, bool recursive=false)
 
bool checkExtension (std::string const &filename, std::string const &extension)
 
bool checkExtension (FilePath const &filepath, std::string const &extension)
 
void imguiInit ()
 
void imguiBeginFrame ()
 
void imguiEndFrame ()
 
void imguiDraw ()
 
void imguiShutdown ()
 
bool isImguiUsingInput ()
 
bool isImguiUsingKeyboard ()
 
double noteToHz (double noteNumber)
 
int getMIDIDeviceIndex (std::string deviceName)
 
Window::DisplayMode operator| (const Window::DisplayMode &a, const Window::DisplayMode &b)
 
Window::DisplayMode operator& (const Window::DisplayMode &a, const Window::DisplayMode &b)
 
void initializeWindowManager ()
 
void terminateWindowManager ()
 
float getCurrentWindowPixelDensity ()
 
TEM T abs (const Complex< T > &c)
 
TEM Complex< T > exp (const Complex< T > &c)
 
TEM Complex< T > log (const Complex< T > &c)
 
TEM Complex< T > pow (const Complex< T > &b, const Complex< T > &e)
 
TEM Complex< T > pow (const Complex< T > &b, const T &e)
 
template<class T >
Complex< T > operator+ (T r, const Complex< T > &c)
 
template<class T >
Complex< T > operator- (T r, const Complex< T > &c)
 
template<class T >
Complex< T > operator* (T r, const Complex< T > &c)
 
template<class T >
Complex< T > operator/ (T r, const Complex< T > &c)
 
template<class VecN , class T >
VecN rotate (const VecN &v, const VecN &p, const Complex< T > &a)
 
template<class VecN , class T >
void rotatePlane (VecN &v1, VecN &v2, const Complex< T > &a)
 
template<class Vec3 , class T >
Vec3 sterProj (const al::Complex< T > &c)
 
bool aeq (float a, float b, int maxULP=10)
 Return whether two floats are almost equal. More...
 
bool aeq (double a, double b, int maxULP=10)
 
template<class T >
ampTodB (const T &amp)
 
template<class T >
atLeast (const T &v, const T &eps)
 
template<class T >
atan2Fast (const T &y, const T &x)
 
uint32_t bitsSet (uint32_t v)
 Returns number of bits set to 1. More...
 
template<class T >
ceil (const T &val, const T &step)
 
template<class T >
ceil (const T &val, const T &step, const T &recStep)
 
uint32_t ceilEven (uint32_t v)
 Returns even number ceiling.
 
uint32_t ceilPow2 (uint32_t value)
 Returns power of two ceiling of value. More...
 
template<class T >
clip (const T &value, const T &hi=T(1), const T &lo=T(0))
 
template<class T >
clip (const T &v, int &clipFlag, const T &hi, const T &lo)
 Returns value clipped to [lo, hi] and signifies clipping behavior. More...
 
template<class T >
clipS (const T &value, const T &hi=T(1))
 
template<class T >
dBToAmp (const T &db)
 
template<class T >
bool even (const T &v)
 
template<class T >
erf (const T &v)
 
uint32_t factorial (uint32_t n0to12)
 
double factorialSqrt (int v)
 
template<class T >
floor (const T &val, const T &step)
 
template<class T >
floor (const T &val, const T &step, const T &recStep)
 
uint32_t floorPow2 (uint32_t value)
 Returns power of two floor of value. More...
 
template<class T >
fold (const T &value, const T &hi=T(1), const T &lo=T(0))
 Returns value folded into [lo, hi]. More...
 
template<class T >
foldOnce (const T &value, const T &hi=T(1), const T &lo=T(0))
 
template<class T >
gaussian (const T &v)
 
template<class T >
gcd (const T &x, const T &y)
 
template<typename T , typename... Ts>
gcd (const T &x, const Ts &... rest)
 
template<class T >
gudermannian (const T &x)
 
template<class T >
laguerreL (int n, int k, T x)
 Generalized Laguerre polynomial L{n,k}. More...
 
template<class T >
lcm (const T &x, const T &y)
 Returns least common multiple.
 
template<class T >
legendreP (int l, int m, T t)
 
template<class T >
legendreP (int l, int m, T ct, T st)
 
template<class T >
bool lessAbs (const T &v, const T &eps=T(0.000001))
 
template<typename T >
max (const T &v1, const T &v2, const T &v3)
 
template<class T >
mean (const T &v1, const T &v2)
 
template<class T >
min (const T &v1, const T &v2, const T &v3)
 
template<class T >
nearestDiv (T of, T to)
 
template<class T >
nextAfter (const T &x, const T &y)
 
template<class T >
nextMultiple (T val, T multiple)
 
template<class T >
numInt (const T &v)
 
template<class T >
bool odd (const T &v)
 
template<class T >
poly (const T &x, const T &a0, const T &a1, const T &a2)
 
template<class T >
poly (const T &x, const T &a0, const T &a1, const T &a2, const T &a3)
 
template<class T >
pow2 (const T &v)
 Returns value to the 2nd power.
 
template<class T >
pow2S (const T &v)
 Returns value to the 2nd power preserving sign.
 
template<class T >
pow3 (const T &v)
 Returns value to the 3rd power.
 
template<class T >
pow3Abs (const T &v)
 Returns absolute value to the 3rd power.
 
template<class T >
pow4 (const T &v)
 Returns value to the 4th power.
 
template<class T >
pow5 (const T &v)
 Returns value to the 5th power.
 
template<class T >
pow6 (const T &v)
 Returns value to the 6th power.
 
template<class T >
pow8 (const T &v)
 Returns value to the 8th power.
 
template<class T >
pow16 (const T &v)
 Returns value to the 16th power.
 
template<class T >
pow64 (const T &v)
 Returns value to the 64th power.
 
template<class T >
powN (T base, unsigned power)
 Returns value to a positive integer power. More...
 
unsigned char prime (uint32_t n)
 
template<class T >
round (const T &v, const T &step)
 
template<class T >
round (const T &v, const T &step, const T &recStep)
 
template<class T >
roundAway (const T &v)
 
template<class T >
roundAway (const T &v, const T &step)
 
template<class T >
sgn (const T &v, const T &norm=T(1))
 
template<class T >
sinc (const T &radians, const T &eps=T(0.0001))
 
template<class T >
slope (const T &x1, const T &y1, const T &x2, const T &y2)
 
template<class T >
void sort (T &value1, T &value2)
 
template<class T >
sumOfSquares (T n)
 
uint32_t trailingZeroes (uint32_t v)
 Returns number of trailing zeros in 32-bit int. More...
 
template<class T >
trunc (const T &v, const T &step)
 
template<class T >
trunc (const T &v, const T &step, const T &recStep)
 
template<class T >
bool within (const T &v, const T &lo, const T &hi)
 
template<class T >
bool within3 (const T &v1, const T &v2, const T &v3, const T &lo, const T &hi)
 
template<class T >
bool withinIE (const T &v, const T &lo, const T &hi)
 
template<class T >
wrap (const T &value, const T &hi=T(1), const T &lo=T(0))
 
template<class T >
wrap (const T &value, long &numWraps, const T &hi=T(1), const T &lo=T(0))
 Returns value wrapped in [lo, hi). More...
 
template<class T >
wrapAdd1 (const T &v, const T &max)
 
template<class T >
wrapOnce (const T &value, const T &hi=T(1))
 
template<class T >
wrapOnce (const T &value, const T &hi, const T &lo)
 
template<class T >
wrapPhase (const T &radians)
 
template<class T >
wrapPhaseOnce (const T &radians)
 
TEM T poly (const T &v, const T &a0, const T &a1, const T &a2, T a3)
 
TEM T mapRange (T value, T inlow, T inhigh, T outlow, T outhigh)
 
TEM T lerp (T src, T dest, T amt)
 
template<int N, class T >
Mat< N, T > operator+ (const T &s, const Mat< N, T > &v)
 
template<int N, class T >
Mat< N, T > operator- (const T &s, const Mat< N, T > &v)
 
template<int N, class T >
Mat< N, T > operator* (const T &s, const Mat< N, T > &v)
 
template<int N, class T , class U >
Vec< N, U > operator* (const Mat< N, T > &m, const Vec< N, U > &vCol)
 
template<int N, class T , class U >
Vec< N, U > operator* (const Vec< N, U > &vRow, const Mat< N, T > &m)
 
template<class T >
determinant (const Mat< 1, T > &m)
 
template<class T >
determinant (const Mat< 2, T > &m)
 
template<class T >
determinant (const Mat< 3, T > &m)
 
template<int N, class T >
determinant (const Mat< N, T > &m)
 Get determinant. More...
 
template<class T >
bool invert (Mat< 1, T > &m)
 
template<class T >
bool invert (Mat< 2, T > &m)
 
template<int N, class T >
bool invert (Mat< N, T > &m)
 
template<class T >
frustumFar (const Mat< 4, T > &proj)
 Get frustum far plane distance from a projection matrix.
 
template<class T >
frustumNear (const Mat< 4, T > &proj)
 Get frustum near plane distance from a projection matrix.
 
template<class T >
frustumDepth (const Mat< 4, T > &proj)
 Get frustum depth from a projection matrix.
 
template<class T >
frustumAspect (const Mat< 4, T > &proj)
 Get frustum aspect ratio from a projection matrix.
 
template<class T >
Quat< T > operator+ (T r, const Quat< T > &q)
 
template<class T >
Quat< T > operator- (T r, const Quat< T > &q)
 
template<class T >
Quat< T > operator* (T r, const Quat< T > &q)
 
template<class T >
Quat< T > operator/ (T r, const Quat< T > &q)
 
template<class T >
void sphericalToCart (T &r2x, T &t2y, T &p2z)
 Convert spherical to Cartesian coordinates in-place. More...
 
template<class T >
void sphericalToCart (T *vec3)
 Convert spherical to Cartesian coordinates in-place.
 
template<class T >
void cartToSpherical (T &x2r, T &y2t, T &z2p)
 Convert Cartesian to spherical coordinates in-place. More...
 
template<class T >
void cartToSpherical (T *vec3)
 Convert Cartesian to spherical coordinates in-place.
 
template<int N, class T >
Vec< N - 1, T > sterProj (const Vec< N, T > &v)
 Stereographic projection from an n-sphere to an n-1 dimensional hyperplane. More...
 
template<int N, class T >
Vec< N, T > operator+ (const T &s, const Vec< N, T > &v)
 
template<int N, class T >
Vec< N, T > operator- (const T &s, const Vec< N, T > &v)
 
template<int N, class T >
Vec< N, T > operator* (const T &s, const Vec< N, T > &v)
 
template<int N, class T >
Vec< N, T > operator/ (const T &s, const Vec< N, T > &v)
 
template<int N, class T >
abs (const Vec< N, T > &v)
 Get absolute value (magnitude) of vector.
 
template<int N1, class T1 , int N2, class T2 >
Vec< N1+N2, T1 > concat (const Vec< N1, T1 > &a, const Vec< N2, T2 > &b)
 Returns concatenation of two vectors.
 
template<int M, int N, class T >
Vec< M, T > sub (const Vec< N, T > &v, int begin=0)
 Get a subvector.
 
template<class T >
void cross (Vec< 3, T > &r, const Vec< 3, T > &a, const Vec< 3, T > &b)
 Sets r to cross product, a x b.
 
template<class T >
Vec< 3, T > cross (const Vec< 3, T > &a, const Vec< 3, T > &b)
 Returns cross product, a x b.
 
template<class T >
void cross (Vec< 3, T > &r, const Vec< 4, T > &a, const Vec< 4, T > &b)
 
template<class T >
Vec< 3, T > cross (const Vec< 4, T > &a, const Vec< 4, T > &b)
 Returns cross product, a x b.
 
template<class T >
void rotate (Vec< 3, T > &vec, const Vec< 3, T > &normal, double cosAng, double sinAng)
 Rotate a vector around a normal vector. More...
 
template<class T >
void rotate (Vec< 3, T > &vec, const Vec< 3, T > &normal, double angle)
 Rotate a vector around a normal vector. More...
 
template<int N, class T >
angle (const Vec< N, T > &a, const Vec< N, T > &b)
 Returns angle, in interval [0, pi], between two vectors.
 
template<int N, class T >
void centroid3 (Vec< N, T > &c, const Vec< N, T > &p1, const Vec< N, T > &p2, const Vec< N, T > &p3)
 
template<int N, class T >
Vec< N, T > closestPointOnLineSegment (const Vec< N, T > &a, const Vec< N, T > &b, const Vec< N, T > &p)
 Get closest point on line segment ab to point p.
 
template<int N, class T , class U >
dist (const Vec< N, T > &a, const Vec< N, U > &b)
 Returns distance between two vectors.
 
template<int N, class T >
Vec< N, T > lerp (const Vec< N, T > &input, const Vec< N, T > &target, T amt)
 
template<class T >
void normal (Vec< 3, T > &n, const Vec< 3, T > &p1, const Vec< 3, T > &p2, const Vec< 3, T > &p3)
 
template<int N, class T >
Vec< N, T > min (const Vec< N, T > &a, const Vec< N, T > &b)
 Returns vector containing element-wise minimum between two vectors.
 
template<int N, class T >
Vec< N, T > max (const Vec< N, T > &a, const Vec< N, T > &b)
 Returns vector containing element-wise maximum between two vectors.
 
template<typename T >
const char * typeString ()
 
 TypeString (char) TypeString(unsigned char) TypeString(int) TypeString(unsigned int) TypeString(float) TypeString(double) TypeString(long double) template< int N
 
template<int N, class T >
std::ostream & operator<< (std::ostream &out, const Vec< N, T > &v)
 
int asciiToIndex (int asciiKey, int offset=0)
 
int asciiToMIDI (int asciiKey, int offset=0)
 
SoundFile getResampledSoundFile (SoundFile *toConvert, unsigned int newSampleRate)
 
template<int N>
Speakers SpeakerRingLayout (unsigned int deviceChannelStart=0, float phase=0.f, float radius=1.f, float gain=1.f)
 
Speakers HeadsetSpeakerLayout (unsigned int deviceChannelStart=0, float radius=1.f, float gain=1.f)
 
Speakers StereoSpeakerLayout (unsigned int deviceChannelStart=0, float angle=30.f, float distance=1.f, float gain=1.f)
 
Speakers OctalSpeakerLayout (unsigned int deviceChannelStart=0, float phase=0.f, float radius=1.f, float gain=1.f)
 
Speakers CubeLayout (unsigned int deviceChannelStart=0)
 
template<class V2 >
void frenet (const V2 &d1, V2 &t, V2 &n)
 Compute Frenet frame (tangent, normal) from 1st difference.
 
template<class V3 >
void frenet (const V3 &d1, const V3 &d2, V3 &t, V3 &n, V3 &b)
 
template<class V3 >
void frenet (const V3 &p2, const V3 &p1, const V3 &p0, V3 &t, V3 &n, V3 &b)
 Compute Frenet frame (tangent, normal, binormal) from 3 consecutive points.
 
Speakers AlloSphereSpeakerLayout ()
 Current arrangement of speakers in AlloSphere.
 
Mat4f get_cube_mat (int face)
 
bhlw viewport_for_cubemap_face (int idx)
 
std::string perprojection_samplevert ()
 
std::string perprojection_samplefrag ()
 
char intensityToASCII (float v)
 
template<typename T >
void print (const T *arr, int size, const char *append="")
 Print an array of numbers. More...
 
template<typename T >
void println (const T *arr, int size)
 Print an array of numbers with new line. More...
 
template<typename T >
void print (const T &v, const char *append="")
 Print value. More...
 
template<typename T >
void println (const T &v)
 Print value with new line.
 
template<class T >
void print2D (const T *arr, int nx, int ny, FILE *fp=stdout)
 Prints 2D array of intensity values. More...
 
void printPlot (float value, uint32_t width=50, bool spaces=true, const char *point="o")
 Print signed unit value on a horizontal plot. More...
 
void err (const char *msg, const char *src="", bool exits=true)
 Prints error message to stderr and optionally calls exit()
 
void _warn (const char *fileName, int lineNumber, const char *fmt,...)
 
void _warnOnce (const char *fileName, int lineNumber, const char *fmt,...)
 
void * getUser ()
 
void registerSigInt (void *app)
 
al_sec al_system_time ()
 Get current wall time in seconds.
 
al_nsec al_system_time_nsec ()
 
void al_start_steady_clock ()
 
void al_reset_steady_clock ()
 
al_sec al_steady_time ()
 
al_nsec al_steady_time_nsec ()
 
void al_sleep (al_sec dt)
 Sleep for an interval of seconds.
 
void al_sleep_nsec (al_nsec dt)
 
void al_sleep_until (al_sec target)
 
void wait (al_sec dt)
 
al_sec walltime ()
 
al_sec timeNow ()
 
std::string toTimecode (al_nsec t, const std::string &format="D:H:M:S:m:u")
 Convert nanoseconds to timecode string.
 
RGB operator+ (float s, const RGB &c)
 
RGB operator- (float s, const RGB &c)
 
RGB operator* (float s, const RGB &c)
 
RGB operator/ (float s, const RGB &c)
 
Color operator+ (float s, const Color &c)
 
Color operator- (float s, const Color &c)
 
Color operator* (float s, const Color &c)
 
Color operator/ (float s, const Color &c)
 
HSV operator* (float s, const HSV &c)
 
 CONST_ (MaskExpo, 0x7F800000, 0x7FF0000000000000) CONST_(MaskFrac
 
 CONST_ (MaskSign, 0x80000000, 0x8000000000000000) CONST_(Expo1
 
char base10To36 (int dec10)
 Convert decimal integer to ascii base-36 character.
 
int base36To10 (char ascii36)
 Convert ascii base-36 character to decimal integer.
 
uint32_t bitsToUInt (const char *strBin)
 Convert a string of 1s and 0s to an integer. More...
 
float blockSubnormal (float v)
 Returns zero if argument is subnormal, otherwise returns argument. More...
 
double blockSubnormal (double v)
 Returns zero if argument is subnormal, otherwise returns argument. More...
 
template<class T >
clone (const T &obj)
 Returns temporary copy-constructed object. More...
 
int endian ()
 Returns 1 if little endian, 0 if big endian.
 
uint32_t floatExponent (float v)
 Returns biased decimal value of 32-bit float exponent field. More...
 
float floatMantissa (float v)
 Returns mantissa field as float between [0, 1).
 
float fraction (uint32_t bits, uint32_t phase)
 Converts linear integer phase to fraction. More...
 
float intToUnit (int16_t v)
 Convert 16-bit signed integer to floating point in [-1, 1)
 
float punUF (uint32_t v)
 Type-pun 32-bit unsigned int to 32-bit float. More...
 
uint32_t punFU (float v)
 Type-pun 32-bit float to 32-bit unsigned int. More...
 
int32_t punFI (float v)
 Type-pun 32-bit float to 32-bit signed int.
 
uint64_t punFU (double v)
 Type-pun 64-bit float to 64-bit unsigned int.
 
int64_t punFI (double v)
 Type-pun 64-bit float to 64-bit signed int.
 
double punUF (uint64_t v)
 Type-pun 64-bit unsigned int to 64-bit float.
 
double punIF (int64_t v)
 Type-pun 64-bit signed int to 64-bit float.
 
template<typename T >
void swapBytes (T &word)
 Swap the bytes of a word in-place.
 
template<typename T >
void swapBytes (T *data, unsigned count)
 Swap the bytes of the words in an array in-place.
 
template<class T >
std::string toString (const char *fmt, const T &v)
 Convert argument to a string using snprintf.
 
template<class T >
std::string toString (const T &v)
 Convert numerical type to a string.
 
template<class T >
std::string toString (const T *v, int num, int stride=1)
 Convert array of numerical types to a comma separated string.
 
template<class T >
uintToUnit (uint32_t v)
 Convert 32-bit unsigned integer to unit float in [0, 1)
 
template<class T >
uintToUnitS (uint32_t v)
 Convert 32-bit unsigned integer to unit float in [-1, 1)
 
int16_t unitToInt16 (float v)
 Convert float in [-1, 1) to 16-bit signed int in [0, 2^16)
 
uint32_t unitToUInt (float u)
 Convert float in [0, 1) to 32-bit unsigned int in [0, 2^32) More...
 
uint32_t unitToUInt2 (float u)
 Convert float in [0, 1) to 32-bit unsigned int in [0, 2^32) More...
 
uint8_t unitToUInt8 (float u)
 Convert float in [0, 1) to 8-bit unsigned int in [0, 256)
 
template<int NumBytes>
void swapBytesN (void *word)
 
template<>
void swapBytesN< 1 > (void *word)
 
template<>
void swapBytesN< 2 > (void *word)
 
template<>
void swapBytesN< 3 > (void *word)
 
template<>
void swapBytesN< 4 > (void *word)
 
template<>
void swapBytesN< 8 > (void *word)
 
template<>
float uintToUnit< float > (uint32_t v)
 
template<>
float uintToUnitS< float > (uint32_t v)
 
uint32_t next_power_of_two (uint32_t v)
 

Variables

constexpr int handshakeServerPort = 16987
 
constexpr int listenerFirstPort = 14000
 

Detailed Description

Ensures that GPU resources are valid even when a rendering context is rebuilt.

GPUContext represents an object with a corollary rendering context on a GPU. GPUObject is a shared base class for all objects that have a corrollary object on the GPU, and which must be re-submitted when the rendering context is rebuilt. An object that inherits GPUContext must call contextDestroy() when the context has been invalidated. For example, the al::Window object does this automatically when the window is closed or enters/leaves fullscreen. Doing so will mark all associated GPUObjects as invalidated (calling their onDestroy() handlers). Each GPUObject should call validate() before attempting to render; this will re-submit the resources (by calling its onCreate() handler).

GPUContexts are identified by an integer ID, which increments for each context created. The first created context has ID=0. GPUObjects will register with this context by default.

 A note on coordinate conventions

 The cartesian coordinate system used for Ambisonics is:
         +x is forward
         +y is left
         +z is up

 The polar coordinate system is as follows:
         Azimuth is the angle between the xz-plane and the source. From

the listener's perspective, a positive azimuth is leftward (towards +y) and negative is rightwards (towards -y). Elevation is the angle between the xy-plane and the source. From the listener's perspective, a positive elevation is upward (towards +z) and negative is downward (towards -z).

 The cartesian coordinate system used in Allocore's OpenGL is:
         +x is right
         +y is up
         +z is backward

 The correct OpenGL to Ambisonics conversion is thus:
          ambi_x = -gl_z;
          ambi_y = -gl_x;
          ambi_z =  gl_y;

Enumeration Type Documentation

◆ AttenuationLaw

Distance to attenuation laws.

Enumerator
ATTEN_NONE 

No attenuation over distance

ATTEN_LINEAR 

Linear attenuation over distance

ATTEN_INVERSE 

Attenuation is one over distance

ATTEN_INVERSE_SQUARE 

Attenuation is one over distance squared

Definition at line 51 of file al_DistAtten.hpp.

Function Documentation

◆ addAnnulus()

int al::addAnnulus ( Mesh m,
float  inRadius = 0.5,
float  outRadius = 1,
unsigned  slices = 16,
float  twist = 0 
)

Add an annulus ("little ring") as an indexed triangle strip.

Parameters
[in,out]mMesh to add vertices and indices to
[in]inRadiusRadius of inner circle (on xy plane)
[in]outRadiusRadius of outer circle (on xy plane)
[in]slicesNumber of polygon vertices
[in]twistRotation factor between polygons
Returns
number of vertices added

◆ addCone()

int al::addCone ( Mesh m,
float  radius = 1,
const Vec3f apex = Vec3f(0, 0, 2),
unsigned  slices = 16,
unsigned  cycles = 1 
)

Add a cone/pyramid as indexed triangles.

Note that the base lies on the xy plane, thus the shape is not "centered" on the z axis.

Parameters
[in,out]mMesh to add vertices and indices to
[in]radiusRadius of base (on xy plane)
[in]apexPosition of apex
[in]slicesNumber of points going around base
[in]cyclesNumber of cycles to go around base (should be relatively prime to slices)
Returns
number of vertices added

◆ addCube()

int al::addCube ( Mesh m,
bool  withNormalsAndTexcoords = false,
float  radius = M_SQRT_1_3 
)

Add cube as indexed triangles.

Parameters
[in,out]mMesh to add vertices and indices to
[in]radiusRadius of enclosing sphere
Returns
number of vertices added (8)

◆ addCylinder()

int al::addCylinder ( Mesh m,
float  radius = 1,
float  height = 2,
unsigned  slices = 16,
float  twist = 0 
)

Add an open cylinder as an indexed triangle strip.

To create a cylinder with different radii for the top and bottom, /see addPrism.

Parameters
[in,out]mMesh to add vertices and indices to
[in]radiusRadius (on xy plane)
[in]heightHeight (along z axis)
[in]slicesNumber of polygon vertices
[in]twistRotation factor between polygons
Returns
number of vertices added

◆ addDisc()

int al::addDisc ( Mesh m,
float  radius = 1,
unsigned  slices = 16 
)

Add a disc/regular polygon as indexed triangles.

Parameters
[in,out]mMesh to add vertices and indices to
[in]radiusRadius of disc (on xy plane)
[in]slicesNumber of points going around base
Returns
number of vertices added

◆ addDodecahedron()

int al::addDodecahedron ( Mesh m,
float  radius = 1 
)

Add dodecahedron as indexed triangles.

Parameters
[in,out]mMesh to add vertices and indices to
[in]radiusRadius of enclosing sphere
Returns
number of vertices added (20)

◆ addIcosahedron()

int al::addIcosahedron ( Mesh m,
float  radius = 1 
)

Add icosahedron as indexed triangles.

Parameters
[in,out]mMesh to add vertices and indices to
[in]radiusRadius of enclosing sphere
Returns
number of vertices added (12)

◆ addIcosphere()

int al::addIcosphere ( Mesh m,
double  radius = 1,
int  divisions = 2 
)

Add sphere produced from subdivided icosahedron as indexed triangles.

Parameters
[in,out]mMesh to add vertices and indices to
[in]radiusRadius of sphere
[in]divisionsNumber of recursive subdivisions
Returns
number of vertices added

◆ addOctahedron()

int al::addOctahedron ( Mesh m,
float  radius = 1 
)

Add octahedron as triangle vertices and indices.

Parameters
[in,out]mMesh to add vertices and indices to
[in]radiusRadius of enclosing sphere
Returns
number of vertices added (6)

◆ addPrism()

int al::addPrism ( Mesh m,
float  btmRadius = 1,
float  topRadius = 1,
float  height = 2,
unsigned  slices = 16,
float  twist = 0 
)

Add a prism as an indexed triangle strip.

A prism is formed from a triangle strip between two parallel regular polygons.

Parameters
[in,out]mMesh to add vertices and indices to
[in]btmRadiusRadius of bottom polygon (on xy plane)
[in]topRadiusRadius of top polygon (on xy plane)
[in]heightDistance between planes (along z axis)
[in]slicesNumber of polygon vertices
[in]twistRotation factor between polygons; a value of 0.5 produces an antiprism
Returns
number of vertices added

◆ addSphere()

int al::addSphere ( Mesh m,
double  radius = 1,
int  slices = 16,
int  stacks = 16 
)

Add sphere as indexed triangles.

Vertices go stack-by-stack, then slice-by-slice. The stacks start at the north pole (0,0,radius) and end at the south pole (0,0,-radius). The slices start on the x axis and go counter-clockwise on the xy plane.

Parameters
[in,out]mMesh to add vertices and indices to
[in]radiusRadius of sphere
[in]slicesNumber of slices around z axis
[in]stacksNumber of stacks on xy plane
Returns
number of vertices added

◆ addSurface()

int al::addSurface ( Mesh m,
int  Nx,
int  Ny,
double  width = 2,
double  height = 2,
double  x = 0,
double  y = 0 
)

Add a tessellated rectangular surface as an indexed triangle strip.

This creates a flat, regularly-tesselated surface lying on the xy plane. This shape can be used as a starting point for more complex meshes such as height maps/terrains and texture-mapped spheres and torii.

Parameters
[in,out]mMesh to add vertices and indices to
[in]NxNumber of vertices along x
[in]NyNumber of vertices along y
[in]widthTotal width (along x)
[in]heightTotal height (along y)
[in]xPosition of center along x
[in]yPosition of center along y
Returns
number of vertices added

◆ addSurfaceLoop()

int al::addSurfaceLoop ( Mesh m,
int  Nx,
int  Ny,
int  loopMode,
double  width = 2,
double  height = 2,
double  x = 0,
double  y = 0 
)

Add a tessellated rectangular surface with connected edges.

This adds a rectangular surface whose edges are connected. The resulting surface is suitable for warping into cylindrical or toroidal shapes. Given D as the width or height, the interval of position values along a particular dimension is closed-opened, [-D/2, D/2), if that dimension loops or closed, [-D/2, D/2], if that dimension does not loop. The drawing primitive is assumed to be a triangle strip.

Parameters
[in,out]mMesh to add vertices and indices to
[in]NxNumber of vertices along x
[in]NyNumber of vertices along y
[in]loopMode1: connect edges perpendicular to x (cylindrical), 2: connect edges perpendicular to x and y (toroidal)
[in]widthTotal width (along x)
[in]heightTotal height (along y)
[in]xPosition of center along x
[in]yPosition of center along y
Returns
number of vertices added

◆ addTetrahedron()

int al::addTetrahedron ( Mesh m,
float  radius = 1 
)

Add tetrahedron as indexed triangles.

Parameters
[in,out]mMesh to add vertices and indices to
[in]radiusRadius of enclosing sphere
Returns
number of vertices added (4)

◆ addTorus()

int al::addTorus ( Mesh m,
double  minRadius = 0.3,
double  majRadius = 0.7,
int  Nmin = 16,
int  Nmaj = 16,
double  minPhase = 0 
)

Add a torus as an indexed triangle strip.

If you need a texture-mapped torus, /see addSurface.

Parameters
[in,out]mMesh to add vertices and indices to
[in]minRadiusRadius of minor ring
[in]majRadiusRadius of major ring
[in]NminNumber of vertices around minor ring
[in]NmajNumber of vertices around major ring
[in]minPhaseStarting phase along minor ring, in [0,1]
Returns
number of vertices added

◆ addWireBox()

int al::addWireBox ( Mesh m,
float  width,
float  height,
float  depth 
)

Add wireframe box as indexed lines.

Parameters
[in,out]mMesh to add vertices and indices to
[in]widthTotal width (along x)
[in]heightTotal height (along y)
[in]depthTotal depth (along z)
Returns
number of vertices added

◆ bitsToUInt()

uint32_t al::bitsToUInt ( const char *  strBin)
inline

Convert a string of 1s and 0s to an integer.

Parameters
[in]strBinbinary string where the first character is the most-significant digit

Definition at line 273 of file al_Conversion.hpp.

◆ blockSubnormal() [1/2]

double al::blockSubnormal ( double  v)
inline

Returns zero if argument is subnormal, otherwise returns argument.

Sets argument to zero if subnormal.

Definition at line 298 of file al_Conversion.hpp.

◆ blockSubnormal() [2/2]

float al::blockSubnormal ( float  v)
inline

Returns zero if argument is subnormal, otherwise returns argument.

Sets argument to zero if subnormal.

Definition at line 289 of file al_Conversion.hpp.

◆ cartToSpherical()

template<class T >
void al::cartToSpherical ( T &  x2r,
T &  y2t,
T &  z2p 
)

Convert Cartesian to spherical coordinates in-place.

Parameters
[in,out]x2rx coordinate to radius
[in,out]y2ty coordinate to theta (angle on xy plane), in [-pi, pi]
[in,out]z2pz coordinate to phi (angle from z axis), in [0, pi]

Definition at line 253 of file al_Spherical.hpp.

◆ centroid3()

template<int N, class T >
void al::centroid3 ( Vec< N, T > &  c,
const Vec< N, T > &  p1,
const Vec< N, T > &  p2,
const Vec< N, T > &  p3 
)
inline

Compute centroid of a triangle defined by three points

Parameters
[out]cCentroid
[in]p1Point 1
[in]p2Point 2
[in]p3Point 3

Definition at line 651 of file al_Vec.hpp.

◆ clone()

template<class T >
T al::clone ( const T &  obj)

Returns temporary copy-constructed object.

This function can be more convenient than calling a copy constructor since one does not need to explicitly write the type of the object.

Definition at line 136 of file al_Conversion.hpp.

◆ CubeLayout()

Speakers al::CubeLayout ( unsigned int  deviceChannelStart = 0)

Generic layout of 8 speakers arranged in a cube with listener in the middle

◆ determinant() [1/4]

template<class T >
T al::determinant ( const Mat< 1, T > &  m)

Get determinant

Definition at line 599 of file al_Mat.hpp.

◆ determinant() [2/4]

template<class T >
T al::determinant ( const Mat< 2, T > &  m)

Get determinant

Definition at line 607 of file al_Mat.hpp.

◆ determinant() [3/4]

template<class T >
T al::determinant ( const Mat< 3, T > &  m)

Get determinant

Definition at line 615 of file al_Mat.hpp.

◆ determinant() [4/4]

template<int N, class T >
T al::determinant ( const Mat< N, T > &  m)

Get determinant.

This computes the determinant using cofactor (or Laplace) expansion. The algorithm operates by recursively computing determinants of submatrices.

Definition at line 628 of file al_Mat.hpp.

◆ floatExponent()

uint32_t al::floatExponent ( float  v)
inline

Returns biased decimal value of 32-bit float exponent field.

The true exponent is the return value minus 127. For example, values in [0.5, 1) return 126 (01111110), so the true exponent is 126 - 127 = -1.

Definition at line 311 of file al_Conversion.hpp.

◆ fraction()

float al::fraction ( uint32_t  bits,
uint32_t  phase 
)
inline

Converts linear integer phase to fraction.

2^bits is the effective size of the lookup table.
Note: the fraction only has 24-bits of precision.

Definition at line 319 of file al_Conversion.hpp.

◆ frenet()

template<class V3 >
void al::frenet ( const V3 &  d1,
const V3 &  d2,
V3 &  t,
V3 &  n,
V3 &  b 
)
inline

Compute Frenet frame (tangent, normal, binormal) from 1st and 2nd differences

Definition at line 171 of file al_Curve.hpp.

◆ HeadsetSpeakerLayout()

Speakers al::HeadsetSpeakerLayout ( unsigned int  deviceChannelStart = 0,
float  radius = 1.f,
float  gain = 1.f 
)

Headset speaker layout

◆ intensityToASCII()

char al::intensityToASCII ( float  v)
inline

Returns an ASCII character with intensity most closely matching a value in [0,1)

Definition at line 128 of file al_Printing.hpp.

◆ invert() [1/3]

template<class T >
bool al::invert ( Mat< 1, T > &  m)

Invert matrix, returns whether matrix was able to be inverted

Definition at line 643 of file al_Mat.hpp.

◆ invert() [2/3]

template<class T >
bool al::invert ( Mat< 2, T > &  m)

Invert matrix, returns whether matrix was able to be inverted

Definition at line 656 of file al_Mat.hpp.

◆ invert() [3/3]

template<int N, class T >
bool al::invert ( Mat< N, T > &  m)

Invert matrix, returns whether matrix was able to be inverted

Definition at line 669 of file al_Mat.hpp.

◆ normal()

template<class T >
void al::normal ( Vec< 3, T > &  n,
const Vec< 3, T > &  p1,
const Vec< 3, T > &  p2,
const Vec< 3, T > &  p3 
)
inline

Get the normal to a triangle defined by three points

Parameters
[out]nNormal
[in]p1Point 1
[in]p2Point 2
[in]p3Point 3

Definition at line 692 of file al_Vec.hpp.

◆ print() [1/2]

template<typename T >
void al::print ( const T &  v,
const char *  append = "" 
)

Print value.

Parameters
[in]vvalue to print
[in]appendan extra string to append at end

Definition at line 84 of file al_Printing.hpp.

◆ print() [2/2]

template<typename T >
void al::print ( const T *  arr,
int  size,
const char *  append = "" 
)

Print an array of numbers.

Parameters
[in]arrinput array
[in]sizesize of input array
[in]appendan extra string to append at end

◆ print2D()

template<class T >
void al::print2D ( const T *  arr,
int  nx,
int  ny,
FILE *  fp = stdout 
)

Prints 2D array of intensity values.

Parameters
[in]arrflat 2D array of values in [0, 1) where x moves fastest
[in]nxnumber of elements along x
[in]nynumber of elements along y
[in]fpfile to write output to

Definition at line 163 of file al_Printing.hpp.

◆ println()

template<typename T >
void al::println ( const T *  arr,
int  size 
)

Print an array of numbers with new line.

Parameters
[in]arrinput array
[in]sizesize of input array

Definition at line 75 of file al_Printing.hpp.

◆ printPlot()

void al::printPlot ( float  value,
uint32_t  width = 50,
bool  spaces = true,
const char *  point = "o" 
)

Print signed unit value on a horizontal plot.

Parameters
[in]valueNormalized value to plot
[in]widthCharacter width of plot excluding center point
[in]spacesPrint extra filling spaces to the right
[in]pointThe print character for points

◆ punFU()

uint32_t al::punFU ( float  v)
inline

Type-pun 32-bit float to 32-bit unsigned int.

This function uses a union to avoid problems with direct pointer casting when the fstrict-aliasing compiler flag is on.

Definition at line 175 of file al_Conversion.hpp.

◆ punUF()

float al::punUF ( uint32_t  v)
inline

Type-pun 32-bit unsigned int to 32-bit float.

This function uses a union to avoid problems with direct pointer casting when the fstrict-aliasing compiler flag is on.

Definition at line 166 of file al_Conversion.hpp.

◆ rotate() [1/2]

template<class T >
void al::rotate ( Vec< 3, T > &  vec,
const Vec< 3, T > &  normal,
double  angle 
)

Rotate a vector around a normal vector.

Parameters
[in,out]vecThe vector to rotate
[in]normalA normal perpendicular to the plane of rotation
[in]angleThe rotation angle, in radians

Definition at line 628 of file al_Vec.hpp.

◆ rotate() [2/2]

template<class T >
void al::rotate ( Vec< 3, T > &  vec,
const Vec< 3, T > &  normal,
double  cosAng,
double  sinAng 
)

Rotate a vector around a normal vector.

Parameters
[in,out]vecThe vector to rotate
[in]normalA normal perpendicular to the plane of rotation
[in]cosAngCosine of the rotation angle
[in]sinAngSine of the rotation angle

Definition at line 612 of file al_Vec.hpp.

◆ sphericalToCart()

template<class T >
void al::sphericalToCart ( T &  r2x,
T &  t2y,
T &  p2z 
)

Convert spherical to Cartesian coordinates in-place.

Parameters
[in,out]r2xradius to x coordinate
[in,out]t2ytheta (angle on xy plane), in [-pi, pi], to z coordinate
[in,out]p2zphi (angle from z axis), in [0, pi], to y coordinate

Definition at line 239 of file al_Spherical.hpp.

◆ sterProj()

template<int N, class T >
Vec< N - 1, T > al::sterProj ( const Vec< N, T > &  v)
inline

Stereographic projection from an n-sphere to an n-1 dimensional hyperplane.

Template Parameters
Ndimensions of sphere
Telement type
Parameters
[in]vunit n-vector describing point on n-sphere
Returns
vector describing projected coordinate on n-1 hyperplane

Definition at line 267 of file al_Spherical.hpp.

◆ unitToUInt()

uint32_t al::unitToUInt ( float  u)
inline

Convert float in [0, 1) to 32-bit unsigned int in [0, 2^32)

This conversion is most accurate on a linear scale. Input values outside [0, 1) result in undefined behavior.

Definition at line 421 of file al_Conversion.hpp.

◆ unitToUInt2()

uint32_t al::unitToUInt2 ( float  u)
inline

Convert float in [0, 1) to 32-bit unsigned int in [0, 2^32)

This conversion is most accurate on an exponential scale. Input values outside [-1, 1) return 0. Values in [-1, 0] behave as positive values in [0, 1).

return (((normalU | 0x800000UL) << 8UL) & (~ULONG_MAX | 0xffffffffUL))

rbs;

return (((normalU | 0x800000UL) << 8UL) & (~ULONG_MAX | 0xffffffffUL))

rbs;

Definition at line 427 of file al_Conversion.hpp.