Skip to content

simulation-tree/cameras

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cameras

Cameras for rendering.

Projection data

Extending from the rendering project, an extension method is available to fetch the projection and view matrices from a Camera:

using World world = new World();
Camera mainCamera = new(world, CameraFieldOfView.FromDegrees(90f));
CameraProjection cameraProjection = mainCamera.GetProjection();
(Matrix4x4 projection, Matrix4x4 view) = cameraProjection;

Ray from screen point

When a screen point is available, a ray can be calculated from the camera's perspective:

Vector2 mousePosition = ...
Vector2 screenPoint = camera.Destination.GetScreenPointFromPosition(mousePosition);
(Vector3 origin, Vector3 direction) = cameraProjection.GetRayFromScreenPoint(screenPoint);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages