annotate src/zamikongine/glsl_helpers.nim @ 500:8025ab67d931

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