added shader

This commit is contained in:
djaidjai committed 2025-01-05 22:48:09 +01:00
1 parent 126ef4ace8
commit edf4d9fd60
17 files changed
+257 -153

No files matched your search

+5 -5
View File
@@ -34,13 +34,13 @@ __device__ unsigned int packUnorm4x8(float r, float g, float b, float a) {
uint out;
} u;
double len = sqrt(r*r + g*g + b*b + a*a);
float len = sqrtf(r*r + g*g + b*b + a*a);
// This is a Vec4 but i can't be bothered to make that its own struct/class; FIXME: maybe do that if we need to?
std::vector<float> v{r/len, g/len, b/len, a/len};
for (int i = 0; i < v.size(); i++) {
u.in[i] = round(std::clamp(v[i], 0.0f, 1.0f) * 255.0f);
}
u.in[0] = round(r/len * 255.0f);
u.in[1] = round(g/len * 255.0f);
u.in[2] = round(b/len * 255.0f);
u.in[3] = round(a/len * 255.0f);
return u.out;
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.