2
0

Camera.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.CompilerServices;
  5. using System.Text;
  6. namespace BansheeEngine
  7. {
  8. public class Camera : Component
  9. {
  10. private CameraHandler handler;
  11. internal CameraHandler Handler
  12. {
  13. get { return handler; }
  14. }
  15. public float aspectRatio
  16. {
  17. get { return handler.aspectRatio; }
  18. set { handler.aspectRatio = value; }
  19. }
  20. public float nearClipPlane
  21. {
  22. get { return handler.nearClipPlane; }
  23. set { handler.nearClipPlane = value; }
  24. }
  25. public float farClipPlane
  26. {
  27. get { return handler.farClipPlane; }
  28. set { handler.farClipPlane = value; }
  29. }
  30. public Degree fieldOfView
  31. {
  32. get { return handler.fieldOfView; }
  33. set { handler.fieldOfView = value; }
  34. }
  35. public Rect2 viewportRect
  36. {
  37. get { return handler.viewportRect; }
  38. set { handler.viewportRect = value; }
  39. }
  40. public ProjectionType projectionType
  41. {
  42. get { return handler.projectionType; }
  43. set { handler.projectionType = value; }
  44. }
  45. public float orthoHeight
  46. {
  47. get { return handler.orthoHeight; }
  48. set { handler.orthoHeight = value; }
  49. }
  50. public float orthoWidth
  51. {
  52. get { return handler.orthoWidth; }
  53. }
  54. public Color clearColor
  55. {
  56. get { return handler.clearColor; }
  57. set { handler.clearColor = value; }
  58. }
  59. public float clearDepth
  60. {
  61. get { return handler.clearDepth; }
  62. set { handler.clearDepth = value; }
  63. }
  64. public UInt16 clearStencil
  65. {
  66. get { return handler.clearStencil; }
  67. set { handler.clearStencil = value; }
  68. }
  69. public ClearFlags clearFlags
  70. {
  71. get { return handler.clearFlags; }
  72. set { handler.clearFlags = value; }
  73. }
  74. public int priority
  75. {
  76. get { return handler.priority; }
  77. set { handler.priority = value; }
  78. }
  79. public UInt64 layers
  80. {
  81. get { return handler.layers; }
  82. set { handler.layers = value; }
  83. }
  84. public Matrix4 projMatrix
  85. {
  86. get { return handler.projMatrix; }
  87. }
  88. public Matrix4 projMatrixInv
  89. {
  90. get { return handler.projMatrixInv; }
  91. }
  92. public Matrix4 viewMatrix
  93. {
  94. get { return handler.viewMatrix; }
  95. }
  96. public Matrix4 viewMatrixInv
  97. {
  98. get { return handler.viewMatrixInv; }
  99. }
  100. public int widthPixels
  101. {
  102. get { return handler.widthPixels; }
  103. }
  104. public int heightPixels
  105. {
  106. get { return handler.heightPixels; }
  107. }
  108. public RenderTarget target
  109. {
  110. get { return handler.target; }
  111. set { handler.target = value; }
  112. }
  113. public Vector2I WorldToScreen(Vector3 value) { return handler.WorldToScreen(value); }
  114. public Vector2 WorldToClip(Vector3 value) { return handler.WorldToClip(value); }
  115. public Vector3 WorldToView(Vector3 value) { return handler.WorldToView(value); }
  116. public Vector3 ScreenToWorld(Vector2I value) { return handler.ScreenToWorld(value); }
  117. public Vector3 ScreenToView(Vector2I value) { return handler.ScreenToView(value); }
  118. public Vector2 ScreenToClip(Vector2I value) { return handler.ScreenToClip(value); }
  119. public Vector3 ViewToWorld(Vector3 value) { return handler.ViewToWorld(value); }
  120. public Vector2I ViewToScreen(Vector3 value) { return handler.ViewToScreen(value); }
  121. public Vector2 ViewToClip(Vector3 value) { return handler.ViewToClip(value); }
  122. public Vector3 ClipToWorld(Vector2 value) { return handler.ClipToWorld(value); }
  123. public Vector3 ClipToView(Vector2 value) { return handler.ClipToView(value); }
  124. public Vector2I ClipToScreen(Vector2 value) { return handler.ClipToScreen(value); }
  125. public Ray ScreenToWorldRay(Vector2I value) { return handler.ScreenToWorldRay(value); }
  126. public Vector3 ProjectPoint(Vector3 value) { return handler.ProjectPoint(value); }
  127. public Vector3 UnprojectPoint(Vector3 value) { return handler.UnprojectPoint(value); }
  128. private void OnInitialize()
  129. {
  130. handler = new CameraHandler(sceneObject);
  131. }
  132. private void Update()
  133. {
  134. handler.UpdateView(sceneObject);
  135. }
  136. private void OnDestroy()
  137. {
  138. handler.OnDestroy();
  139. }
  140. }
  141. }