This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as THREE from 'three' | |
export class CameraController { | |
camera: THREE.Camera; | |
invertControls: boolean; | |
domElement: HTMLElement; | |
controls: PointerLockControls; | |
moveForward: boolean; | |
moveBackward: boolean; | |
moveLeft: boolean; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <functional> | |
#include <iostream> | |
#include <type_traits> | |
#include <optional> | |
#include <variant> | |
#include <chrono> | |
#include <memory> | |
//! Returns the time since epoch in ms |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename... Ts> | |
void attach_shaders(GLuint program, Ts... shaders) { | |
(glAttachShader(program, shaders), ...); | |
} | |
template <typename... Ts> | |
void detach_shaders(GLuint program, Ts... shaders) { | |
(glDetachShader(program, shaders), ...); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum class format : GLenum { | |
r = GL_RED, | |
g = GL_GREEN, | |
b = GL_BLUE, | |
rg = GL_RG, | |
rgb = GL_RGB, | |
bgr = GL_BGR, | |
rgba = GL_RGBA, | |
bgra = GL_BGRA, | |
r_int = GL_RED_INTEGER, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a GLSL implementation of | |
// "Computing the Singular Value Decomposition of 3 x 3 matrices with | |
// minimal branching and elementary floating point operations" | |
// by Aleka McAdams et.al. | |
// http://pages.cs.wisc.edu/~sifakis/papers/SVD_TR1690.pdf | |
// This should also work on the CPU using glm | |
// Then you probably should use glm::quat instead of vec4 | |
// and mat3_cast to convert to mat3. |