std::string sequence_name;
};
-class Camera: public Component
+struct CameraData
{
-public:
- using Setup = CameraSetup;
-
-private:
- const Setup &setup;
Geometry::Angle<float> fov_y;
LinAl::Vector<float, 2> size;
float height;
float near_clip;
float far_clip;
+ bool is_orthographic() const { return fov_y==Geometry::Angle<float>::zero(); }
+ Geometry::Angle<float> get_fov_horizontal() const { return Geometry::atan(tan(fov_y/2.0f)*get_aspect())*2.0f; }
+ float get_aspect() const { return size.x/size.y; }
+};
+
+class Camera: public BufferedComponent<CameraData>
+{
+public:
+ using Setup = CameraSetup;
+
+private:
+ const Setup &setup;
+
public:
Camera(Handle<Entity>, const Setup &);
void set_field_of_view(Geometry::Angle<float>, float);
void set_size(const LinAl::Vector<float, 2> &);
- bool is_orthographic() const { return fov_y==Geometry::Angle<float>::zero(); }
- Geometry::Angle<float> get_fov_vertical() const { return fov_y; }
- Geometry::Angle<float> get_fov_horizontal() const { return Geometry::atan(tan(fov_y/2.0f)*get_aspect())*2.0f; }
- const LinAl::Vector<float, 2> &get_size() const { return size; }
- float get_aspect() const { return size.x/size.y; }
- float get_near_clip() const { return near_clip; }
- float get_far_clip() const { return far_clip; }
+ bool is_orthographic() const { return read().is_orthographic(); }
+ Geometry::Angle<float> get_fov_vertical() const { return read().fov_y; }
+ Geometry::Angle<float> get_fov_horizontal() const { return read().get_fov_horizontal(); }
+ const LinAl::Vector<float, 2> &get_size() const { return read().size; }
+ float get_aspect() const { return read().get_aspect(); }
+ float get_near_clip() const { return read().near_clip; }
+ float get_far_clip() const { return read().far_clip; }
CameraScaling get_scaling() const { return setup.scaling; }
const std::string &get_sequence_name() const { return setup.sequence_name; }
};