Created
July 11, 2017 22:36
-
-
Save anonymous/b7125939c75db015d1e537a196cbb244 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.flaghacker.renderer.engine | |
import org.joml.Matrix4f | |
import org.joml.Quaternionf | |
import org.joml.Vector3f | |
class Camera( | |
position: Vector3f, | |
rotation: Quaternionf, | |
fov: Float, | |
aspect: Float, | |
nearPlane: Float, | |
farPlane: Float | |
) { | |
var position = position; set(value) = updateView() | |
var rotation = rotation; set(value) = updateView() | |
var fov = fov; set(value) = updateProjection() | |
var aspect = aspect; set(value) = updateProjection() | |
var nearPlane = nearPlane; set(value) = updateProjection() | |
var farPlane = farPlane; set(value) = updateProjection() | |
lateinit var viewMatrix: Matrix4f | |
lateinit var projectionMatrix: Matrix4f | |
init { | |
updateView() | |
updateProjection() | |
} | |
private fun updateView() { | |
viewMatrix = Matrix4f() | |
//TODO | |
} | |
private fun updateProjection() { | |
projectionMatrix = Matrix4f().perspective(fov, aspect, nearPlane, farPlane) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment