-
Notifications
You must be signed in to change notification settings - Fork 0
/
frame.h
54 lines (37 loc) · 1021 Bytes
/
frame.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <OpenEXR/ImfRgbaFile.h>
#include "object.h"
#include "Scene.h"
#ifndef FRAME_H
#define FRAME_H
// THe actual rendered frame. Hanldes all drawing and saving
class Frame
{
public:
Frame(int x, int y, Imf::Rgba color, int scale = 1000);
bool WriteFrame(const char* filename = "out.exr");
void SetPixel(int x, int y, Imf::Rgba color);
void SetPixel(int x, int y, double c);
void DrawLine(double x0, double y0, double x1, double y1);
void DrawTo(double x, double y);
void MoveTo(double x, double y);
void DrawTo(vec3 point);
void MoveTo(vec3 point);
vec3 PushVertThroughPipeline(vec3 vert, Matrix *C);
private:
int int_part(const double x) { return (int)floor(x); };
double frac_part(const double x) { return x - floor(x); };
double inv_frac_part(const double x) { return 1.0 - frac_part(x); };
void swap(double& x, double& y)
{
double temp = x;
x = y;
y = temp;
}
int x_res_;
int y_res_;
int scale_;
double current_x_;
double current_y_;
Imf::Rgba* rgba_data_;
};
#endif