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
Commodore | |
- Amiga CD32 - Spellbound | |
- CDTV - Black Baby | |
Atari | |
- Home Pong - Darlene | |
- 2600 - Stella | |
- Lynx - Handy | |
- Jaguar 2 - Midsummer |
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
#define PVR_RGBA8 0x61626772 | |
#define PVR_PVRTC4 0x00000002 | |
#define PVR_ETC1 0x00000006 | |
#define PVR_BC1 0x00000007 | |
#define PVR_ALPHA 0x00000061 | |
#define GL_COMPRESSED_RGB_S3TC_DXT1 0x83F0 | |
#define GL_ETC1_RGB8_OES 0x8D64 | |
#define GL_COMPRESSED_RGB_PVRTC_4BPPV1 0x8C00 |
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
void supportPoint(const Body &body, const vec3 &dir, vec3 &v) { | |
v = vec3::ZERO; | |
} | |
void supportSegment(const Body &body, const vec3 &dir, vec3 &v) { | |
v.x = v.z = 0.0f; | |
v.y = sign(dir.y) * body.height; | |
} | |
void supportRect(const Body &body, const vec3 &dir, vec3 &v) { |
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
#include <stdio.h> | |
#include <math.h> | |
#include <windows.h> | |
#include <gl/GL.h> | |
// simulation | |
#define SIZE_X 129 | |
#define SIZE_Y 129 | |
#define RIGID_FACTOR 0.5f | |
#define DAMPING_FACTOR 0.998f |
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
bool Circle::intersect(const Segment2D &segment, vec2 &n, float &t) const { | |
vec2 ap = center - segment.a; | |
vec2 ab = segment.b - segment.a; | |
float dab = ab.dot(ab); | |
if (dab == 0.0f) return false; | |
t = clamp(ap.dot(ab) / dab, 0.0f, 1.0f); | |
n = center - (segment.a + ab * t); | |
t = n.length2(); |
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
// quat | |
const quat quat::IDENTITY(0.0f, 0.0f, 0.0f, 1.0f); | |
const quat quat::ZERO(0.0f, 0.0f, 0.0f, 0.0f); | |
quat::quat() {} | |
quat::quat(float x, float y, float z, float w) : x(x), y(y), z(z), w(w) {} | |
quat::quat(const vec3 &axis, float angle) { | |
angle *= 0.5f; | |
float s = sinf(angle); |
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
bool AABB::intersect(const vec3 &rayPos, const vec3 &rayDir, float &t) const { | |
float t1 = INF, t0 = -t1; | |
for (int i = 0; i < 3; i++) | |
if (rayDir[i] != 0) { | |
float lo = (min[i] - rayPos[i]) / rayDir[i]; | |
float hi = (max[i] - rayPos[i]) / rayDir[i]; | |
t0 = _max(t0, _min(lo, hi)); | |
t1 = _min(t1, _max(lo, hi)); | |
} else | |
if (rayPos[i] < min[i] || rayPos[i] > max[i]) |
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
vec4 dx = vec4(0.25, 0.96, -0.25, -0.96) * uTexelSize.xyxy + vTexCoord.xyxy; | |
vec4 dy = vec4(0.25, 0.96, -0.25, -0.96) * uTexelSize.yxyx + vTexCoord.yxyx; | |
vec4 average = (texture2D(sTex, dx.zy) + texture2D(sTex, dx.xw) + | |
texture2D(sTex, dy.yx) + texture2D(sTex, dy.wz)) * 0.25; |
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
// Computes signed distance between a point and a plane | |
// vPlane: Contains plane coefficients (a,b,c,d) where: ax + by + cz = d | |
// vPoint: Point to be tested against the plane. | |
float DistanceToPlane( vec4 vPlane, vec3 vPoint ) | |
{ | |
return dot(vec4(vPoint, 1.0), vPlane); | |
} | |
// Frustum cullling on a sphere. Returns > 0 if visible, <= 0 otherwise | |
float CullSphere( vec4 vPlanes[6], vec3 vCenter, float fRadius ) |
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
void getBasis(const vec3 &n, vec3 &t, vec3 &b) { | |
if (n.z < -0.9999999f) { | |
t = vec3( 0.0f, -1.0f, 0.0f); | |
b = vec3(-1.0f, 0.0f, 0.0f); | |
return; | |
} | |
const float x = 1.0f / (1.0f + n.z); | |
const float y = -n.x*n.y*x; | |
t = vec3(1.0f - n.x*n.x*x, y, -n.x); | |
b = vec3(b, 1.0f - n.y*n.y*x, -n.y); |
NewerOlder