-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvector3_cl.h
More file actions
46 lines (35 loc) · 1.25 KB
/
vector3_cl.h
File metadata and controls
46 lines (35 loc) · 1.25 KB
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
#ifndef VECTOR3_CL_H
#define VECTOR3_CL_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __APPLE__
#include <OpenCL/cl.h>
#else
#include <CL/cl_platform.h>
#endif
typedef cl_float4 Vector3;
Vector3 initVector3(float x, float y, float z);
Vector3 add(const Vector3 a, const Vector3 b);
Vector3 add3(const Vector3 a, const Vector3 b, const Vector3 c);
Vector3 add4(const Vector3 a, const Vector3 b, const Vector3 c, const Vector3 d);
Vector3 sub(const Vector3 a, const Vector3 b);
Vector3 mul(const Vector3 b, float a);
Vector3 neg(const Vector3 v);
Vector3 div_vec3(const Vector3 a, float b);
void inc(Vector3 *a, const Vector3 b); //increment
Vector3 createVector3(float x, float y, float z);
Vector3 vec3(float x, float y, float z);
float dot(const Vector3 a, const Vector3 b);
Vector3 cross(const Vector3 a, const Vector3 b);
float squaredLength(const Vector3 a);
float length(const Vector3 a);
Vector3 normalized(const Vector3 a);
//Builds an arbitrary orthogonal coordinate system, with one of its axes being 'ndir'
void createBase( const Vector3 ndir, Vector3 *c1, Vector3 *c2);
Vector3 getCosineDistributedRandomRay(const Vector3 ndir);
Vector3 getDiffuseSkyRandomRay( const Vector3 ndir);
#ifdef __cplusplus
}
#endif
#endif