public void Offset(Vec3D vOffsetView, Bitmap bm) { points[0] = Vec3D.VectorAdd(points[0], vOffsetView); points[1] = Vec3D.VectorAdd(points[1], vOffsetView); points[2] = Vec3D.VectorAdd(points[2], vOffsetView); points[0].x *= 0.5F * (float)bm.Width; points[0].y *= 0.5F * (float)bm.Height; points[1].x *= 0.5F * (float)bm.Width; points[1].y *= 0.5F * (float)bm.Height; points[2].x *= 0.5F * (float)bm.Width; points[2].y *= 0.5F * (float)bm.Height; }
public Matrix RotateCamera() { vTarget = new Vec3D { x = 0, y = 0, z = 1 }; Matrix matCameraRot = Matrix.Matrix_MakeRotationY(fYaw); vLookDir = Matrix.MatrixMultiplyVector(vTarget, matCameraRot); vTarget = Vec3D.VectorAdd(vCamera, vLookDir); Matrix matCamera = Matrix.Matrix_PointAt(vCamera, vTarget, vUp); Matrix matView = Matrix.Matrix_QuickInverse(matCamera); return(matView); }
public void MoveCamera(Keys key) { if (key == Keys.Up) { vCamera.y += 0.05F; } if (key == Keys.Down) { vCamera.y -= 0.05F; } if (key == Keys.Left) { vCamera.x += 0.05F; } if (key == Keys.Right) { vCamera.x -= 0.05F; } if (key == Keys.W) { vCamera = Vec3D.VectorAdd(vCamera, vForward); } if (key == Keys.S) { vCamera = Vec3D.VectorSub(vCamera, vForward); } if (key == Keys.A) { fYaw -= 0.05F; } if (key == Keys.D) { fYaw += 0.05F; } }