mirror of
https://git.mirrors.martin98.com/https://github.com/syoyo/tinygltf.git
synced 2025-08-13 23:35:54 +08:00
Add single file version of lodepng.
This commit is contained in:
parent
1212a6ee51
commit
57074aee04
21
LICENSE.lodepng
Normal file
21
LICENSE.lodepng
Normal file
@ -0,0 +1,21 @@
|
||||
Copyright (c) 2005-2018 Lode Vandevenne
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
@ -82,6 +82,7 @@ TinyGLTF uses the following third party libraries.
|
||||
* base64 : Copyright (C) 2004-2008 René Nyffenegger
|
||||
* stb_image.h : v2.08 - public domain image loader - [Github link](https://github.com/nothings/stb/blob/master/stb_image.h)
|
||||
* stb_image_write.h : v1.09 - public domain image writer - [Github link](https://github.com/nothings/stb/blob/master/stb_image_write.h)
|
||||
* lodepng : Copyright (c) 2005-2018 Lode Vandevenne. zlib license. https://lodev.org/lodepng/
|
||||
|
||||
|
||||
## Build and example
|
||||
@ -128,6 +129,7 @@ if (!ret) {
|
||||
* `TINYGLTF_NO_STB_IMAGE` : Do not load images with stb_image. Instead use `TinyGLTF::SetImageLoader(LoadimageDataFunction LoadImageData, void *user_data)` to set a callback for loading images.
|
||||
* `TINYGLTF_NO_STB_IMAGE_WRITE` : Do not write images with stb_image_write. Instead use `TinyGLTF::SetImageWriter(WriteimageDataFunction WriteImageData, void *user_data)` to set a callback for writing images.
|
||||
* `TINYGLTF_NO_EXTERNAL_IMAGE` : Do not try to load external image file. This option woulde be helpful if you do not want load image file during glTF parsing.
|
||||
* `TINYGLTF_NO_LODEPNG` : Do not load 16bit PNG image with lodepng. Instead use `TinyGLTF::SetImageLoader(LoadimageDataFunction LoadImageData, void *user_data)` to set a callback for loading images(You'll also need to disable stb image with `TINYGLTF_NO_STB_IMAGE`).
|
||||
|
||||
### Saving gltTF 2.0 model
|
||||
* [ ] Buffers.
|
||||
@ -169,4 +171,5 @@ $ ./tester_noexcept
|
||||
|
||||
* json.hpp : Licensed under the MIT License <http://opensource.org/licenses/MIT>. Copyright (c) 2013-2017 Niels Lohmann <http://nlohmann.me>.
|
||||
* stb_image : Public domain.
|
||||
* lodepng : zlib license
|
||||
* catch : Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. Distributed under the Boost Software License, Version 1.0.
|
||||
|
@ -4,6 +4,7 @@
|
||||
#define TINYGLTF_IMPLEMENTATION
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#define STB_IMAGE_WRITE_IMPLEMENTATION
|
||||
#define LODEPNG_IMPLEMENTATION
|
||||
#include "tiny_gltf.h"
|
||||
|
||||
#include <cstdio>
|
||||
|
@ -34,6 +34,7 @@
|
||||
// - jsonhpp: C++ JSON library.
|
||||
// - base64: base64 decode/encode library.
|
||||
// - stb_image: Image loading library.
|
||||
// - lodepng: Load 16bit PNG.
|
||||
//
|
||||
#ifndef TINY_GLTF_H_
|
||||
#define TINY_GLTF_H_
|
||||
@ -1058,6 +1059,10 @@ class TinyGLTF {
|
||||
#include "./stb_image_write.h"
|
||||
#endif
|
||||
|
||||
#ifndef TINYGLTF_NO_LODEPNG
|
||||
#include "./lodepng.h"
|
||||
#endif
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
@ -2460,6 +2465,7 @@ static bool ParseImage(Image *image, std::string *err, std::string *warn,
|
||||
// Keep texture path (for textures that cannot be decoded)
|
||||
image->uri = uri;
|
||||
#ifdef TINYGLTF_NO_EXTERNAL_IMAGE
|
||||
// TODO(syoyo): Call LoadImageData callback?
|
||||
return true;
|
||||
#endif
|
||||
if (!LoadExternalFile(&img, err, warn, uri, basedir, false, 0, false, fs)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user