Skip to content

Instantly share code, notes, and snippets.

// This assumes the occluder AABB and camera position are in the same space.
// You can either then transform the planes into world space, or transform the
// box verts and camera pos into world space before building the planes, but
// after finding the silhouette.
int makeOccluderPlanes(Vec4 planes[9], Vec3 bmin, Vec3 bmax, Vec3 camPos)
{
static const uint8_t s_silhouettes[43][6] = {
{ }, // 0
{ 0, 4, 6, 2 }, // 1: -x
{ 1, 3, 7, 5 }, // 2: +x
void discAabb(Vec3 *minOut, Vec3 *maxOut, Vec3 center, Vec3 normal, float radius)
{
Vec3 half;
float x2 = normal.x * normal.x;
float y2 = normal.y * normal.y;
float z2 = normal.z * normal.z;
half.x = radius * sqrtf(y2 + z2);
half.y = radius * sqrtf(z2 + x2);
half.z = radius * sqrtf(x2 + y2);
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" async
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
</head>
<body>
\[\begin{matrix}
& \textit{Non-Parity} & \textit{Inverse} & \textit{Parity} & \textit{Inverse} \\
Volition, Inc. Programmer's Test
Created: October 12, 1999
Last Revision: Tuesday, January 7, 2003 (MWA)
Please attempt all questions on this test. Type your answers immediately
after the questions. If you are unable to solve a problem, typing your
thoughts as you attempt the problem is useful.
There are eleven questions on this test. If you get stuck on one, move to the
next one. Please be sure that you completely understand the problem