/// <summary>Initializes the camera for a frame render.</summary> /// <param name="width">The width of the viewport in pixels</param> /// <param name="height">The height of the viewport in pixels</param> public virtual void InitRender(int width, int height) { w2 = width / 2D; h2 = height / 2D; // This code is a bit screwy to avoid flipping the camera, not sure if there's a better way to do this (yet) look = (lookAt - position).Normalize(); side = look.Cross(-up).Normalize(); up = look.Cross(side).Normalize(); side = -side; }
private void Recalculate() { Edge0to1 = Vert1.Position - Vert0.Position; Edge0to2 = Vert2.Position - Vert0.Position; if (!HasNormals) { Normal = Edge0to1.Cross(Edge0to2).Normalize(); Vert0 = Vert0.WithNormal(Normal); Vert1 = Vert1.WithNormal(Normal); Vert2 = Vert2.WithNormal(Normal); } }