Mercurial > games > semicongine
comparison semiconginev2/rendering.nim @ 1234:841e12f33c47
add: text & font rendering, not tested yet
author | sam <sam@basx.dev> |
---|---|
date | Sat, 20 Jul 2024 00:03:57 +0700 |
parents | 1cf698973dca |
children | 69489a678141 |
comparison
equal
deleted
inserted
replaced
1233:1cf698973dca | 1234:841e12f33c47 |
---|---|
83 func currentFiF*(swapchain: Swapchain): int = swapchain.currentFiF | 83 func currentFiF*(swapchain: Swapchain): int = swapchain.currentFiF |
84 | 84 |
85 type | 85 type |
86 # type aliases | 86 # type aliases |
87 SupportedGPUType = float32 | float64 | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | TVec2[int32] | TVec2[int64] | TVec3[int32] | TVec3[int64] | TVec4[int32] | TVec4[int64] | TVec2[uint32] | TVec2[uint64] | TVec3[uint32] | TVec3[uint64] | TVec4[uint32] | TVec4[uint64] | TVec2[float32] | TVec2[float64] | TVec3[float32] | TVec3[float64] | TVec4[float32] | TVec4[float64] | TMat2[float32] | TMat2[float64] | TMat23[float32] | TMat23[float64] | TMat32[float32] | TMat32[float64] | TMat3[float32] | TMat3[float64] | TMat34[float32] | TMat34[float64] | TMat43[float32] | TMat43[float64] | TMat4[float32] | TMat4[float64] | 87 SupportedGPUType = float32 | float64 | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | TVec2[int32] | TVec2[int64] | TVec3[int32] | TVec3[int64] | TVec4[int32] | TVec4[int64] | TVec2[uint32] | TVec2[uint64] | TVec3[uint32] | TVec3[uint64] | TVec4[uint32] | TVec4[uint64] | TVec2[float32] | TVec2[float64] | TVec3[float32] | TVec3[float64] | TVec4[float32] | TVec4[float64] | TMat2[float32] | TMat2[float64] | TMat23[float32] | TMat23[float64] | TMat32[float32] | TMat32[float64] | TMat3[float32] | TMat3[float64] | TMat34[float32] | TMat34[float64] | TMat43[float32] | TMat43[float64] | TMat4[float32] | TMat4[float64] |
88 PixelType = TVec1[uint8] | TVec4[uint8] | 88 Gray = TVec1[uint8] |
89 RGBA = TVec4[uint8] | |
90 PixelType = Gray | RGBA | |
89 | 91 |
90 # shader related types | 92 # shader related types |
91 DescriptorSet*[T: object] = object | 93 DescriptorSet*[T: object] = object |
92 data*: T | 94 data*: T |
93 vk: array[INFLIGHTFRAMES.int, VkDescriptorSet] | 95 vk: array[INFLIGHTFRAMES.int, VkDescriptorSet] |
344 | 346 |
345 proc `[]`*(image: Image, x, y: uint32): auto = | 347 proc `[]`*(image: Image, x, y: uint32): auto = |
346 assert x < image.width, &"{x} < {image.width} is not true" | 348 assert x < image.width, &"{x} < {image.width} is not true" |
347 assert y < image.height, &"{y} < {image.height} is not true" | 349 assert y < image.height, &"{y} < {image.height} is not true" |
348 | 350 |
349 image[].imagedata[y * image.width + x] | 351 image.data[y * image.width + x] |
350 | 352 |
351 proc `[]=`*[T](image: var Image[T], x, y: uint32, value: T) = | 353 proc `[]=`*[T](image: var Image[T], x, y: uint32, value: T) = |
352 assert x < image.width | 354 assert x < image.width |
353 assert y < image.height | 355 assert y < image.height |
354 | 356 |
355 image[].imagedata[y * image.width + x] = value | 357 image.data[y * image.width + x] = value |