Create material abstraction
This commit is contained in:
@@ -1,22 +1,18 @@
|
||||
#ifndef OBJ_H
|
||||
#define OBJ_H
|
||||
|
||||
#include "material.h"
|
||||
#include "ray.h"
|
||||
|
||||
#define SPHERE(x, y, z, r) \
|
||||
#define SPHERE(x, y, z, r, m) \
|
||||
{ \
|
||||
.intersect = intersect_sphere, \
|
||||
.material = m, \
|
||||
.params = { \
|
||||
.sphere = { .centre = { x, y, z }, .radius = r }, \
|
||||
}, \
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
vec3_t point, normal;
|
||||
double t;
|
||||
bool front;
|
||||
} hit_t;
|
||||
|
||||
typedef struct {
|
||||
vec3_t centre;
|
||||
double radius;
|
||||
@@ -32,6 +28,7 @@ typedef bool intersect_fn_t(
|
||||
|
||||
typedef struct {
|
||||
intersect_fn_t *intersect;
|
||||
material_t material;
|
||||
obj_params_t params;
|
||||
} obj_t;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user