3 #if defined(LUG_SYSTEM_WINDOWS) 5 #pragma warning(disable : 4244) 6 #pragma warning(disable : 4456) 9 #define STB_IMAGE_IMPLEMENTATION 10 #include <stb_image.h> 11 #if defined(LUG_SYSTEM_WINDOWS) 15 #if defined(LUG_SYSTEM_ANDROID) 16 #include <android/asset_manager.h> 84 unsigned char* newData =
new unsigned char[width * height * sizePixel];
90 std::memcpy(newData, data, width * height * sizePixel);
103 stbi_uc* pixels =
nullptr;
105 #if defined(LUG_SYSTEM_ANDROID) 110 LUG_LOG.error(
"Vulkan::Texture::build: Can't open Android asset \"{}\"", filename);
114 uint32_t size = AAsset_getLength(asset);
117 LUG_LOG.error(
"Vulkan::Texture::build: Android asset \"{}\" is empty", filename);
121 unsigned char* data =
new unsigned char[size];
123 AAsset_read(asset, reinterpret_cast<char*>(data), size);
127 pixels =
reinterpret_cast<unsigned char*
>(stbi_loadf_from_memory(data, size, &texWidth, &texHeight, &texChannels, STBI_rgb_alpha));
129 pixels = stbi_load_from_memory(data, size, &texWidth, &texHeight, &texChannels, STBI_rgb_alpha);
135 pixels =
reinterpret_cast<unsigned char*
>(stbi_loadf(filename.c_str(), &texWidth, &texHeight, &texChannels, STBI_rgb_alpha));
137 pixels = stbi_load(filename.c_str(), &texWidth, &texHeight, &texChannels, STBI_rgb_alpha);
146 if (!
addLayer(texWidth, texHeight, format, pixels)) {
147 stbi_image_free(pixels);
151 stbi_image_free(pixels);
Render::Texture::WrappingMode _wrapT
Render::Texture::Format _format
Render::Texture::Filter _minFilter
Render::Texture::Filter _magFilter
Resource::SharedPtr< lug::Graphics::Render::Texture > build(const ::lug::Graphics::Builder::Texture &builder)
static size_t formatToSize(Render::Texture::Format format)
Dummy class for a shared pointer.
Texture(Renderer &renderer)
bool addLayer(const std::string &filename, bool hdr=false)
static ANativeActivity * activity
Render::Texture::WrappingMode _wrapS
Resource::SharedPtr< Render::Texture > build()
std::vector< Layer > _layers
Render::Texture::Filter _mipMapFilter