diff options
| author | Adrian Ulbrich <adrian.ulbrich.2003@gmail.com> | 2019-11-08 23:56:17 +0100 |
|---|---|---|
| committer | Adrian Ulbrich <adrian.ulbrich.2003@gmail.com> | 2019-11-08 23:56:17 +0100 |
| commit | 3b214e75effaca1ba67daaf29d0a94e5b0129386 (patch) | |
| tree | ee0ccd43f193f2bdaedd36dcdc944f01a75e37e3 /Unicity.Renderer/Camera.cs | |
| parent | e63155370c817a1d9c16ef798b0a55e6fe328941 (diff) | |
| download | Unicity-3b214e75effaca1ba67daaf29d0a94e5b0129386.tar.gz Unicity-3b214e75effaca1ba67daaf29d0a94e5b0129386.tar.bz2 Unicity-3b214e75effaca1ba67daaf29d0a94e5b0129386.zip | |
Started work on actual engine
Diffstat (limited to 'Unicity.Renderer/Camera.cs')
| -rw-r--r-- | Unicity.Renderer/Camera.cs | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/Unicity.Renderer/Camera.cs b/Unicity.Renderer/Camera.cs deleted file mode 100644 index b58b571..0000000 --- a/Unicity.Renderer/Camera.cs +++ /dev/null @@ -1,50 +0,0 @@ -using OpenTK; - -namespace Unicity.Renderer -{ - public enum CameraProjectionMode - { - Ortographic, - Perspective - } - - public class Camera - { - float x = 0f; - float y = 0f; - float z = 0f; - - Matrix4 projectionMatrix = Matrix4.Identity; - - CameraProjectionMode projectionMode = CameraProjectionMode.Ortographic; - - public Camera(CameraProjectionMode projectionMode = CameraProjectionMode.Ortographic) - { - this.projectionMode = projectionMode; - } - - public void Initialize() - { - switch (projectionMode) - { - case CameraProjectionMode.Ortographic: - projectionMatrix = Matrix4.CreateOrthographic(600f, 600.0f, 0.1f, 100f); - break; - case CameraProjectionMode.Perspective: - projectionMatrix = Matrix4.CreatePerspectiveFieldOfView(MathHelper.DegreesToRadians(45f), 1f, 0.1f, 100f); - break; - - } - } - - public void UpdateView(Shader shader) - { - Matrix4 modelMatrix = Matrix4.CreateRotationX(MathHelper.DegreesToRadians(-55.0f)); - Matrix4 viewMatrix = Matrix4.CreateTranslation(0.0f, 0.0f, -8.0f); - - shader.SetUniform("model", modelMatrix); - shader.SetUniform("view", viewMatrix); - shader.SetUniform("projection", projectionMatrix); - } - } -} |
