public void Update(GameTime gameTime) { var gc = Engine.GraphicsContext; Time = gameTime; CameraFrustum.sbf = gc.CurrentCamera.Frustum; ViewD = gc.CurrentCamera.ViewD; ProjD = gc.CurrentCamera.ProjD; View = ViewD.ToMatrix(); Proj = ProjD.ToMatrix(); var viewCopy = View; viewCopy.TranslationVector = Vector3.Zero; ViewNoTrans = viewCopy; var viewDCopy = ViewD; viewDCopy.TranslationVector = Vector3D.Zero; ViewNoTransD = viewDCopy; ViewProj = Matrix.Multiply(View, Proj); ViewProjD = MatrixD.Multiply(ViewD, ProjD); }
public virtual void Update(GameTime gameTime) { HandleInput(gameTime); //float distance = Position.Length(); //NearPlane = Math.Max(distance - 6360, 1f); //if (NearPlane == 1f) //{ // FarPlane = 4000f; //} //else //{ // FarPlane = distance + 7000f; //} NearPlane = 1; FarPlane = 12000; ViewD = MatrixD.LookAtLH(PositionD, PositionD + LookAt, Up); ProjD = MatrixD.PerspectiveFovLH(FieldOfView, context.AspectRatio, NearPlane, FarPlane); Frustum = new BoundingFrustum(ViewD.ToMatrix() * ProjD.ToMatrix()); // loss of precision }