Repository navigation
Expand file tree
/
Copy pathload_texture.hpp
More file actions
53 lines (46 loc) · 1.79 KB
/
Copy pathload_texture.hpp
File metadata and controls
53 lines (46 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/**
* @file liblava/asset/load_texture.hpp
* @brief Load texture from file
* @authors Lava Block OÜ and contributors
* @copyright Copyright (c) 2018-present, MIT License
*/
#pragma once
#include "liblava/resource/texture.hpp"
namespace lava {
/**
* @brief Load texture from file
* @param device Vulkan device
* @param tex_file Texture file
* @param type Type of texture
* @return texture::s_ptr Loaded texture
*/
texture::s_ptr load_texture(device::ptr device,
texture_file tex_file,
texture_type type = texture_type::tex_2d);
/**
* @brief Load texture from file with default format (sRGB)
* @param device Vulkan device
* @param filename File to load
* @param format Format of texture
* @param type Type of texture
* @return texture::s_ptr Loaded texture
*/
inline texture::s_ptr load_texture(device::ptr device,
string_ref filename,
VkFormat format = VK_FORMAT_R8G8B8A8_SRGB,
texture_type type = texture_type::tex_2d) {
return load_texture(device, {filename, format}, type);
}
/**
* @brief Create a default texture with checkerboard pattern
* @param device Vulkan device
* @param size Size of texture
* @param color Color of texture
* @param alpha Alpha value of texture
* @return texture::s_ptr Loaded texture
*/
texture::s_ptr create_default_texture(device::ptr device,
uv2 size = {512, 512},
v3 color = v3(1.f),
r32 alpha = 0.7529f);
} // namespace lava