TinyRaytracer 0.1
A simple C++ raytracer
Loading...
Searching...
No Matches
draw.hpp
Go to the documentation of this file.
1
11#ifndef DRAW_H
12#define DRAW_H
13#include "libpng.h"
14#include "helper.hpp"
15#include "keywords.hpp"
16#include "struct.hpp"
17
18#include <vector>
19#include <tuple>
20
21void render(Image& img);
22
23RGBA shootPrimaryRay(double x,double y);
24
26
28
29RGBA diffuseLight(const ObjectInfo& obj);
30
31RGBA reflectionLight(const Ray& ray,const ObjectInfo& obj);
32
33RGBA refractionLight(const Ray& ray,const ObjectInfo& obj);
34
35RGBA globalIllumination(const ObjectInfo& obj,int gi_bounce);
36
37ObjectInfo checkPlane(Ray& ray, bool exit_early = false);
38
39RGBA getColorSun(double lambert,RGB objColor,RGB lightColor);
40
41RGBA getColorBulb(double lambert,RGB objColor,RGB lightColor,double t);
42
43RGBA getTexture();
44#endif
ObjectInfo is a class that passes the parameters of a ray hit, and the details of the object that was...
Definition: object.hpp:50
Definition: struct.hpp:39
Definition: struct.hpp:20
Class Ray, consists of a eye and direction.
Definition: struct.hpp:68
RGBA getColorBulb(double lambert, RGB objColor, RGB lightColor, double t)
Get the Color of Bulb (scene light)
Definition: draw.cpp:366
RGBA shootPrimaryRay(double x, double y)
Shoots a primary ray into the scene, at pixel location (x,y).
Definition: draw.cpp:69
RGBA globalIllumination(const ObjectInfo &obj, int gi_bounce)
Get the global illumination light color.
Definition: draw.cpp:279
void render(Image &img)
The render function that loops over the screen of pixels.
Definition: draw.cpp:28
RGBA getColorSun(double lambert, RGB objColor, RGB lightColor)
Get the Color of Sun (directional light)
Definition: draw.cpp:347
RGBA reflectionLight(const Ray &ray, const ObjectInfo &obj)
Get the reflection light color.
Definition: draw.cpp:163
ObjectInfo hitNearest(Ray &ray)
Gets the nearest object in the path of the ray.
Definition: draw.cpp:98
ObjectInfo hitMiss()
Does nothing.
Definition: draw.cpp:110
ObjectInfo checkPlane(Ray &ray, bool exit_early=false)
Check if any planes are intersecting with the ray.
Definition: draw.cpp:314
RGBA diffuseLight(const ObjectInfo &obj)
Get the diffuse light color,with shadow checking.
Definition: draw.cpp:123
RGBA refractionLight(const Ray &ray, const ObjectInfo &obj)
Get the refraction light color.
Definition: draw.cpp:217