annotate src/zamikongine/glsl_helpers.nim @ 36:2979b69eef55

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