Mercurial > games > semicongine
comparison src/zamikongine/glsl_helpers.nim @ 493:680c4b8ca28a
add: working implementation of uniforms
author | Sam <sam@basx.dev> |
---|---|
date | Sat, 14 Jan 2023 23:34:50 +0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
492:d63d980fa3bb | 493:680c4b8ca28a |
---|---|
1 import ./math/vector | |
2 import ./math/matrix | |
3 | |
4 func getGLSLType*[T](): string = | |
5 # todo: likely not correct as we would need to enable some | |
6 # extensions somewhere (Vulkan/GLSL compiler?) to have | |
7 # everything work as intended. Or maybe the GPU driver does | |
8 # some automagic conversion stuf.. | |
9 when T is uint8: "uint" | |
10 elif T is int8: "int" | |
11 elif T is uint16: "uint" | |
12 elif T is int16: "int" | |
13 elif T is uint32: "uint" | |
14 elif T is int32: "int" | |
15 elif T is uint64: "uint" | |
16 elif T is int64: "int" | |
17 elif T is float32: "float" | |
18 elif T is float64: "double" | |
19 | |
20 elif T is Vec2[uint8]: "uvec2" | |
21 elif T is Vec2[int8]: "ivec2" | |
22 elif T is Vec2[uint16]: "uvec2" | |
23 elif T is Vec2[int16]: "ivec2" | |
24 elif T is Vec2[uint32]: "uvec2" | |
25 elif T is Vec2[int32]: "ivec2" | |
26 elif T is Vec2[uint64]: "uvec2" | |
27 elif T is Vec2[int64]: "ivec2" | |
28 elif T is Vec2[float32]: "vec2" | |
29 elif T is Vec2[float64]: "dvec2" | |
30 | |
31 elif T is Vec3[uint8]: "uvec3" | |
32 elif T is Vec3[int8]: "ivec3" | |
33 elif T is Vec3[uint16]: "uvec3" | |
34 elif T is Vec3[int16]: "ivec3" | |
35 elif T is Vec3[uint32]: "uvec3" | |
36 elif T is Vec3[int32]: "ivec3" | |
37 elif T is Vec3[uint64]: "uvec3" | |
38 elif T is Vec3[int64]: "ivec3" | |
39 elif T is Vec3[float32]: "vec3" | |
40 elif T is Vec3[float64]: "dvec3" | |
41 | |
42 elif T is Vec4[uint8]: "uvec4" | |
43 elif T is Vec4[int8]: "ivec4" | |
44 elif T is Vec4[uint16]: "uvec4" | |
45 elif T is Vec4[int16]: "ivec4" | |
46 elif T is Vec4[uint32]: "uvec4" | |
47 elif T is Vec4[int32]: "ivec4" | |
48 elif T is Vec4[uint64]: "uvec4" | |
49 elif T is Vec4[int64]: "ivec4" | |
50 elif T is Vec4[float32]: "vec4" | |
51 elif T is Vec4[float64]: "dvec4" | |
52 | |
53 elif T is Mat22[float32]: "mat2" | |
54 elif T is Mat23[float32]: "mat32" | |
55 elif T is Mat32[float32]: "mat23" | |
56 elif T is Mat33[float32]: "mat3" | |
57 elif T is Mat34[float32]: "mat43" | |
58 elif T is Mat43[float32]: "mat34" | |
59 elif T is Mat44[float32]: "mat4" | |
60 | |
61 elif T is Mat22[float64]: "dmat2" | |
62 elif T is Mat23[float64]: "dmat32" | |
63 elif T is Mat32[float64]: "dmat23" | |
64 elif T is Mat33[float64]: "dmat3" | |
65 elif T is Mat34[float64]: "dmat43" | |
66 elif T is Mat43[float64]: "dmat34" | |
67 elif T is Mat44[float64]: "dmat4" |