2023-01-15 22:34:02 +00:00
|
|
|
#pragma once
|
|
|
|
#include <vector>
|
|
|
|
#include <memory>
|
|
|
|
#include "WorldObject.h"
|
|
|
|
#include "../shape/Shape.h"
|
2023-01-19 20:46:41 +00:00
|
|
|
#include "../shape/Vector2.h"
|
2023-01-15 22:34:02 +00:00
|
|
|
|
|
|
|
class Camera {
|
|
|
|
public:
|
|
|
|
Camera(double focalLength, double x, double y, double z);
|
|
|
|
|
|
|
|
std::vector<std::unique_ptr<Shape>> draw(WorldObject& object);
|
2023-01-19 20:46:41 +00:00
|
|
|
void findZPos(WorldObject& object);
|
2023-07-05 11:02:28 +00:00
|
|
|
void setFocalLength(double focalLength);
|
2023-01-15 22:34:02 +00:00
|
|
|
private:
|
2023-01-19 20:46:41 +00:00
|
|
|
const double VERTEX_VALUE_THRESHOLD = 1.0;
|
|
|
|
const double CAMERA_MOVE_INCREMENT = -0.1;
|
|
|
|
const int SAMPLE_RENDER_SAMPLES = 50;
|
2023-01-19 23:02:52 +00:00
|
|
|
const int VERTEX_SAMPLES = 1000;
|
2023-01-19 20:46:41 +00:00
|
|
|
const int MAX_NUM_STEPS = 1000;
|
|
|
|
|
2023-07-05 11:02:28 +00:00
|
|
|
std::atomic<double> focalLength;
|
2023-01-15 22:34:02 +00:00
|
|
|
double x, y, z;
|
2023-01-19 20:46:41 +00:00
|
|
|
|
|
|
|
std::vector<Vector2> sampleVerticesInRender(WorldObject& object);
|
|
|
|
double maxVertexValue(std::vector<Vector2>& vertices);
|
|
|
|
Vector2 project(double objRotateX, double objRotateY, double objRotateZ, double x, double y, double z);
|
2023-01-15 22:34:02 +00:00
|
|
|
};
|