diff options
Diffstat (limited to 'modules/gltf/structures/gltf_camera.h')
-rw-r--r-- | modules/gltf/structures/gltf_camera.h | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/modules/gltf/structures/gltf_camera.h b/modules/gltf/structures/gltf_camera.h index b7df741825..50ae10e17a 100644 --- a/modules/gltf/structures/gltf_camera.h +++ b/modules/gltf/structures/gltf_camera.h @@ -32,15 +32,22 @@ #define GLTF_CAMERA_H #include "core/io/resource.h" +#include "scene/3d/camera_3d.h" + +// Reference and test file: +// https://github.com/KhronosGroup/glTF-Tutorials/blob/master/gltfTutorial/gltfTutorial_015_SimpleCameras.md class GLTFCamera : public Resource { GDCLASS(GLTFCamera, Resource); private: + // GLTF has no default camera values, they should always be specified in + // the GLTF file. Here we default to Godot's default camera settings. bool perspective = true; - float fov_size = 75.0; - float depth_far = 4000.0; - float depth_near = 0.05; + real_t fov = Math::deg_to_rad(75.0); + real_t size_mag = 0.5; + real_t depth_far = 4000.0; + real_t depth_near = 0.05; protected: static void _bind_methods(); @@ -48,12 +55,20 @@ protected: public: bool get_perspective() const { return perspective; } void set_perspective(bool p_val) { perspective = p_val; } - float get_fov_size() const { return fov_size; } - void set_fov_size(float p_val) { fov_size = p_val; } - float get_depth_far() const { return depth_far; } - void set_depth_far(float p_val) { depth_far = p_val; } - float get_depth_near() const { return depth_near; } - void set_depth_near(float p_val) { depth_near = p_val; } + real_t get_fov() const { return fov; } + void set_fov(real_t p_val) { fov = p_val; } + real_t get_size_mag() const { return size_mag; } + void set_size_mag(real_t p_val) { size_mag = p_val; } + real_t get_depth_far() const { return depth_far; } + void set_depth_far(real_t p_val) { depth_far = p_val; } + real_t get_depth_near() const { return depth_near; } + void set_depth_near(real_t p_val) { depth_near = p_val; } + + static Ref<GLTFCamera> from_node(const Camera3D *p_light); + Camera3D *to_node() const; + + static Ref<GLTFCamera> from_dictionary(const Dictionary p_dictionary); + Dictionary to_dictionary() const; }; #endif // GLTF_CAMERA_H |