Commit graph

12 commits

Author SHA1 Message Date
67307032da Textures: Add several defines and constructor options for compression, cache.
* Add defines `myouForceAstc`, `myouMinTextureChannels`, 
  `myouLoadUncompressedTextures` and `myouAllCacheFilesExist`.
* Suppress warning messages about emulation for `myouForceAstc`.
* Add argument `use_compression` to `newTexture` (default `true`)
2024-12-16 21:05:21 +01:00
1640040f93 Fix some textures not being destroyed when it should. 2024-09-21 02:06:32 +02:00
8075edf619 Prevent mem leaks with destructors for all GPU objects and other measures. 2024-09-13 02:37:02 +02:00
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
17d6ccc32d Fix missing tex_type in one of newTexture. Prevent nil access in destroy. 2024-09-10 00:57:16 +02:00
45dc99b483 Add CacheSettings for automatically saving and loading compressed textures. 2024-09-06 01:14:35 +02:00
878137db71 Load textures in a thread and optionally compress them (in ASTC only for now). 2024-09-03 15:59:15 +02:00
d784dd3a52 Replace the use of pointer/len and "done()" by SliceMem and destructors. 2024-08-31 00:40:02 +02:00
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
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
19ed29e806 Replace pixie by stb_image. Add support for 16 bit images, TGA, PSD, HDR, etc. 2024-08-22 21:38:35 +02:00
9af1322937 First commit.
* Incomplete port of myou-engine-js to nimskull, after many months of work, and
  a few extra features that weren't exactly necessary for a "first commit" to
  work. Excuse the lack of commit history up to this point.
* Bare bones structure of the documentation and the process to update it.
* Restructure of the whole project to have a more sensible organization.
* Making submodules of forks of larger libraries.
* README, licenses, AUTHORS.md.
2024-08-20 13:08:19 +02:00