Commit Graph

13 Commits

Author SHA1 Message Date
Alibek Omarov 21195b3491 engine: increase logo and hpak limits, add cl_logomaxdim cvar to limit decal size (set to 96, default HL logo size is 64) 2024-06-11 07:47:01 +03:00
Ivan Avdeev a251600c8a
engine: common: imagelib: add KTX2 support (#1455)
* engine: common: imagelib: add KTX2 support

Adds basic KTX2 support for a few compressed formats. KTX2 essentially
is a Vulkan-centric texture format that supports literally hundreds of
pixel formats.
For now only support for these is added:
- `VK_FORMAT_BC4_UNORM_BLOCK`
- `VK_FORMAT_BC4_SNORM_BLOCK`
- `VK_FORMAT_BC5_UNORM_BLOCK`
- `VK_FORMAT_BC5_SNORM_BLOCK`
- `VK_FORMAT_BC6H_UFLOAT_BLOCK`
- `VK_FORMAT_BC6H_SFLOAT_BLOCK`
- `VK_FORMAT_BC7_UNORM_BLOCK`
- `VK_FORMAT_BC7_SRGB_BLOCK`

Adding more formats is relatively straightforward:
- Copy format definition from `VkFormat` enum in `vulkan_core.h`
- Add a new definition into `pixformat_t` enum.
- Add format size calculation into `Image_ComputeSize()`

While we're at it, also adds a few new formats to DDS:
- BC4_UNORM -- PF_BC4_UNSIGNED
- BC4_SNORM -- PF_BC4_SIGNED
- BC5_UNORM -- PF_BC5_UNSIGNED
- BC5_SNORM -- PF_BC5_SIGNED
- BC7 is expanded into BC7_UNORM and BC7_SRGB

ref_gl and ref_soft code is updated where it made sense. But not tested
really. Support for these formats has been tested with ref_vk.

* address spaces-vs-parentheses formatting where noticed

* parenthesize sizeofs

* move ktx2.h to imagelib as img_ktx2.h; massage it a bit

* use SetBits() instead of |=

* remove stale TODO comments
2023-10-18 10:31:40 +03:00
Alibek Omarov 21c898d796 engine: imagelib: validate player decal image size (max 512x512) 2022-12-05 04:55:24 +03:00
Alibek Omarov ccf7619ae5 engine: imagelib: refactor image loading function 2022-12-05 03:22:07 +03:00
Gleb Mazovetskiy 5e0a0765ce Trim all trailing whitespace
The `.editorconfig` file in this repo is configured to trim all trailing
whitespace regardless of whether the line is modified.

Trims all trailing whitespace in the repository to make the codebase easier
to work with in editors that respect `.editorconfig`.

`git blame` becomes less useful on these lines but it already isn't very useful.

Commands:

```
find . -type f -name '*.h' -exec sed --in-place 's/[[:space:]]\+$//' {} \+
find . -type f -name '*.c' -exec sed --in-place 's/[[:space:]]\+$//' {} \+
```
2021-01-04 20:55:10 +03:00
Andrey Akhmichin 248c8a745c engine: common: imagelib: split imagelib.h. 2020-03-03 05:03:15 +05:00
Andrey Akhmichin e96ea719d5 engine: common: imagelib: use rgba_t as RGBA palette type. 2020-03-02 15:07:54 +05:00
Night Owl 4eee187f1b engine: common: imagelib: add simple decoder/encoder for 8-bit RGB/RGBA PNG images. 2019-06-22 16:06:44 +05:00
Alibek Omarov fe14a360b4 engine: fix fs_offset_t/size_t conversion, const qualifiers 2019-05-02 19:12:23 +03:00
Alibek Omarov b8c4c31e02 Merge 4344 update 2018-12-30 01:51:02 +03:00
Alibek Omarov bf07a9e61e Apply 4344 update 2018-12-30 01:43:07 +03:00
Alibek Omarov 158db1c454 img_bmp.c port 2018-04-14 01:26:52 +03:00
Alibek Omarov 8d6e3b7f79 Pure engine source code(LF line endings, UTF8 encoded) 2018-04-13 19:23:45 +03:00