bad char
[vg.git] / vg_tex.h
1 /* Copyright (C) 2021-2024 Harry Godden (hgn) - All Rights Reserved
2 *
3 * A portion of this file is copied and altered from the QOI projects' source,
4 * Originally written by Dominic Szablewski. It is slightly modified.
5 * For the original unaltered QOI header, you can find it here:
6 * https://github.com/phoboslab/qoi/blob/master/qoi.h
7 *
8 * Copyright (C) 2021, Dominic Szablewski
9 * SPDX-License-Identifier: MIT
10 *
11 * MIT License
12 Copyright (c) 2022 Dominic Szablewski - https://phoboslab.org
13
14 Permission is hereby granted, free of charge, to any person obtaining a copy
15 of this software and associated documentation files (the "Software"), to deal
16 in the Software without restriction, including without limitation the rights
17 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18 copies of the Software, and to permit persons to whom the Software is
19 furnished to do so, subject to the following conditions:
20
21 The above copyright notice and this permission notice shall be included in all
22 copies or substantial portions of the Software.
23
24 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 SOFTWARE.
31 */
32
33 #pragma once
34 #include "vg_log.h"
35 #include "vg_image.h"
36 #include "vg_engine.h"
37
38 struct vg_sprite
39 {
40 v4f uv_xywh;
41 };
42
43 #define VG_TEX2D_LINEAR 0x1
44 #define VG_TEX2D_NEAREST 0x2
45 #define VG_TEX2D_REPEAT 0x4
46 #define VG_TEX2D_CLAMP 0x8
47 #define VG_TEX2D_NOMIP 0x10
48
49 /* options to create texutres; call only from loader thread.
50 * *dest will be replaced synchronously by the main thread when ready. */
51
52 void vg_tex2d_replace_with_error_async( GLuint *dest );
53
54 void vg_tex2d_load_qoi_async( const u8 *bytes, u32 size,
55 u32 flags, GLuint *dest );
56
57 void vg_tex2d_load_qoi_async_file( const char *path, u32 flags, GLuint *dest );