beyond-all-reason / beyond-all-reason/RecoilEngine
[FR] Create LuaTexture with source
- Dominant language
- C++
- Stars
- 679
- Forks
- 290
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 40
Description
Currently **gl.CreateTexture** accepts these parameters: (xsize, ysize [, zsize [, texProps]])
Proposition is to add this form: **gl.CreateTexture**(_source_ [,texProps])
_source_ parameter will be a string path of a texture file, to which the contents of a Lua texture _will be initialized to_.
It will take dimensions and the format of the source file as a result.
Main purpose is to avoid micro-management of loading/copying named textures when you just need to load a texture from a file, but be able to operate on it as a Lua texture (via FBO and such).
Without this function, you have to use some redundant code, which also _slows game down_ (especially if we are talking work with big textures), because the texture is not directly initialized, as its best to do.
Once a texture is loaded via a simple one-liner, you will be able to work on it directly via a compute shader, and also _generate mipmaps using your own algorithm_ (via FBO with targetLod parameter). (See issue: https://github.com/beyond-all-reason/spring/issues/883)
The goal is to help make such Lua code as simple as possible.
**Edit:**
To clarify "source" word: it should not work like named textures, meaning it has nothing to do with creating unique instances or something. Only for initialization.
**Edit:**
Only 2D textures as the first step, no cubes and such.
Contributor guide
Research direction
Start at the existing gl.CreateTexture API and trace how named texture files are loaded and copied into Lua textures. Define the 2D source-path behavior, including dimensions, format, and texProps, then verify that the resulting texture can be used through FBOs and compute shaders without the redundant copy described in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, lua
- Domain
- api, computer-graphics
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100