changeset 1279:e0ba4aead324

merge
author sam <sam@basx.dev>
date Mon, 29 Jul 2024 15:43:44 +0700
parents 772bb32c4368 (current diff) 01138e6257dd (diff)
children c09cdff9a97e
files tests/test_gltf.nim
diffstat 11 files changed, 35 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Mon Jul 29 00:00:28 2024 +0700
+++ b/.hgtags	Mon Jul 29 15:43:44 2024 +0700
@@ -6,3 +6,9 @@
 6deb5ceaa3fb6db0d41b562e8db2b13a4874d1f7 hg
 e0f0a0be7880c072dcf20ba5f3de93a3da9c78c8 main
 cb4d626ca6711abb89eed99c776e274cadb1c271 hg2
+cb4d626ca6711abb89eed99c776e274cadb1c271 hg2
+0000000000000000000000000000000000000000 hg2
+6deb5ceaa3fb6db0d41b562e8db2b13a4874d1f7 hg
+0000000000000000000000000000000000000000 hg
+e0f0a0be7880c072dcf20ba5f3de93a3da9c78c8 main
+0000000000000000000000000000000000000000 main
--- a/README.md	Mon Jul 29 00:00:28 2024 +0700
+++ b/README.md	Mon Jul 29 15:43:44 2024 +0700
@@ -15,16 +15,17 @@
 The engine currently features the following:
 
 - No dependencies outside of this repo (except zip/unzip on Linux). All
-  dependencies are included.
+  dependencies are included (`libs` for library dependencies, `tools` for
+  binaries/scripts, `semicongine/thirdparty` for code dependencies)
 - Low-level, Vulkan-base rendering system
-- All vertex/uniform/descriptors/shader-formats, shaders can and must be
-  defined "freely". The only restriction that we currently have, is that vertex
-  data is non-interleaved.
+- All vertex/uniform/descriptors/shader-formats can and must be defined
+  "freely". The only restriction that we currently have, is that vertex data is
+  non-interleaved.
 - A ton of compiletime checks to ensure the defined mesh-data and shaders are
   compatible for rendering
 - Simple audio mixer, should suffice for most things
 - Simple input-system, no controller support at this time
-- Resource packaging of images, audio and 3D files
+- Resource packaging of images, audio and 3D files as either folders, zip files or embedded in the executable
 - Simple font and text rendering
 - A few additional utils like a simple storage API, a few algorithms for
   collision detection, noise generation and texture packing, and a simple
@@ -113,7 +114,7 @@
 
 ```
 
-## Roadmap
+## Future development
 
 For now all features that I need are implemented. I will gradually add more
 stuff that I need, based on the games that I am developing. Here are a few
@@ -121,6 +122,6 @@
 more experience what can/should be used across different projects:
 
 - [ ] More support for glTF format (JPEG textures, animations, morphing)
-- [ ] Maybe some often used utils like camera-controllers, offscreen-rendering, shadow-map rendering, etc.
-- [ ] Maybe some UI-stuff
+- [ ] Some often used utils like camera-controllers, offscreen-rendering, shadow-map rendering, etc.
+- [ ] Some UI-stuff
 - [ ] Controller support
--- a/semicongine.nim	Mon Jul 29 00:00:28 2024 +0700
+++ b/semicongine.nim	Mon Jul 29 15:43:44 2024 +0700
@@ -55,8 +55,3 @@
   include ./semicongine/contrib/settings
   include ./semicongine/contrib/algorithms/collision
   include ./semicongine/contrib/algorithms/noise
-
-if not defined(release):
-  setLogFilter(lvlAll)
-else:
-  setLogFilter(lvlWarn)
--- a/semicongine/core/buildconfig.nim	Mon Jul 29 00:00:28 2024 +0700
+++ b/semicongine/core/buildconfig.nim	Mon Jul 29 15:43:44 2024 +0700
@@ -12,10 +12,14 @@
 # build configuration
 # =====================
 
+
 # log level
-const LOGLEVEL {.strdefine.}: string = "Warn"
+when not defined(release):
+  const LOGLEVEL {.strdefine.}: string = "Debug"
+else:
+  const LOGLEVEL {.strdefine.}: string = "Warn"
+
 const ENGINE_LOGLEVEL* = parseEnum[Level]("lvl" & LOGLEVEL)
-
 # resource bundleing settings, need to be configured per project
 const PACKAGETYPE* {.strdefine.}: string = "exe" # dir, zip, exe
 static:
--- a/semicongine/core/matrix.nim	Mon Jul 29 00:00:28 2024 +0700
+++ b/semicongine/core/matrix.nim	Mon Jul 29 15:43:44 2024 +0700
@@ -443,7 +443,7 @@
 makeRandomMatrixInit(TMat43)
 makeRandomMatrixInit(TMat4)
 
-func Perspective*(fovy, aspect, zNear, zFar: float32): Mat4 =
+func Projection*(fovy, aspect, zNear, zFar: float32): Mat4 =
   let tanHalfFovy = 1 / tan(fovy / 2)
   return Mat4(data: [
     tanHalfFovy / aspect, 0, 0, 0,
--- a/semicongine/core/vector.nim	Mon Jul 29 00:00:28 2024 +0700
+++ b/semicongine/core/vector.nim	Mon Jul 29 15:43:44 2024 +0700
@@ -63,6 +63,14 @@
 func NewVec4u*(x = 0'u32, y = 0'u32, z = 0'u32, a = 0'u32): auto =
   Vec4u([x, y, z, a])
 
+# shortcuts
+func vec2*[T: SomeNumber](x, y: T): Vec2f =
+  Vec2f([float32(x), float32(y)])
+func vec3*[T: SomeNumber](x, y, z: T): Vec3f =
+  Vec3f([float32(x), float32(y), float32(z)])
+func vec4*[T: SomeNumber](x, y , z, w: T): Vec4f =
+  Vec4f([float32(x), float32(y), float32(z), float32(w)])
+
 # generates constants: Xf, Xf32, Xf64, Xi, Xi8, Xi16, Xi32, Xi64
 # Also for Y, Z, R, G, B and One
 # not sure if this is necessary or even a good idea...
--- a/semicongine/rendering.nim	Mon Jul 29 00:00:28 2024 +0700
+++ b/semicongine/rendering.nim	Mon Jul 29 15:43:44 2024 +0700
@@ -48,7 +48,7 @@
     swapchain*: Swapchain
     # unclear as of yet
     anisotropy*: float32 = 0 # needs to be enable during device creation
-  Renderpass* = ref object
+  RenderPass* = ref object
     vk*: VkRenderPass
     samples*: VkSampleCountFlagBits
     depthBuffer*: bool
--- a/semicongine/rendering/renderpasses.nim	Mon Jul 29 00:00:28 2024 +0700
+++ b/semicongine/rendering/renderpasses.nim	Mon Jul 29 15:43:44 2024 +0700
@@ -189,7 +189,7 @@
   )
 
 template WithRenderPass*(
-  theRenderpass: RenderPass,
+  theRenderPass: RenderPass,
   theFramebuffer: VkFramebuffer,
   commandbuffer: VkCommandBuffer,
   renderWidth: uint32,
@@ -204,7 +204,7 @@
     ]
     renderPassInfo = VkRenderPassBeginInfo(
       sType: VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO,
-      renderPass: theRenderpass.vk,
+      renderPass: theRenderPass.vk,
       framebuffer: theFramebuffer,
       renderArea: VkRect2D(
         offset: VkOffset2D(x: 0, y: 0),
--- a/sync-git.sh	Mon Jul 29 00:00:28 2024 +0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-rsync -r --exclude '.hg/' --exclude 'build/' --exclude 'sync-git.sh' . /home/sam/git/semicongine/
-
-git -C /home/sam/git/semicongine/ commit -a -m "$( hg log --limit 1 --template "{desc}" )"
--- a/tests/test_gltf.nim	Mon Jul 29 00:00:28 2024 +0700
+++ b/tests/test_gltf.nim	Mon Jul 29 15:43:44 2024 +0700
@@ -177,7 +177,7 @@
     let view = Rotate(-camPitch, X) * Rotate(-camYaw, Y) * Translate(-camPos)
     descriptors.data.camera.data.view = view
     descriptors.data.camera.data.normal = view
-    descriptors.data.camera.data.projection = Perspective(PI / 2, aspect = GetAspectRatio(), zNear = 0.01, zFar = 20)
+    descriptors.data.camera.data.projection = Projection(PI / 2, aspect = GetAspectRatio(), zNear = 0.01, zFar = 20)
 
     UpdateGPUBuffer(descriptors.data.camera)
 
--- a/tests/test_rendering.nim	Mon Jul 29 00:00:28 2024 +0700
+++ b/tests/test_rendering.nim	Mon Jul 29 15:43:44 2024 +0700
@@ -436,7 +436,7 @@
     let tStartLoop = getMonoTime() - tStart
 
     uniforms1.data.data.data.mvp = (
-      Perspective(-PI / 2, GetAspectRatio(), 0.01, 100) *
+      Projection(-PI / 2, GetAspectRatio(), 0.01, 100) *
       Translate(0, 0, 2) *
       Rotate(PI / 4, X) *
       Rotate(PI * 0.1 * (tStartLoop.inMicroseconds() / 1_000_000), Y)