static Vector3B() { Zero = new Vector3B(); Up = new Vector3B(0, 1, 0); Down = new Vector3B(0, -1, 0); Right = new Vector3B(1, 0, 0); Left = new Vector3B(-1, 0, 0); Forward = new Vector3B(0, 0, -1); Backward = new Vector3B(0, 0, 1); }
static unsafe BoxCornerEnumerator() { m_indices = (Vector3B *)Marshal.AllocHGlobal(0x18); m_indices[0] = new Vector3B(0, 4, 5); m_indices[1] = new Vector3B(3, 4, 5); m_indices[2] = new Vector3B(3, 1, 5); m_indices[3] = new Vector3B(0, 1, 5); m_indices[4] = new Vector3B(0, 4, 2); m_indices[5] = new Vector3B(3, 4, 2); m_indices[6] = new Vector3B(3, 1, 2); m_indices[7] = new Vector3B(0, 1, 2); }
static BoxCornerEnumerator() { m_indices = (Vector3B *)(void *)Marshal.AllocHGlobal(sizeof(byte) * 3 * 8); m_indices[0] = new Vector3B(0, 4, 5); m_indices[1] = new Vector3B(3, 4, 5); m_indices[2] = new Vector3B(3, 1, 5); m_indices[3] = new Vector3B(0, 1, 5); m_indices[4] = new Vector3B(0, 4, 2); m_indices[5] = new Vector3B(3, 4, 2); m_indices[6] = new Vector3B(3, 1, 2); m_indices[7] = new Vector3B(0, 1, 2); }
public bool ShouldSend(Vector3B newThrust) { if (SleepFrames > 4 && LastSendState != newThrust) { SleepFrames = 0; LastSendState = newThrust; return true; } else { SleepFrames++; return false; } }
/** * Given a position in 3D space find the direction of the face of cubemap it falls on. */ public static void GetCubeFaceDirection(ref Vector3 position, out Vector3B face) { Vector3 abs = Vector3.Abs(position); if (abs.X > abs.Y) if (abs.X > abs.Z) if (position.X > 0.0f) face = Vector3B.Right; else face = Vector3B.Left; else if (position.Z > 0.0f) face = Vector3B.Backward; else face = Vector3B.Forward; else if (abs.Y > abs.Z) if (position.Y > 0.0f) face = Vector3B.Up; else face = Vector3B.Down; else if (position.Z > 0.0f) face = Vector3B.Backward; else face = Vector3B.Forward; }