New SMAC quizzes available.Test your Alpha Centauri knowledge! Chess is back.Challenge someone!
0 Members and 1 Guest are viewing this topic.
You meaning the lighting table the normals are used as in index into?
#define PI 3.141592653589793238463DWORD EncodeNormal(double x, double y, double z){ if (y < 0.0) { x = -x; y = -y; z = -z; } double dAngle1 = atan2(z, x); if (dAngle1 < 0.0) dAngle1 += 2 * PI; DWORD dwAngle1 = (DWORD)round(dAngle1 / (2.0 * PI) * 89.0) % 89; dwAngle1 = 88 - dwAngle1; double dAngle2 = acos(y); DWORD dwAngle2 = (DWORD)round(dAngle2 / (PI / 2.0) * 23.0); DWORD dwRet = dwAngle2 * 89 + dwAngle1; // This works because in the case of y = 1.0, x & z will be 0, // so 23 * 89 is the highest number we need dwRet = (dwRet >= 89) ? dwRet - 88 : 0; return dwRet;}
It's attached here.
Let me know you have any thoughts on what v2 and v3 might be.
How committed to Java are you, Ford?
I've never seen a really smooth Java game under Windows