]> git.tdb.fi Git - libs/gl.git/blobdiff - source/render/camera.h
Move frustum culling from Scene to Camera
[libs/gl.git] / source / render / camera.h
index c713f7e49608c500f572be8e28b853cfdabca050..59a0ac2e62f677c4c356339a97f5c794515d7562 100644 (file)
@@ -2,7 +2,6 @@
 #define MSP_GL_CAMERA_H_
 
 #include <msp/datafile/objectloader.h>
-#include "camera_backend.h"
 #include "placeable.h"
 #include "programdata.h"
 
@@ -23,7 +22,7 @@ YZ plane of eye space is aligned to the plane formed by the look and up
 directions.  Setting the up direction to the opposite of gravity direction is
 an easy way to keep the camera upright.
 */
-class Camera: public CameraBackend, public Placeable
+class Camera: public Placeable
 {
 public:
        class Loader: public DataFile::ObjectLoader<Camera>
@@ -58,6 +57,7 @@ private:
        Matrix view_matrix;
        Matrix proj_matrix;
        ProgramData shdata;
+       Vector4 frustum_planes[6];
 
 public:
        Camera();
@@ -125,9 +125,12 @@ public:
        /** Returns a ProgramData object containing the camera matrices. */
        const ProgramData &get_shader_data() const { return shdata; }
 
+       bool is_in_frustum(const Renderable &) const;
+
 private:
        void update_projection_matrix();
        void update_object_matrix();
+       void update_frustum_planes();
 
 public:
        void set_debug_name(const std::string &);