view_matrix = invert(matrix);
}
+
+Camera::Loader::Loader(Camera &c):
+ DataFile::ObjectLoader<Camera>(c)
+{
+ add("aspect_ratio", &Loader::aspect_ratio);
+ add("depth_clip", &Loader::depth_clip);
+ add("field_of_view", &Loader::field_of_view);
+ add("look_at", &Loader::look_at);
+ add("look_direction", &Loader::look_direction);
+ add("orthographic", &Loader::orthographic);
+ add("position", &Loader::position);
+ add("up_direction", &Loader::up_direction);
+}
+
+void Camera::Loader::aspect_ratio(float a)
+{
+ obj.set_aspect_ratio(a);
+}
+
+void Camera::Loader::depth_clip(float n, float f)
+{
+ obj.set_depth_clip(n, f);
+}
+
+void Camera::Loader::field_of_view(float a)
+{
+ obj.set_field_of_view(Geometry::Angle<float>::from_degrees(a));
+}
+
+void Camera::Loader::look_at(float x, float y, float z)
+{
+ obj.look_at(Vector3(x, y, z));
+}
+
+void Camera::Loader::look_direction(float x, float y, float z)
+{
+ obj.set_look_direction(Vector3(x, y, z));
+}
+
+void Camera::Loader::orthographic(float w, float h)
+{
+ obj.set_orthographic(w, h);
+}
+
+void Camera::Loader::position(float x, float y, float z)
+{
+ obj.set_position(Vector3(x, y, z));
+}
+
+void Camera::Loader::up_direction(float x, float y, float z)
+{
+ obj.set_up_direction(Vector3(x, y, z));
+}
+
} // namespace GL
} // namespace Msp
#ifndef MSP_GL_CAMERA_H_
#define MSP_GL_CAMERA_H_
+#include <msp/datafile/objectloader.h>
#include "placeable.h"
namespace Msp {
class Camera: public Placeable
{
+public:
+ class Loader: public DataFile::ObjectLoader<Camera>
+ {
+ public:
+ Loader(Camera &);
+
+ private:
+ void aspect_ratio(float);
+ void depth_clip(float, float);
+ void field_of_view(float);
+ void look_at(float, float, float);
+ void look_direction(float, float, float);
+ void orthographic(float, float);
+ void position(float, float, float);
+ void up_direction(float, float, float);
+ };
+
private:
Geometry::Angle<float> fov;
float height;
#include <msp/fs/utils.h>
#include "animation.h"
#include "armature.h"
+#include "camera.h"
#include "font.h"
#include "keyframe.h"
#include "lighting.h"
{
add_type<Animation>().suffix(".anim").keyword("animation");
add_type<Armature>().suffix(".arma").keyword("armature");
+ add_type<Camera>().keyword("camera");
add_type<Font>().keyword("font");
add_type<KeyFrame>().suffix(".kframe").keyword("keyframe");
add_type<Lighting>().suffix(".lightn").keyword("lighting");