some stuff
This commit is contained in:
@@ -59,7 +59,8 @@ file(GLOB SourceFiles
|
||||
${SrcDIR}/core/*
|
||||
${SrcDIR}/engine/*
|
||||
${SrcDIR}/display/*
|
||||
${SrcDIR}/primatives/*
|
||||
${SrcDIR}/definitions/*
|
||||
${SrcDIR}/primatives/definitions/*
|
||||
${SrcDIR}/util/*
|
||||
${TestDIR}/${CurrentTest}
|
||||
)
|
||||
|
||||
21
src/definitions/camera.cpp
Normal file
21
src/definitions/camera.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#include "camera.hpp"
|
||||
|
||||
Camera::Camera(glm::vec3 point, glm::vec3 dir, float w, float h, float f) {
|
||||
point = point;
|
||||
direction = dir;
|
||||
w = w; h = h; focalLen = f;
|
||||
}
|
||||
|
||||
void Camera::Update() {
|
||||
// Vector3 x_c = c->position;
|
||||
// Vector3 u_c = c->direction;
|
||||
// double z_p = c->focalLength;
|
||||
// Vector3 v_up = vec3_make(0.0, -1.0, 0.0);
|
||||
// Vector3 c_0 = vec3_add(x_c, vec3_mult(u_c, z_p));
|
||||
// Vector3 u_x = vec3_unit(vec3_cross(u_c, v_up));
|
||||
// Vector3 u_y = vec3_cross(vec3_mult(u_c, -1.0), u_x);
|
||||
// c->planeCenter = c_0;
|
||||
// c->planeDirectionX = u_x;
|
||||
// c->planeDirectionY = u_y;
|
||||
// // Vector3 u_z = vec3_mult(u_c, -1.0); // Normal to the view plane
|
||||
}
|
||||
@@ -5,9 +5,16 @@
|
||||
|
||||
class Camera {
|
||||
public:
|
||||
Camera(glm::vec3 point, glm::vec3 dir, float w, float h, float f = 500.0f);
|
||||
|
||||
void Update();
|
||||
|
||||
glm::vec3 point;
|
||||
glm::vec3 look;
|
||||
float fov;
|
||||
glm::vec3 direction;
|
||||
glm::vec3 planeCenter;
|
||||
glm::vec3 planeDirX;
|
||||
glm::vec3 planeDirY;
|
||||
float focalLen, w, h;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,6 +3,15 @@
|
||||
#include "camera.hpp"
|
||||
#include "scene.hpp"
|
||||
|
||||
Ray GeneratePrimaryRay(int x, int y, Scene& scene, float xSubPix = 0.5f, float ySubPix = 0.5f) {
|
||||
|
||||
Ray GeneratePrimaryRay(int x, int y, Scene& scene, float xSubPix, float ySubPix) {
|
||||
// double dy = 1.0;
|
||||
// double dx = 1.0;
|
||||
// double py = (- c->height / 2.0) + dy * ((double)y + 0.5);
|
||||
// double px = (- c->width / 2.0) + dx * ((double)x + 0.5);
|
||||
// Vector3 p = vec3_add3(c->planeCenter,
|
||||
// vec3_mult(c->planeDirectionX, px),
|
||||
// vec3_mult(c->planeDirectionY, py));
|
||||
// Vector3 u_r = vec3_unit(vec3_sub(p, c->position));
|
||||
// return ray_make(c->position, u_r);
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ class Camera;
|
||||
class Primative;
|
||||
|
||||
class Scene {
|
||||
public:
|
||||
Camera* camera;
|
||||
std::vector<Primative*> objects;
|
||||
};
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
#include "common.hpp"
|
||||
|
||||
// Give the user access to the base classes to define shit
|
||||
#include "definitions/camera.hpp"
|
||||
#include "definitions/scene.hpp"
|
||||
#include "definitions/camera.hpp"
|
||||
|
||||
class Display;
|
||||
class Renderer;
|
||||
@@ -18,7 +18,6 @@ class Renderer;
|
||||
// and the renderer passes a full framebuffer (different depending on mode) to either the
|
||||
// display or an image generator, undecided how this will work but it will make for some
|
||||
// interesting features, ImGui can be used for settings inside the progressive mode gui
|
||||
|
||||
class InfernoEngine {
|
||||
public:
|
||||
InfernoEngine();
|
||||
|
||||
@@ -11,7 +11,10 @@ int main(int argc, char** argv) {
|
||||
std::cout << "Error initializing window: " << inferno.LastError() << std::endl;
|
||||
}
|
||||
|
||||
inferno.SetScene(new Scene());
|
||||
Scene* scene = new Scene();
|
||||
scene->camera = new Camera({0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 1.0f}, 600, 600);
|
||||
|
||||
inferno.SetScene(scene);
|
||||
|
||||
inferno.Ready();
|
||||
inferno.Render();
|
||||
|
||||
Reference in New Issue
Block a user