Background test
This commit is contained in:
@ -5,6 +5,7 @@
|
||||
|
||||
#include "Transform.hpp"
|
||||
#include "scene/SceneItem.hpp"
|
||||
#include "util/mathutils.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
@ -69,6 +70,16 @@ void Transform::lookAt(glm::vec3 pos, glm::vec3 look, glm::vec3 up) {
|
||||
this->setWorldTransform(glm::lookAt(pos, look, up));
|
||||
}
|
||||
|
||||
float_t Transform::lookAtPixelPerfect(
|
||||
glm::vec3 position, glm::vec3 look, float_t viewportHeight, float_t fov
|
||||
) {
|
||||
float_t z = (
|
||||
tanf((mathDeg2Rad(180.0f) - fov) / 2.0f) *
|
||||
(viewportHeight/2.0f)
|
||||
);
|
||||
this->lookAt(glm::vec3(position.x, position.y, position.z + z), look);
|
||||
return z;
|
||||
}
|
||||
|
||||
glm::vec3 Transform::getLocalPosition() {
|
||||
return this->localPosition;
|
||||
|
Reference in New Issue
Block a user