Emitter bug fixes and test macro for amuseplay

This commit is contained in:
Jack Andersen
2017-09-19 23:22:46 -10:00
parent c6781df90a
commit 4b2b86f420
7 changed files with 119 additions and 34 deletions

View File

@@ -10,17 +10,6 @@ static void Cross(Vector3f& out, const Vector3f& a, const Vector3f& b)
out[2] = a[0] * b[1] - a[1] * b[0];
}
static float Normalize(Vector3f& out)
{
float dist = Length(out);
if (dist == 0.f)
return 0.f;
out[0] /= dist;
out[1] /= dist;
out[2] /= dist;
return dist;
}
void Listener::setVectors(const float* pos, const float* dir, const float* heading, const float* up)
{
for (int i=0 ; i<3 ; ++i)
@@ -30,10 +19,13 @@ void Listener::setVectors(const float* pos, const float* dir, const float* headi
m_heading[i] = heading[i];
m_up[i] = up[i];
}
Normalize(m_heading);
Normalize(m_up);
Cross(m_right, m_heading, m_up);
Normalize(m_right);
m_dirty = true;
}
}