mirror of
https://github.com/MartinOpat/cuda-based-raytrace.git
synced 2025-06-07 02:13:10 +02:00
Fixed the newly defined math function to actually work with cuda
This commit is contained in:
@@ -53,10 +53,4 @@ __device__ float clamp(float value, float min, float max) {
|
|||||||
// Normalize a float to the range [0, 1]
|
// Normalize a float to the range [0, 1]
|
||||||
__device__ float normalize(float value, float min, float max) {
|
__device__ float normalize(float value, float min, float max) {
|
||||||
return (value - min) / (max - min);
|
return (value - min) / (max - min);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Interpolate between two values
|
|
||||||
template <typename T>
|
|
||||||
__device__ T interpolate(T start, T end, float t) {
|
|
||||||
return start + t * (end - start);
|
|
||||||
}
|
|
||||||
@@ -10,8 +10,12 @@ __device__ unsigned int packUnorm4x8(float r, float g, float b, float a);
|
|||||||
__device__ float clamp(float value, float min, float max);
|
__device__ float clamp(float value, float min, float max);
|
||||||
__device__ float normalize(float value, float min, float max);
|
__device__ float normalize(float value, float min, float max);
|
||||||
|
|
||||||
|
// Interpolate between two values
|
||||||
template <typename T>
|
template <typename T>
|
||||||
__device__ float interpolate(T start, T end, float t);
|
__device__ T interpolate(T start, T end, float t) {
|
||||||
|
return start + t * (end - start);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // MAT_H
|
#endif // MAT_H
|
||||||
|
|||||||
Reference in New Issue
Block a user