changeset 116:bbe221af55d1

did: improve imports
author Sam <sam@basx.dev>
date Wed, 05 Apr 2023 00:40:38 +0700
parents e18538442837
children 40ff2453855e
files src/semicongine.nim src/semicongine/color.nim src/semicongine/mesh.nim
diffstat 3 files changed, 21 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/src/semicongine.nim	Mon Apr 03 00:10:08 2023 +0700
+++ b/src/semicongine.nim	Wed Apr 05 00:40:38 2023 +0700
@@ -1,27 +1,21 @@
-import semicongine/buffer
 import semicongine/color
-import semicongine/descriptor
-import semicongine/engine
+import semicongine/config
+import semicongine/entity
 import semicongine/events
-import semicongine/image
-import semicongine/math/matrix
+import semicongine/gpu_data
+import semicongine/math
 import semicongine/mesh
-import semicongine/shader
-import semicongine/thing
-import semicongine/math/vector
-import semicongine/vertex
-import semicongine/window
+import semicongine/platform/window
+import semicongine/scene
+import semicongine/vulkan
 
-export buffer
 export color
-export descriptor
-export engine
+export config
+export entity
 export events
-export image
-export matrix
+export gpu_data
+export math
 export mesh
-export shader
-export thing
-export vector
-export vertex
 export window
+export scene
+export vulkan
--- a/src/semicongine/color.nim	Mon Apr 03 00:10:08 2023 +0700
+++ b/src/semicongine/color.nim	Wed Apr 05 00:40:38 2023 +0700
@@ -2,7 +2,7 @@
 
 import ./math/vector
 
-func RGBfromHex*(value: string): Vec3 =
+func RGBfromHex*(value: string): Vec3f =
   assert value != ""
   var hex = value
   if hex[0] == '#':
@@ -15,9 +15,9 @@
   discard parseHex(hex[0 .. 1], r) == 2
   discard parseHex(hex[2 .. 3], g) == 2
   discard parseHex(hex[4 .. 5], b) == 2
-  return Vec3([float32(r), float32(g), float32(b)]) / 255'f
+  return Vec3f([float32(r), float32(g), float32(b)]) / 255'f
 
-func RGBAfromHex*(value: string): Vec4 =
+func RGBAfromHex*(value: string): Vec4f =
   assert value != ""
   var hex = value
   if hex[0] == '#':
@@ -36,7 +36,7 @@
   discard parseHex(hex[2 .. 3], g)
   discard parseHex(hex[4 .. 5], b)
   discard parseHex(hex[6 .. 7], a)
-  return Vec4([float32(r), float32(g), float32(b), float32(a)]) / 255'f
+  return Vec4f([float32(r), float32(g), float32(b), float32(a)]) / 255'f
 
-func gamma*[T: Vec3|Vec4](color: T, gamma: float32): auto =
+func gamma*[T: Vec3f|Vec4f](color: T, gamma: float32): T =
   return pow(color, gamma)
--- a/src/semicongine/mesh.nim	Mon Apr 03 00:10:08 2023 +0700
+++ b/src/semicongine/mesh.nim	Wed Apr 05 00:40:38 2023 +0700
@@ -41,7 +41,7 @@
 method `$`*(mesh: Mesh): string =
   &"Mesh ({mesh.vertexCount})"
 
-func initMesh*(positions: openArray[Vec3f], colors: openArray[Vec3f]=[]): Mesh =
+func newMesh*(positions: openArray[Vec3f], colors: openArray[Vec3f]=[]): Mesh =
   assert colors.len == 0 or colors.len == positions.len
   result = new Mesh
   result.vertexCount = uint32(positions.len)
@@ -51,7 +51,7 @@
     result.data[asAttribute(default(Vec3f), "color")] = MeshData(thetype: Color, color: colors.toSeq)
 
 
-func initMesh*(positions: openArray[Vec3f], indices: openArray[array[3, uint32|int32]]): auto =
+func newMesh*(positions: openArray[Vec3f], indices: openArray[array[3, uint32|int32]]): auto =
   let meshdata = {asAttribute(default(Vec3f), "position"): MeshData(thetype: Position, position: positions.toSeq)}.toTable
   if uint16(positions.len) < high(uint16):
     var smallIndices = newSeq[array[3, uint16]](indices.len)
@@ -64,7 +64,7 @@
       bigIndices[i] = [uint32(tri[0]), uint32(tri[1]), uint32(tri[3])]
     Mesh(vertexCount: uint32(positions.len), data: meshdata, indexType: Big, bigIndices: bigIndices)
 
-func initMesh*(positions: openArray[Vec3f], indices: openArray[array[3, uint16|int16]]): auto =
+func newMesh*(positions: openArray[Vec3f], indices: openArray[array[3, uint16|int16]]): auto =
   let meshdata = {asAttribute(default(Vec3f), "position"): MeshData(thetype: Position, position: positions.toSeq)}.toTable
   var smallIndices = newSeq[array[3, uint16]](indices.len)
   for i, tri in enumerate(indices):