shooter/engine/Camera.h

42 lines
863 B
C
Raw Normal View History

2021-09-13 15:53:43 +03:00
//
// Created by Иван Ильин on 14.01.2021.
//
#ifndef ENGINE_CAMERA_H
#define ENGINE_CAMERA_H
#include <vector>
2021-10-31 11:39:08 +03:00
#include <SFML/OpenGL.hpp>
2021-09-13 15:53:43 +03:00
#include "Plane.h"
#include "Mesh.h"
2021-10-31 11:39:08 +03:00
class Camera final : public Object {
2021-09-13 15:53:43 +03:00
private:
std::vector<std::shared_ptr<Triangle>> _triangles{};
2021-10-02 20:36:07 +03:00
std::vector<Plane> _clipPlanes{};
bool _ready = false;
2021-10-02 20:36:07 +03:00
double _aspect = 0;
2021-10-22 19:42:32 +03:00
2021-10-30 11:18:31 +03:00
Matrix4x4 _SP;
2021-09-13 15:53:43 +03:00
public:
2021-10-28 16:58:02 +03:00
Camera() : Object(ObjectNameTag("Camera")) {};
2021-10-31 11:39:08 +03:00
Camera(const Camera &camera) = delete;
2021-09-13 15:53:43 +03:00
void init(int width, int height, double fov = 110.0, double ZNear = 0.1, double ZFar = 5000.0);
std::vector<std::shared_ptr<Triangle>> project(std::shared_ptr<Mesh> mesh);
2021-09-13 15:53:43 +03:00
void clear();
2021-09-13 15:53:43 +03:00
[[nodiscard]] int buffSize() const { return _triangles.size(); }
2021-10-31 11:39:08 +03:00
std::vector<std::shared_ptr<Triangle>> sorted();
2021-10-22 19:42:32 +03:00
2021-09-13 15:53:43 +03:00
};
#endif //INC_3DZAVR_CAMERA_H