Komodo Engine
C PROJECT_LOGO=
Komodo.Core.ECS.Components.CameraComponent Class Reference

CameraComponent specifies either a perspective or orthographic camera. A CameraComponent will be used by a corresponding Komodo.Core.ECS.Systems.Render2DSystem and/or Komodo.Core.ECS.Systems.Render3DSystem to draw Component objects. More...

Inheritance diagram for Komodo.Core.ECS.Components.CameraComponent:
Komodo.Core.ECS.Components.Component

Public Member Functions

ContainmentType Contains (Point point)
 Checks whether or not a Microsoft.Xna.Framework.Point is contained within the BoundingFrustum of the CameraComponent. More...
 
ContainmentType Contains (Vector2 vector)
 Checks whether or not a Komodo.Lib.Math.Vector2 is contained within the BoundingFrustum of the CameraComponent. More...
 
ContainmentType Contains (Rectangle rectangle)
 Contains(Rectangle) checks whether or not a Microsoft.Xna.Framework.Rectangle is contained within the BoundingBox of the CameraComponent. More...
 
void Move (Vector3 direction)
 Moves the Component Komodo.Core.ECS.Components.Component.Position of the CameraComponent by the specified direction. More...
 
void SetActive ()
 Sets the CameraComponent as the active camera for the linked Komodo.Core.ECS.Systems.Render2DSystem and Komodo.Core.ECS.Systems.Render3DSystem. More...
 
Vector3 ScreenToWorld (float x, float y, float z)
 Translates x, y, z from screen space to world space. More...
 
Vector3 ScreenToWorld (Vector3 screenPosition)
 Translates Komodo.Lib.Math.Vector3 from screen space to world space. More...
 
Vector3 WorldToScreen (float x, float y, float z)
 Translates x, y, z from world space to screen space. More...
 
Vector3 WorldToScreen (Vector3 worldPosition)
 Translates x, y, z from world space to screen space. More...
 
void ZoomIn (float deltaZoom)
 Zooms in the CameraComponent, clamping Zoom between MaximumZoom and MinimumZoom. More...
 
void ZoomOut (float deltaZoom)
 Zooms out the CameraComponent, clamping Zoom between MaximumZoom and MinimumZoom. More...
 

Public Attributes

BoundingFrustum BoundingFrustum => new BoundingFrustum(ViewMatrix * Projection)
 Provides a Microsoft.Xna.Framework.BoundingFrustum representing the projected space of the CameraComponent. More...
 
Vector3 Center => WorldPosition + Origin
 
Matrix InverseViewMatrix => Matrix.Invert(ViewMatrix)
 

Properties

Vector3 Backward [get]
 Backward direction for current view matrix. More...
 
Rectangle BoundingRectangle [get]
 Provides a Microsoft.Xna.Framework.Rectangle representing the projected space of the CameraComponent. More...
 
Vector3 Down [get]
 Down direction for current view matrix. More...
 
float FarPlane [get, set]
 FarPlane defines the furthest distance a Component can be from the CameraComponent and still be rendered. More...
 
float FieldOfView [get, set]
 FieldOfView Defines the visible field of view for the camera. More...
 
Vector3 Forward [get]
 Forward direction for current view matrix. More...
 
bool IsPerspective [get, set]
 
Vector3 Left [get]
 Left direction for current view matrix. More...
 
float MaximumZoom [get, set]
 MaximumZoom defines the upper bound of how far the CameraComponent can zoom in. More...
 
float MinimumZoom [get, set]
 MinimumZoom defines the upper bound of how far the CameraComponent can zoom out. More...
 
float NearPlane [get, set]
 MaximumZoom defines the closest distance a Component can be from the CameraComponent and still be rendered. More...
 
Vector3 Origin [get, set]
 
Matrix Projection [get]
 
Vector3 Right [get]
 Right direction for current view matrix. More...
 
Entity Target [get, set]
 Target defines the Komodo.Core.ECS.Entities.Entity that is followed by the CameraComponent. More...
 
Vector3 Up [get]
 Up direction for current view matrix. More...
 
Matrix? ViewMatrix [get, set]
 
float Zoom [get, set]
 Zoom is the current zoom level of the CameraComponent. More...
 
- Properties inherited from Komodo.Core.ECS.Components.Component
GameGame [get]
 Each Component maintains a reference to the Komodo.Core.Game instance. More...
 
Guid ID [get]
 Unique identifier for the Component. More...
 
bool IsEnabled [get, set]
 Enabled Components are managed by their corresponding Komodo.Core.ECS.Systems.ISystem, otherwise the Component is ignored. More...
 
bool IsInitialized [get, set]
 Uninitialized Components are initialized by their corresponding Komodo.Core.ECS.Systems.ISystem, otherwise the Component is initialized on the next Komodo.Core.ECS.Systems.ISystem.Initialize, Komodo.Core.ECS.Systems.ISystem.PreUpdate, or Komodo.Core.ECS.Systems.ISystem.PostUpdate methods. More...
 
Entity Parent [get, set]
 Each Component belongs to a Komodo.Core.ECS.Entities.Entity and maintains a reference to the parent Komodo.Core.ECS.Entities.Entity. More...
 
Vector3 Position [get, set]
 Each Component has a position relative to their Parent. More...
 
Vector3?? WorldPosition [get]
 The sum of Position and the Parent's Komodo.Core.ECS.Entities.Entity.Position, representing the Component's position in world space. More...
 
Vector3?? Rotation [get, set]
 Derived from the Parent's Komodo.Core.ECS.Entities.Entity.Rotation. More...
 
Matrix?? RotationMatrix [get]
 Derived from the Parent's Komodo.Core.ECS.Entities.Entity.RotationMatrix. More...
 
Quaternion?? RotationQuaternion [get]
 Derived from the Parent's Komodo.Core.ECS.Entities.Entity.RotationQuaternion. More...
 
Vector3?? Scale [get, set]
 Derived from the Parent's Komodo.Core.ECS.Entities.Entity.Scale. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Komodo.Core.ECS.Components.Component
 Component (bool isEnabled=true, Entity parent=null)
 

Detailed Description

CameraComponent specifies either a perspective or orthographic camera. A CameraComponent will be used by a corresponding Komodo.Core.ECS.Systems.Render2DSystem and/or Komodo.Core.ECS.Systems.Render3DSystem to draw Component objects.

Member Function Documentation

◆ Contains() [1/3]

ContainmentType Komodo.Core.ECS.Components.CameraComponent.Contains ( Point  point)

Checks whether or not a Microsoft.Xna.Framework.Point is contained within the BoundingFrustum of the CameraComponent.

◆ Contains() [2/3]

ContainmentType Komodo.Core.ECS.Components.CameraComponent.Contains ( Rectangle  rectangle)

Contains(Rectangle) checks whether or not a Microsoft.Xna.Framework.Rectangle is contained within the BoundingBox of the CameraComponent.

◆ Contains() [3/3]

ContainmentType Komodo.Core.ECS.Components.CameraComponent.Contains ( Vector2  vector)

Checks whether or not a Komodo.Lib.Math.Vector2 is contained within the BoundingFrustum of the CameraComponent.

◆ Move()

void Komodo.Core.ECS.Components.CameraComponent.Move ( Vector3  direction)

Moves the Component Komodo.Core.ECS.Components.Component.Position of the CameraComponent by the specified direction.

Parameters
directionDirection and magnitude of the movement.

◆ ScreenToWorld() [1/2]

Vector3 Komodo.Core.ECS.Components.CameraComponent.ScreenToWorld ( float  x,
float  y,
float  z 
)

Translates x, y, z from screen space to world space.

Parameters
xX component of screen space.
yY component of screen space.
zZ component of screen space.
Returns
Position in world space.

◆ ScreenToWorld() [2/2]

Vector3 Komodo.Core.ECS.Components.CameraComponent.ScreenToWorld ( Vector3  screenPosition)

Translates Komodo.Lib.Math.Vector3 from screen space to world space.

Parameters
screenPositionPosition in screen space.
Returns
Position in world space.

◆ SetActive()

void Komodo.Core.ECS.Components.CameraComponent.SetActive ( )

◆ WorldToScreen() [1/2]

Vector3 Komodo.Core.ECS.Components.CameraComponent.WorldToScreen ( float  x,
float  y,
float  z 
)

Translates x, y, z from world space to screen space.

Parameters
xX component of world space.
yY component of world space.
zZ component of world space.
Returns
Position in screen space.

◆ WorldToScreen() [2/2]

Vector3 Komodo.Core.ECS.Components.CameraComponent.WorldToScreen ( Vector3  worldPosition)

Translates x, y, z from world space to screen space.

Parameters
worldPositionPosition in world space.
Returns
Position in screen space.

◆ ZoomIn()

void Komodo.Core.ECS.Components.CameraComponent.ZoomIn ( float  deltaZoom)

Zooms in the CameraComponent, clamping Zoom between MaximumZoom and MinimumZoom.

Parameters
deltaZoomAmount to zoom the CameraComponent in by.

◆ ZoomOut()

void Komodo.Core.ECS.Components.CameraComponent.ZoomOut ( float  deltaZoom)

Zooms out the CameraComponent, clamping Zoom between MaximumZoom and MinimumZoom.

Parameters
deltaZoomAmount to zoom the CameraComponent out by.

Member Data Documentation

◆ BoundingFrustum

BoundingFrustum Komodo.Core.ECS.Components.CameraComponent.BoundingFrustum => new BoundingFrustum(ViewMatrix * Projection)

Provides a Microsoft.Xna.Framework.BoundingFrustum representing the projected space of the CameraComponent.

Property Documentation

◆ Backward

Vector3 Komodo.Core.ECS.Components.CameraComponent.Backward
get

Backward direction for current view matrix.

◆ BoundingRectangle

Rectangle Komodo.Core.ECS.Components.CameraComponent.BoundingRectangle
get

Provides a Microsoft.Xna.Framework.Rectangle representing the projected space of the CameraComponent.

◆ Down

Vector3 Komodo.Core.ECS.Components.CameraComponent.Down
get

Down direction for current view matrix.

◆ FarPlane

float Komodo.Core.ECS.Components.CameraComponent.FarPlane
getset

FarPlane defines the furthest distance a Component can be from the CameraComponent and still be rendered.

◆ FieldOfView

float Komodo.Core.ECS.Components.CameraComponent.FieldOfView
getset

FieldOfView Defines the visible field of view for the camera.

◆ Forward

Vector3 Komodo.Core.ECS.Components.CameraComponent.Forward
get

Forward direction for current view matrix.

◆ Left

Vector3 Komodo.Core.ECS.Components.CameraComponent.Left
get

Left direction for current view matrix.

◆ MaximumZoom

float Komodo.Core.ECS.Components.CameraComponent.MaximumZoom
getset

MaximumZoom defines the upper bound of how far the CameraComponent can zoom in.

If MaximumZoom is set to a value smaller than the current Zoom level, then Zoom will be clamped to the new MaximumZoom.

◆ MinimumZoom

float Komodo.Core.ECS.Components.CameraComponent.MinimumZoom
getset

MinimumZoom defines the upper bound of how far the CameraComponent can zoom out.

If MinimumZoom is set to a value larger than the current Zoom level, then Zoom will be clamped to the new MinimumZoom.

◆ NearPlane

float Komodo.Core.ECS.Components.CameraComponent.NearPlane
getset

MaximumZoom defines the closest distance a Component can be from the CameraComponent and still be rendered.

◆ Right

Vector3 Komodo.Core.ECS.Components.CameraComponent.Right
get

Right direction for current view matrix.

◆ Target

Entity Komodo.Core.ECS.Components.CameraComponent.Target
getset

Target defines the Komodo.Core.ECS.Entities.Entity that is followed by the CameraComponent.

◆ Up

Vector3 Komodo.Core.ECS.Components.CameraComponent.Up
get

Up direction for current view matrix.

◆ Zoom

float Komodo.Core.ECS.Components.CameraComponent.Zoom
getset

Zoom is the current zoom level of the CameraComponent.

Zoom automatically clamps between MaximumZoom and MinimumZoom whenever Zoom, MaximumZoom, or MinimumZoom are updated.