snoopy/include/colour.h

30 lines
729 B
C++
Executable File

#pragma once
#include "error.h"
#include "vec3.h"
// for writing to stdout
#include <iostream>
// for writing to socket
#include <unistd.h>
class colour : public vec3
{
using vec3::vec3;
public:
friend colour operator*(const colour& u, const colour& v);
friend colour lerp(const colour& a, const colour& b, double t);
colour correct_gamma(int samples);
friend void write_colour_to_socket(int sockfd, colour pixel_colour, int samples_per_pixel);
friend void write_colour_to_stream(std::ostream &out, colour pixel_colour, int samples_per_pixel);
friend int format_component(double component);
};
const colour pink(254.0/255.0, 226.0/255.0, 170.0/255.0);
const colour grey(0.133, 0.133, 0.133);