Mercurial > games > semicongine
changeset 1277:01138e6257dd
did: fix a few things
author | sam <sam@basx.dev> |
---|---|
date | Mon, 29 Jul 2024 15:04:52 +0700 |
parents | b5fb00760162 |
children | e0ba4aead324 a89a70ea3da2 |
files | semicongine.nim semicongine/core/buildconfig.nim semicongine/core/matrix.nim semicongine/core/vector.nim semicongine/rendering.nim semicongine/rendering/renderpasses.nim tests/test_gltf.nim tests/test_rendering.nim |
diffstat | 8 files changed, 20 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- 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)
--- 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:
--- 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,
--- 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...
--- 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
--- 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),
--- 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)
--- 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)