Browse Source

merge

Jennie
Joel 4 years ago
parent
commit
cb5be69271
  1. 1
      camera.h
  2. 9
      main.c
  3. 6
      types.h

1
camera.h

@ -0,0 +1 @@ @@ -0,0 +1 @@
struct pixel_info march(struct ray *r, struct object *scene);

9
main.c

@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
#include "main.h"
#include "queue.h"
#include "camera.h"
#include <SDL2/SDL_render.h>
#include <SDL2/SDL_stdinc.h>
#include <SDL2/SDL_timer.h>
@ -95,10 +96,10 @@ int main(int argc, char **argv) { @@ -95,10 +96,10 @@ int main(int argc, char **argv) {
/* march the rays */
for (int i = 0; i < 100; i++) {
for (int j = 0; i < 100; j++) {
struct ray r = {
.pos = new_vec(4);
.ray = normalise_vec_ip(new_vec3(i, j, 100));
}
struct ray r = (struct ray) {
.pos = *new_vec(4),
.dir = *normalise_vec_ip(new_vec3(i, j, 100)),
};
struct pixel_info p = march(&r, /* what we want to draw */);
sdlb_draw_col_pixel(p.col, i, j);
}

6
types.h

@ -1,8 +1,6 @@ @@ -1,8 +1,6 @@
#ifndef TYPES_H
#define TYPES_H
#define color int
#define B_WINDOW_WIDTH 800
#define B_WINDOW_HEIGHT 600
#define B_INTERNAL_HEIGHT 800
@ -31,7 +29,7 @@ struct camera @@ -31,7 +29,7 @@ struct camera
struct pixel_info
{
int flags; /* 0 - no collide */
struct color col;
struct colour col;
int iterations;
double travel_dist;
double scene_dist;
@ -48,7 +46,7 @@ struct solid { @@ -48,7 +46,7 @@ struct solid {
struct object
{
struct solid sol;
color (*col)(struct ray);
struct colour (*col)(struct ray);
};
#endif

Loading…
Cancel
Save