diff 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
line wrap: on
line diff
--- a/semiconginev2/rendering.nim	Fri Jul 19 21:25:42 2024 +0700
+++ b/semiconginev2/rendering.nim	Sat Jul 20 00:03:57 2024 +0700
@@ -85,7 +85,9 @@
 type
   # type aliases
   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]
-  PixelType = TVec1[uint8] | TVec4[uint8]
+  Gray = TVec1[uint8]
+  RGBA = TVec4[uint8]
+  PixelType = Gray | RGBA
 
   # shader related types
   DescriptorSet*[T: object] = object
@@ -346,10 +348,10 @@
   assert x < image.width, &"{x} < {image.width} is not true"
   assert y < image.height, &"{y} < {image.height} is not true"
 
-  image[].imagedata[y * image.width + x]
+  image.data[y * image.width + x]
 
 proc `[]=`*[T](image: var Image[T], x, y: uint32, value: T) =
   assert x < image.width
   assert y < image.height
 
-  image[].imagedata[y * image.width + x] = value
+  image.data[y * image.width + x] = value