Cleanup
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 benikabocha
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
https://github.com/benikabocha/tinyddsloader
|
||||
@@ -1,52 +0,0 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#define TINYDDSLOADER_IMPLEMENTATION
|
||||
#include "tinyddsloader.h"
|
||||
using namespace tinyddsloader;
|
||||
|
||||
static void *buf; /* Pointer to dds file data */
|
||||
static size_t size; /* Size of the file data */
|
||||
|
||||
static uint8_t *pixels;
|
||||
static uint32_t w;
|
||||
static uint32_t h;
|
||||
static uint32_t format;
|
||||
|
||||
uint8_t *io_dds_init(int bufSize) {
|
||||
size = bufSize;
|
||||
buf = (uint8_t *)malloc(sizeof(uint8_t) * bufSize);
|
||||
return (uint8_t *)buf;
|
||||
}
|
||||
|
||||
void io_dds_parse() {
|
||||
if (pixels != NULL) {
|
||||
free(pixels);
|
||||
}
|
||||
|
||||
DDSFile dds;
|
||||
|
||||
if (dds.Load((uint8_t *)buf, size) != tinyddsloader::Result::Success) {
|
||||
return;
|
||||
}
|
||||
if (dds.GetTextureDimension() != DDSFile::TextureDimension::Texture2D) {
|
||||
return;
|
||||
}
|
||||
|
||||
w = dds.GetWidth();
|
||||
h = dds.GetHeight();
|
||||
format = (uint32_t)dds.GetFormat(); // DDSFile::DXGIFormat::R8G8B8A8_Typeless
|
||||
|
||||
// dds.Flip();
|
||||
// pixels = (uint8_t *)malloc(sizeof(uint8_t) * w * h * 4);
|
||||
pixels = (uint8_t *)dds.GetImageData(0, 0)->m_mem;
|
||||
}
|
||||
|
||||
void io_dds_destroy() {
|
||||
free(buf);
|
||||
free(pixels);
|
||||
}
|
||||
|
||||
uint8_t *io_dds_get_pixels() { return pixels; }
|
||||
uint32_t io_dds_get_pixels_w() { return w; }
|
||||
uint32_t io_dds_get_pixels_h() { return h; }
|
||||
uint32_t io_dds_get_pixels_format() { return format; }
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user