/* stbi-1.16 - public domain JPEG/PNG reader - http://nothings.org/stb_image.c
when you control the images you're loading
QUICK NOTES:
Primarily of interest to game developers and other people who can
avoid problematic images and only need the trivial interface
JPEG baseline (no JPEG progressive, no oddball channel decimations)
PNG non-interlaced
BMP non-1bpp, non-RLE
TGA (not sure what subset, if a subset)
PSD (composited view only, no extra channels)
HDR (radiance rgbE format)
writes BMP,TGA (define STBI_NO_WRITE to remove code)
decoded from memory or through stdio FILE (define STBI_NO_STDIO to remove code)
supports installable dequantizing-IDCT, YCbCr-to-RGB conversion (define STBI_SIMD)
TODO:
stbi_info_*
history:
1.16 major bugfix - convert_format converted one too many pixels
1.15 initialize some fields for thread safety
1.14 fix threadsafe conversion bug; header-file-only version (#define STBI_HEADER_FILE_ONLY before including)
1.13 threadsafe
1.12 const qualifiers in the API
1.11 Support installable IDCT, colorspace conversion routines
1.10 Fixes for 64-bit (don't use "unsigned long")
optimized upsampling by Fabian "ryg" Giesen
1.09 Fix format-conversion for PSD code (bad global variables!)
1.08 Thatcher Ulrich's PSD code integrated by Nicolas Schulz
1.07 attempt to fix C++ warning/errors again
1.06 attempt to fix C++ warning/errors again
1.05 fix TGA loading to return correct *comp and use good luminance calc
1.04 default float alpha is 1, not 255; use 'void *' for stbi_image_free
1.03 bugfixes to STBI_NO_STDIO, STBI_NO_HDR
1.02 support for (subset of) HDR files, float interface for preferred access to them
1.01 fix bug: possible bug in handling right-side up bmps... not sure
fix bug: the stbi_bmp_load() and stbi_tga_load() functions didn't work at all
1.00 interface to zlib that skips zlib header
0.99 correct handling of alpha in palette
0.98 TGA loader by lonesock; dynamically add loaders (untested)
0.97 jpeg errors on too large a file; also catch another malloc failure
0.96 fix detection of invalid v value - particleman@mollyrocket forum
0.95 during header scan, seek to markers in case of padding
0.94 STBI_NO_STDIO to disable stdio usage; rename all #defines the same
0.93 handle jpegtran output; verbose errors
0.92 read 4,8,16,24,32-bit BMP files of several formats
0.91 output 24-bit Windows 3.0 BMP files
0.90 fix a few more warnings; bump version number to approach 1.0
0.61 bugfixes due to Marc LeBlanc, Christopher Lloyd
0.60 fix compiling as c++
0.59 fix warnings: merge Dave Moore's -Wall fixes
0.58 fix bug: zlib uncompressed mode len/nlen was wrong endian
0.57 fix bug: jpg last huffman symbol before marker was >9 bits but less
than 16 available
0.56 fix bug: zlib uncompressed mode len vs. nlen
0.55 fix bug: restart_interval not initialized to 0
0.54 allow NULL for 'int *comp'
0.53 fix bug in png 3->4; speedup png decoding
0.52 png handles req_comp=3,4 directly; minor cleanup; jpeg comments
0.51 obey req_comp requests, 1-component jpegs return as 1-component,
on 'test' only check type, not whether we support this variant
*/
#include "stb_image_aug.h"
#ifndef STBI_NO_HDR
#include <math.h> // ldexp
#include <string.h> // strcmp
#endif
#ifndef STBI_NO_STDIO
#include <stdio.h>
#endif
#include <stdlib.h>
#include <memory.h>
#include <assert.h>
#include <stdarg.h>
#ifndef _MSC_VER
#ifdef __cplusplus
#define __forceinline inline
#else
#define __forceinline
#endif
#endif
// implementation:
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef signed short int16;
typedef unsigned int uint32;
typedef signed int int32;
typedef unsigned int uint;
// should produce compiler error if size is wrong
typedef unsigned char validate_uint32[sizeof(uint32)==4];
#if defined(STBI_NO_STDIO) && !defined(STBI_NO_WRITE)
#define STBI_NO_WRITE
#endif
#ifndef STBI_NO_DDS
#include "stbi_DDS_aug.h"
#endif
// I (JLD) want full messages for SOIL
#define STBI_FAILURE_USERMSG 1
//////////////////////////////////////////////////////////////////////////////
//
// Generic API that works on all image types
//
// this is not threadsafe
static char *failure_reason;
char *stbi_failure_reason(void)
{
return failure_reason;
}
static int e(char *str)
{
failure_reason = str;
return 0;
}
#ifdef STBI_NO_FAILURE_STRINGS
#define e(x,y) 0
#elif defined(STBI_FAILURE_USERMSG)
#define e(x,y) e(y)
#else
#define e(x,y) e(x)
#endif
#define epf(x,y) ((float *) (e(x,y)?NULL:NULL))
#define epuc(x,y) ((unsigned char *) (e(x,y)?NULL:NULL))
void stbi_image_free(void *retval_from_stbi_load)
{
free(retval_from_stbi_load);
}
#define MAX_LOADERS 32
stbi_loader *loaders[MAX_LOADERS];
static int max_loaders = 0;
int stbi_register_loader(stbi_loader *loader)
{
int i;
for (i=0; i < MAX_LOADERS; ++i) {
// already present?
if (loaders[i] == loader)
return 1;
// end of the list?
if (loaders[i] == NULL) {
loaders[i] = loader;
max_loaders = i+1;
return 1;
}
}
// no room for it
return 0;
}
#ifndef STBI_NO_HDR
static float *ldr_to_hdr(stbi_uc *data, int x, int y, int comp);
static stbi_uc *hdr_to_ldr(float *data, int x, int y, int comp);
#endif
#ifndef STBI_NO_STDIO
unsigned char *stbi_load(char const *filename, int *x, int *y, int *comp, int req_comp)
{
FILE *f = fopen(filename, "rb");
unsigned char *result;
if (!f) return epuc("can't fopen", "Unable to open file");
result = stbi_load_from_file(f,x,y,comp,req_comp);
fclose(f);
return result;
}
unsigned char *stbi_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)
{
int i;
if (stbi_jpeg_test_file(f))
return stbi_jpeg_load_from_file(f,x,y,comp,req_comp);
if (stbi_png_test_file(f))
return stbi_png_load_from_file(f,x,y,comp,req_comp);
if (stbi_bmp_test_file(f))
return stbi_bmp_load_from_file(f,x,y,comp,req_comp);
if (stbi_psd_test_file(f))
return stbi_psd_load_from_file(f,x,y,comp,req_comp);
#ifndef STBI_NO_DDS
if (stbi_dds_test_file(f))
return stbi_dds_load_from_file(f,x,y,comp,req_comp);
#endif
#ifndef STBI_NO_HDR
if (stbi_hdr_test_file(f)) {
float *hdr = stbi_hdr_load_from_file(f, x,y,comp,req_comp);
return hdr_to_ldr(hdr, *x, *y, req_comp ? req_comp : *comp);
}
#endif
for (i=0; i < max_loaders; ++i)
if (loaders[i]->test_file(f))
return loaders[i]->load_from_file(f,x,y,comp,req_comp);
// test tga last because it's a crappy test!
if (stbi_tga_test_file(f))
return stbi_tga_load_from_file(f,x,y,comp,req_comp);
return epuc("unknown image type", "Image not of any known type, or corrupt");
}
#endif
unsigned char *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
{
int i;
if (stbi_jpeg_test_memory(buffer,len))
return stbi_jpeg_load_from_memory(buffer,len,x,y,comp,req_comp);
if (stbi_png_test_memory(buffer,len))
return stbi_png_load_from_memory(buffer,len,x,y,comp,req_comp);
if (stbi_bmp_test_memory(buffer,len))
return stbi_bmp_load_from_memory(buffer,len,x,y,comp,req_comp);
if (stbi_psd_test_memory(buffer,len))
return stbi_psd_load_from_memory(buffer,len,x,y,comp,req_comp);
#ifndef STBI_NO_DDS
if (stbi_dds_test_memory(buffer,len))
return stbi_dds_load_from_memory(buffer,len,x,y,comp,req_comp);
#endif
#ifndef STBI_NO_HDR
if (stbi_hdr_test_memory(buffer, len)) {
float *hdr = stbi_hdr_loa
没有合适的资源?快使用搜索试试~ 我知道了~
计算机图形学——opengl实现fbx模型导入
共708个文件
hpp:287个
inl:232个
h:57个
需积分: 5 28 下载量 73 浏览量
2022-03-08
18:15:29
上传
评论
收藏 227.35MB ZIP 举报
温馨提示
opengl实现fbx模型导入,有UV贴图
资源详情
资源评论
资源推荐
收起资源包目录
计算机图形学——opengl实现fbx模型导入 (708个子文件)
stb_image_aug.c 111KB
SOIL.c 55KB
image_DXT.c 16KB
image_helper.c 10KB
glm.cpp 9KB
glm.cpp 8KB
main.cpp 7KB
Test.cpp 7KB
dummy.cpp 7KB
dummy.cpp 5KB
stdafx.cpp 310B
Camera.cpp 46B
Test.VC.db 77.95MB
Browse.VC.db 46.65MB
Browse.VC.db 37.02MB
assimp.dll 2.93MB
glew32d.dll 564KB
freeglutd.dll 346KB
glut32.dll 215KB
test.new.obj.enc 124KB
Test.exe 312KB
Test.vcxproj.filters 2KB
fragShader.frag 179B
glew.h 1.15MB
stb_image.h 248KB
eglew.h 104KB
glxew.h 73KB
wglew.h 63KB
material.h 52KB
matrix.h 39KB
config.h 37KB
postprocess.h 30KB
glut.h 27KB
freeglut_std.h 26KB
pstdint.h 25KB
mesh.h 24KB
cimport.h 22KB
stb_image_aug.h 16KB
types.h 15KB
stbi_DDS_aug_c.h 15KB
SOIL.h 15KB
anim.h 14KB
scene.h 14KB
platform.h 13KB
cexport.h 12KB
freeglut_ext.h 10KB
defs.h 10KB
matrix4x4.h 9KB
light.h 8KB
camera.h 8KB
common.h 7KB
texture.h 7KB
metadata.h 7KB
matrix3x3.h 7KB
model.h 6KB
importerdesc.h 6KB
cfileio.h 5KB
vector3.h 5KB
quaternion.h 5KB
version.h 4KB
color4.h 4KB
geometric.h 4KB
vector2.h 4KB
integer.h 4KB
mesh.h 3KB
image_DXT.h 3KB
Camera.h 3KB
Shader.h 2KB
image_helper.h 2KB
pushpack1.h 2KB
poppack1.h 1KB
stdafx.h 1KB
stbi_DDS_aug.h 797B
freeglut.h 681B
ai_assert.h 628B
targetver.h 370B
exponential.h 365B
vector_relational.h 139B
trigonometric.h 136B
packing.h 129B
fwd.hpp 80KB
fwd.hpp 78KB
vec_swizzle.hpp 74KB
_swizzle_func.hpp 63KB
_swizzle.hpp 54KB
_swizzle.hpp 48KB
matrix_transform.hpp 44KB
type_mat.hpp 41KB
type_mat.hpp 40KB
setup.hpp 36KB
packing.hpp 35KB
type_aligned.hpp 34KB
_swizzle_func.hpp 34KB
type_aligned.hpp 33KB
setup.hpp 29KB
Importer.hpp 29KB
type_aligned.hpp 27KB
common.hpp 27KB
type_vec.hpp 26KB
type_vec.hpp 26KB
共 708 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
平杨猪
- 粉丝: 1w+
- 资源: 20
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0