feat: CameraNode fov is now configurable
This commit is contained in:
parent
62c36b9660
commit
2fbc198d7d
5 changed files with 18 additions and 6 deletions
|
|
@ -20,6 +20,11 @@ impl_SceneNodeEntity_for(CameraNode,
|
|||
|
||||
SceneNode *CreateCameraNode() {
|
||||
CameraNode *self = new(CameraNode);
|
||||
*self = (CameraNode){
|
||||
.fov = 60,
|
||||
.node = NULL,
|
||||
.transform = tc_null(Transformable)
|
||||
};
|
||||
return CreateSceneNode(CameraNode_as_SceneNodeEntity(self));
|
||||
}
|
||||
|
||||
|
|
@ -51,7 +56,7 @@ Camera3D CameraNodeGetCamera(CameraNode *self) {
|
|||
Vector3 forward = MATRIX_FORWARD(mat);
|
||||
// construct a new camera at the global transform location and facing the forward vector
|
||||
return (Camera3D){
|
||||
.fovy = 90,
|
||||
.fovy = self->fov,
|
||||
.position = global_transform.translation,
|
||||
.projection = CAMERA_PERSPECTIVE,
|
||||
.target = Vector3Add(global_transform.translation, forward),
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
typedef struct CameraNode {
|
||||
SceneNode *node;
|
||||
Transformable transform;
|
||||
float fov;
|
||||
} CameraNode;
|
||||
|
||||
//! Instantiate new camera node
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue