Falco Engine 3.9.0.1 (beta)
Camera.cs
Go to the documentation of this file.
1using System.Runtime.CompilerServices;
2
3namespace FalcoEngine
4{
5 public class Camera : Component
6 {
10 public enum GBufferTexture
11 {
12 Diffuse,
13 Normals,
14 MetallicRoughnessAOSpecular,
15 Lightmap,
16 Depth
17 }
18
19 internal Camera()
20 {
21
22 }
23
27 public RenderTexture renderTarget { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }
28
35 {
36 INTERNAL_worldToScreenPoint(ref world, out Vector3 screen);
37
38 return screen;
39 }
40
47 {
48 INTERNAL_screenToWorldPoint(ref screen, out Vector3 world);
49
50 return world;
51 }
52
58 public Matrix4 GetViewMatrix(bool ownFrustumOnly = false)
59 {
60 INTERNAL_getViewMatrix(ownFrustumOnly, out Matrix4 matrix);
61 return matrix;
62 }
63
69 {
70 INTERNAL_getProjectionMatrix(out Matrix4 matrix);
71 return matrix;
72 }
73
79 public bool IsObjectVisible(GameObject @object)
80 {
81 return INTERNAL_isObjectVisible(@object);
82 }
83
87 public float nearClipDistance { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }
88
92 public float farClipDistance { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }
93
100 {
101 return INTERNAL_GetGBufferTexture((int)textureType);
102 }
103
104 /*----------- INTERNAL CALLS ------------*/
105
106 [MethodImpl(MethodImplOptions.InternalCall)]
107 private extern void INTERNAL_getViewMatrix(bool ownFrustumOnly, out Matrix4 matrix);
108
109 [MethodImpl(MethodImplOptions.InternalCall)]
110 private extern void INTERNAL_getProjectionMatrix(out Matrix4 matrix);
111
112 [MethodImpl(MethodImplOptions.InternalCall)]
113 private extern void INTERNAL_worldToScreenPoint(ref Vector3 world, out Vector3 screen);
114
115 [MethodImpl(MethodImplOptions.InternalCall)]
116 private extern void INTERNAL_screenToWorldPoint(ref Vector3 screen, out Vector3 world);
117
118 [MethodImpl(MethodImplOptions.InternalCall)]
119 private extern bool INTERNAL_isObjectVisible(GameObject @object);
120
121 [MethodImpl(MethodImplOptions.InternalCall)]
122 private extern Texture INTERNAL_GetGBufferTexture(int textureType);
123 }
124}
Matrix4 GetViewMatrix(bool ownFrustumOnly=false)
Returns a view matrix of this camera
Definition: Camera.cs:58
Vector3 WorldToScreenPoint(Vector3 world)
Convert world to screen point
Definition: Camera.cs:34
RenderTexture renderTarget
Get or set the render texture as a render target
Definition: Camera.cs:27
bool IsObjectVisible(GameObject @object)
Checks if the game object is in field of view of this camera
Definition: Camera.cs:79
float farClipDistance
The distance of the far clipping plane from the camera, in world units
Definition: Camera.cs:92
Texture GetGBufferTexture(GBufferTexture textureType)
Get GBuffer texture from channel pointed by textureType
Definition: Camera.cs:99
Vector3 ScreenToWorldPoint(Vector3 screen)
Convert screen to world point
Definition: Camera.cs:46
Matrix4 GetProjectionMatrix()
Returns a projection matrix of this camera
Definition: Camera.cs:68
GBufferTexture
GBufferTexture enum
Definition: Camera.cs:11
float nearClipDistance
The distance of the near clipping plane from the camera, in world units
Definition: Camera.cs:87