From 2d2e2ff4038db052d0186645f5afe4ec9daf2505 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Bruyère Date: Wed, 24 Apr 2019 04:17:16 +0200 Subject: use boolean for tex0 and tex1 availability tests --- samples/Model/Camera2.cs | 102 ----------------------------------------------- 1 file changed, 102 deletions(-) delete mode 100644 samples/Model/Camera2.cs (limited to 'samples/Model/Camera2.cs') diff --git a/samples/Model/Camera2.cs b/samples/Model/Camera2.cs deleted file mode 100644 index 657564b..0000000 --- a/samples/Model/Camera2.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System; -using System.Numerics; -using System.Runtime.InteropServices; - -using Vulkan; -using static CVKL.Camera; - -namespace CVKL { - public class Camera2 { - - float fov, aspectRatio, zNear = 0.1f, zFar = 256f; - float moveSpeed = 1, rotSpeed = 0.01f, zoomSpeed = 0.01f; - Vector3 rotation = new Vector3 (-1.5f, 2.7f, 0f); - Vector3 position = new Vector3 (0, 0, -2); - float zoom = 1.0f; - - public CamType Type; - - public float AspectRatio { - get { return aspectRatio; } - set { - aspectRatio = value; - Update (); - } - } - public float FieldOfView { - get { return fov; } - set { - fov = value; - Update (); - } - } - public Matrix4x4 Perspective { - get { return Matrix4x4.CreatePerspectiveFieldOfView (fov, aspectRatio, zNear, zFar); } - } - - public Camera2 (float fieldOfView, float aspectRatio) { - fov = fieldOfView; - this.aspectRatio = aspectRatio; - Update (); - } - - public void Rotate (float x, float y, float z = 0) { - rotation.Y += rotSpeed * x; - rotation.X += rotSpeed * y; - Update (); - } - public void Move (float x, float y, float z = 0) { - position.X += moveSpeed * x; - position.Y += moveSpeed * y; - position.Z += moveSpeed * z; - Update (); - } - public void Zoom (float factor) { - zoom += zoomSpeed * factor; - Update (); - } - - public Matrix4x4 Projection { get; private set;} - public Matrix4x4 View { get; private set;} - public Matrix4x4 Model { get; private set;} - - public Matrix4x4 SkyboxView { - get { - return - Matrix4x4.CreateFromAxisAngle (Vector3.UnitZ, rotation.Z) * - Matrix4x4.CreateFromAxisAngle (Vector3.UnitY, rotation.Y) * - Matrix4x4.CreateFromAxisAngle (Vector3.UnitX, rotation.X); - } - } - - //public void Update () { - // Projection = Matrix4x4.CreatePerspectiveFieldOfView (fov, aspectRatio, zNear, zFar); - // Matrix4x4 rot = - // Matrix4x4.CreateFromAxisAngle (Vector3.UnitX, rotation.X) * - // Matrix4x4.CreateFromAxisAngle (Vector3.UnitY, rotation.Y) * - // Matrix4x4.CreateFromAxisAngle (Vector3.UnitZ, rotation.Z); - // if (Type == CamType.LookAt) { - // View = Matrix4x4.CreateFromAxisAngle (Vector3.UnitX, rotation.X) * - // Matrix4x4.CreateFromAxisAngle (Vector3.UnitY, rotation.Y) * - // Matrix4x4.CreateFromAxisAngle (Vector3.UnitZ, rotation.Z) * - // Matrix4x4.CreateTranslation (position); - // } else { - // View = Matrix4x4.CreateTranslation (position) * - // Matrix4x4.CreateFromAxisAngle (Vector3.UnitZ, rotation.Z) * - // Matrix4x4.CreateFromAxisAngle (Vector3.UnitY, rotation.Y) * - // Matrix4x4.CreateFromAxisAngle (Vector3.UnitX, rotation.X); - // } - // Model = Matrix4x4.Identity; - //} - public void Update () { - Projection = Matrix4x4.CreatePerspectiveFieldOfView (fov, aspectRatio, zNear, zFar); - //matrices.view = Matrix4x4.CreateLookAt (new Vector3 (0, 0, -1), new Vector3 (0, 0, 0), Vector3.UnitY);//Matrix4x4.CreateTranslation (0, 0, -2.5f); - View = Matrix4x4.CreateTranslation (0, 0, -2.5f * zoom); - Model = - Matrix4x4.CreateFromAxisAngle (Vector3.UnitX, rotation.X) * - Matrix4x4.CreateFromAxisAngle (Vector3.UnitY, rotation.Y) * - Matrix4x4.CreateFromAxisAngle (Vector3.UnitZ, rotation.Z); - } - - } -} -- cgit v1.3.1-4-g156e