Camera
This class is an implementation of a very simple Camera, it is fully written in C#, so it is a good
example of what you can do with the tools given (src).
By default, this class saves a reference to the Uber shader in order to set the View
Uniform
Matrix. To implement it into your project you must first call the Update
function, which makes use
of the WASD
keys to move in XZ and QE
to move in the Y
axis.
To properly render in a Perspective view enable those features in the Window object:
camera.Update(); // Updates position and rotation, via the Input
camera.Draw() // Sets the View uniform the given Shader
window.Background(38, 50, 56); // Clear color buffer
Window.SetPerspective(MathV.Radians(90)); // Sets Perspective view with a FOV of 90
window.HideCursor(); // Hides the cursor to lock it inside the window
window.MakeCurrent(); // Recalculates and applies the Projection Matrix
Functions
Camera
Creates a new Camera with the Uber Shader, position Vec3(0, 0, -3) and rotation Euler Vec2(-90, 0).void Update()
Updates position and rotation via Inputvoid Draw()
Sets the View uniform in the given Shadervoid SetNone()
Sets the View uniform to Mat4 IdentityMat4 GetView()
Returns a Mat4 with the Calculated View Matrix