-
Notifications
You must be signed in to change notification settings - Fork 1
/
raytracer.h
36 lines (30 loc) · 886 Bytes
/
raytracer.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
#ifndef RAYTRACER_H
#define RAYTRACER_H
#include "vector.h"
#include "primitive.h"
class RayTracer {
int ScreenX, ScreenY, ScreenZ;
Vector3 vCenter;
float R;
Vector3 vLightPosition;
//int Offset;
float theta;
int current_index[4];
int max_threads;
public:
void Setup(int max_threads);
void SetNumThreads(int num) { max_threads = num; }
int GetNumThreads(void) { return max_threads; }
void Move(void);
void Render(int scan);
float RayTrace(const Ray& ray, Vector3* pInterPos, Vector3* pNormal);
void WaitEndThread(void);
bool Thread_Flag;
private:
Vector3 MakeRay(int, int, int);
Vector3 MakeNormal(const Vector3 vPoint, const Vector3 vCenter);
bool CheckIntersect(Vector3 vStart, Vector3 vRay, Vector3 vCenter, float R);
float FindIntersectPoint(Vector3 ray, Vector3 center, float R, Vector3* );
void DrawPixel();
};
#endif