Commit graph

57 commits

Author SHA1 Message Date
Alberto Torres 6794b35978 Add a forgotten conditional in simple_shadow.nim 2024-09-21 02:27:10 +02:00
Alberto Torres 29e4735626 Util: Remove unused JS functions, add min/max(vec), improve remove, add docs. 2024-09-21 02:21:25 +02:00
Alberto Torres 40b70003ec GameObject: Document many of its functions.
Also rename `get_dimensions` to `get_local_dimensions`, add
`get_world_dimensions` for consistency, and add `children_recursive_and_self`.
2024-09-21 02:19:44 +02:00
Alberto Torres f71ae37821 GameObject: Fix rotation in get_local_matrix. 2024-09-21 02:16:39 +02:00
Alberto Torres f03d1929cb Blend format: fix crash when trying to load a data block of missing type. 2024-09-21 02:15:26 +02:00
Alberto Torres 1abd60e48f Blend format: load some custom properties in objects. 2024-09-21 02:14:24 +02:00
Alberto Torres 61c1986c92 Screen: add get_pixels_at_depth. 2024-09-21 02:13:26 +02:00
Alberto Torres 55d0c859ab Add rudimentary error management to loader callbacks. 2024-09-21 02:10:53 +02:00
Alberto Torres dca0123f13 Fix many issues related to shadows. 2024-09-21 02:09:22 +02:00
Alberto Torres 1640040f93 Fix some textures not being destroyed when it should. 2024-09-21 02:06:32 +02:00
Alberto Torres 01229cc2b5 Enable shadow samplers by default. 2024-09-13 18:43:18 +02:00
Alberto Torres c1291c0412 Destroy cubemaps with the scene. 2024-09-13 18:43:01 +02:00
Alberto Torres 7efd3bb160 Add condition for compilation without threads in gl.nim. 2024-09-13 18:39:47 +02:00
Alberto Torres 6180767bf2 Add break_current_callbacks to block other callbacks in the same frame. 2024-09-13 02:42:11 +02:00
Alberto Torres 8075edf619 Prevent mem leaks with destructors for all GPU objects and other measures. 2024-09-13 02:37:02 +02:00
Alberto Torres 52a4c00ffe Fix shadows not compiling without myouDebugShadows. 2024-09-13 02:31:47 +02:00
Alberto Torres 60a896f513 Workaround for images with less channels than the supposed texture format. 2024-09-13 02:18:37 +02:00
Alberto Torres 5b588fddf1 Allow compilation with threads off. 2024-09-13 02:15:32 +02:00
Alberto Torres c77187fa9f Revamp shadow map system into a working state. Fix related bugs.
* `light.configure_shadow` has been added. It can either use a camera frustum or
  calculate the bounds for a static shadow that doesn't need to be updated every
  frame.
* `Light` and `newLight` have `use_shadow`, however it's not used automatically
  at the moment. Instead you should call `configure_shadow`.
* Added `updateShadowStorage` which at the moment has to be called manually
  after using `configure_shadow`.
* All shadows now share a single texture array per scene, so they can be
  accessed by index in the shader and take less shader locations and draw calls.
* Shadow map resolution is also global per scene.
* Add `set_texture_shadow` and `unset_texture_shadow` to configure a texture as
  shadow sampler.
* Bias has been removed as an option, it's calculated automatically instead.
* Bias now moves along the normal of the mesh instead of towards the light,
  allowing very small biases.
2024-09-11 20:49:00 +02:00
Alberto Torres c8f9beaff9 Add all missing files in the packages directory. 2024-09-11 12:10:54 +02:00
Alberto Torres b60c837c47 Create quickhull.nim with quickhull and quickhull_points functions. 2024-09-11 12:10:54 +02:00
Alberto Torres 7b54183f31 Fix some mysterious warnings when using enqueue. 2024-09-11 12:10:54 +02:00
Alberto Torres 67f009c157 Framebuffer: allow usage of texture arrays and changing type of depth texture. 2024-09-11 12:10:54 +02:00
Alberto Torres 17d6ccc32d Fix missing tex_type in one of newTexture. Prevent nil access in destroy. 2024-09-10 00:57:16 +02:00
Alberto Torres 90abbac26b SliceMem: change newSliceMem(ptr, len...) to match an example, add another. 2024-09-10 00:52:39 +02:00
Alberto Torres dd75d19399 Use quality settings for BCn formats in texture_optimize. 2024-09-10 00:50:33 +02:00
Alberto Torres f7108225bd Add some documentation and fix fixdocs.nim. 2024-09-06 01:16:06 +02:00
Alberto Torres 45dc99b483 Add CacheSettings for automatically saving and loading compressed textures. 2024-09-06 01:14:35 +02:00
Alberto Torres a8a0b35297 SliceMem: Add serialize, deserialize, toString, copy and documentation. 2024-09-06 01:08:58 +02:00
Alberto Torres 83011ea344 Add use_threads option to loadUri. 2024-09-05 16:48:35 +02:00
Alberto Torres 41c7c7092a Fix typo in align in utils. 2024-09-05 16:47:33 +02:00
Alberto Torres 82be9ea1db Fix issue when trying to load another .blend with same loader after it failed. 2024-09-05 00:24:08 +02:00
Alberto Torres 7f0ebc122a Add support for BCn texture compression formats (except BC2, BC6) with BC7enc. 2024-09-05 00:22:05 +02:00
Alberto Torres e4b918b384 Call gladLoadGLES2 in mobile to properly detect supported extensions. 2024-09-04 02:44:26 +02:00
Alberto Torres d9778546b5 Fix GLAD bug where it wasn't reading OpenGL ES version correctly. 2024-09-04 02:43:22 +02:00
Alberto Torres 878137db71 Load textures in a thread and optionally compress them (in ASTC only for now). 2024-09-03 15:59:15 +02:00
Alberto Torres 0949e1bf99 Add libraries: astc and stb_image_resize. 2024-09-03 15:31:00 +02:00
Alberto Torres e31d416f94 Rename ddx_ktx to dds_ktx and add get_ASTC_internal_format 2024-09-03 14:43:06 +02:00
Alberto Torres e759f25519 ArrRef and SliceMem: Add concat, suport for backward indexes, and fix $. 2024-09-03 14:42:57 +02:00
Alberto Torres d784dd3a52 Replace the use of pointer/len and "done()" by SliceMem and destructors. 2024-08-31 00:40:02 +02:00
Alberto Torres 8eda3e5969 Add SliceMem, an object to safely move slices of memory around without copies. 2024-08-30 23:16:10 +02:00
Alberto Torres 49d919f43d Move API-agnostic image procs out of texture, to prepare to add threads.
* Procs `loadFileFromPointersLen`, `getDimensionsFormat` and related graphics
API-agnostic functions have been moved into their own module `texture_decode`.
* New directory `gpu_formats` added, where we will put all modules related to
decoding, optimizing and caching meshes and textures (independently of the
graphics API being used) in a separate thread or threads.
2024-08-29 22:54:04 +02:00
Alberto Torres 78cafe6566 Add threading support to LoadableResource. 2024-08-29 00:19:52 +02:00
Alberto Torres e748831f3a Fix crash with loadables in Android. Warn if done() is being called twice. 2024-08-29 00:13:37 +02:00
Alberto Torres c731c3c5ab Add new_scenes to prevent modifying the currently iterated scenes. 2024-08-29 00:09:34 +02:00
Alberto Torres 3ff1d663a2 Prevent cycles with ARC by adding {.cursor.} to all "back" references.
TODO: Use destructors to set all cursors of children objects to `nil`.
2024-08-29 00:07:09 +02:00
Alberto Torres 1557d59d0f Add option to always use GLSL tone mapping instead of GL_FRAMEBUFFER_SRGB. 2024-08-29 00:01:54 +02:00
Alberto Torres 6636b5e595 Add proc to show/hide on-screen keyboard and character callbacks (except ios).
* Add `myouSetKeyboardVisible(bool)` and export it.
* Add `screen.char_callbacks` to receive platform character events.
* Remove duplicate code for mouse emulation with touch (commited by mistake).
2024-08-28 23:57:29 +02:00
Alberto Torres 6e60d806e7 Change all OpenGL extension constants to be const. Fix OpenGL ES and mobile.
* OpenGL ES wasn't compiling because there's no `GL_R16`, `GL_RG16`, `GL_RGB16`,
  `GL_RGBA16`. Replaced by their `_EXT` versions, but it wasn't compiling
  because they're defined as `var` instead of `const` and they were being used
  in a `func`.
* The GL API files were changed to fix that.
* After loading the scene, mobile platforms were throwing an error because the
  renderer was not initialized yet. That's been fixed.
* Remove unsed `gl-basic.nim`.
2024-08-24 19:22:01 +02:00
Alberto Torres f1768275f4 Remove elvis and replace remaining nimble dependencies by git submodules. 2024-08-23 00:37:45 +02:00