# HG changeset patch # User sam # Date 1722240292 -25200 # Node ID 01138e6257dd9ac78ce6ad06064c611b15e88b1f # Parent b5fb007601626d321e86fa879c717d8aa6ae4331 did: fix a few things diff -r b5fb00760162 -r 01138e6257dd semicongine.nim --- a/semicongine.nim Mon Jul 29 12:22:58 2024 +0700 +++ b/semicongine.nim Mon Jul 29 15:04:52 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) diff -r b5fb00760162 -r 01138e6257dd semicongine/core/buildconfig.nim --- a/semicongine/core/buildconfig.nim Mon Jul 29 12:22:58 2024 +0700 +++ b/semicongine/core/buildconfig.nim Mon Jul 29 15:04:52 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: diff -r b5fb00760162 -r 01138e6257dd semicongine/core/matrix.nim --- a/semicongine/core/matrix.nim Mon Jul 29 12:22:58 2024 +0700 +++ b/semicongine/core/matrix.nim Mon Jul 29 15:04:52 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, diff -r b5fb00760162 -r 01138e6257dd semicongine/core/vector.nim --- a/semicongine/core/vector.nim Mon Jul 29 12:22:58 2024 +0700 +++ b/semicongine/core/vector.nim Mon Jul 29 15:04:52 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... diff -r b5fb00760162 -r 01138e6257dd semicongine/rendering.nim --- a/semicongine/rendering.nim Mon Jul 29 12:22:58 2024 +0700 +++ b/semicongine/rendering.nim Mon Jul 29 15:04:52 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 diff -r b5fb00760162 -r 01138e6257dd semicongine/rendering/renderpasses.nim --- a/semicongine/rendering/renderpasses.nim Mon Jul 29 12:22:58 2024 +0700 +++ b/semicongine/rendering/renderpasses.nim Mon Jul 29 15:04:52 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), diff -r b5fb00760162 -r 01138e6257dd tests/test_gltf.nim --- a/tests/test_gltf.nim Mon Jul 29 12:22:58 2024 +0700 +++ b/tests/test_gltf.nim Mon Jul 29 15:04:52 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) diff -r b5fb00760162 -r 01138e6257dd tests/test_rendering.nim --- a/tests/test_rendering.nim Mon Jul 29 12:22:58 2024 +0700 +++ b/tests/test_rendering.nim Mon Jul 29 15:04:52 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)