64 lines
1.6 KiB
C
64 lines
1.6 KiB
C
#pragma once
|
|
|
|
//------------------------------------------------------------------------------------------
|
|
//~ structs
|
|
|
|
typedef union Vec3F32 Vec3F32;
|
|
union Vec3F32
|
|
{
|
|
struct
|
|
{
|
|
F32 x;
|
|
F32 y;
|
|
F32 z;
|
|
};
|
|
struct
|
|
{
|
|
F32 r;
|
|
F32 g;
|
|
F32 b;
|
|
};
|
|
F32 v[3];
|
|
};
|
|
|
|
typedef struct RngF32 RngF32;
|
|
struct RngF32
|
|
{
|
|
F32 min;
|
|
F32 max;
|
|
};
|
|
|
|
typedef struct RayF32 RayF32;
|
|
struct RayF32
|
|
{
|
|
Vec3F32 origin;
|
|
Vec3F32 direction;
|
|
};
|
|
|
|
|
|
//------------------------------------------------------------------------------------------
|
|
//~ forward declarations
|
|
|
|
|
|
__host__ __device__ inline function Vec3F32 vec3F32(F32 x, F32 y, F32 z);
|
|
__host__ __device__ inline function Vec3F32 add_V3F32(Vec3F32 a, Vec3F32 b);
|
|
__host__ __device__ inline function Vec3F32 sub_V3F32(Vec3F32 a, Vec3F32 b);
|
|
__host__ __device__ inline function Vec3F32 scale_V3F32(F32 s, Vec3F32 v);
|
|
|
|
|
|
__host__ __device__ inline function Vec3F32 ray_point_F32(F32 t, RayF32 *ray);
|
|
__host__ __device__ inline function F32 mag_V3F32(Vec3F32 a);
|
|
__host__ __device__ inline function F32 dot_V3F32(Vec3F32 a, Vec3F32 b);
|
|
__device__ inline function F32 norm_V3F32(Vec3F32 a);
|
|
|
|
__host__ __device__ function Vec3F32 lerp_V3F32(F32 s, Vec3F32 a, Vec3F32 b);
|
|
|
|
__device__ function Vec3F32 rand_uniform_V3F32(curandState *local_rand_state);
|
|
__device__ function Vec3F32 rand_uniform_range_V3F32(RngF32 rng, curandState *local_rand_state);
|
|
|
|
__host__ function F32 linear_to_gamma(F32 val);
|
|
__host__ inline function F32 h_norm_V3F32(Vec3F32 a);
|
|
|
|
__device__ function F32 clamp_F32(RngF32 rng, F32 val);
|
|
__device__ function Vec3F32 clamp_V3F32(RngF32 rng, Vec3F32 v);
|