This is a conversion table for uniform values on these websites / environments.
This file contains 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
// World's Tiniest* Marching Tetrahedron | |
// by Leonard Ritter ([email protected]) | |
// this code is public domain | |
// 0 | |
// + | |
// / | \ | |
// 3 +-----+ 1 | |
// \ | / |
This file contains 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
in vec2 v_texcoord; // texture coords | |
in vec3 v_normal; // normal | |
in vec3 v_binormal; // binormal (for TBN basis calc) | |
in vec3 v_pos; // pixel view space position | |
out vec4 color; | |
layout(std140) uniform Transforms | |
{ | |
mat4x4 world_matrix; // object's world position |
This file contains 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
#ifndef __QUATERNION_INCLUDED__ | |
#define __QUATERNION_INCLUDED__ | |
#define QUATERNION_IDENTITY float4(0, 0, 0, 1) | |
#ifndef PI | |
#define PI 3.14159265359f | |
#endif | |
// Quaternion multiplication |
This file contains 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
#ifndef __MATRIX_INCLUDED__ | |
#define __MATRIX_INCLUDED__ | |
#define IDENTITY_MATRIX float4x4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1) | |
float4x4 inverse(float4x4 m) { | |
float n11 = m[0][0], n12 = m[1][0], n13 = m[2][0], n14 = m[3][0]; | |
float n21 = m[0][1], n22 = m[1][1], n23 = m[2][1], n24 = m[3][1]; | |
float n31 = m[0][2], n32 = m[1][2], n33 = m[2][2], n34 = m[3][2]; | |
float n41 = m[0][3], n42 = m[1][3], n43 = m[2][3], n44 = m[3][3]; |
This file contains 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
from math import * | |
# a performant solution would store a prefix sum of line lengths to | |
# a sidechannel and then use that to do a bsearch; on the GPU, | |
# you'd do a sum tree / histopyramid as a preprocessing step | |
def find_point(points, d): | |
d = d | |
for i in range(1, len(points)): | |
x0,y0 = points[i-1] | |
x1,y1 = points[i] |