mirror of
https://github.com/raysan5/raylib.git
synced 2026-02-08 07:09:18 -05:00
Compare commits
3 Commits
e7bd177826
...
43bc00379c
| Author | SHA1 | Date | |
|---|---|---|---|
| 43bc00379c | |||
| ba798e9155 | |||
| 121c996c6e |
10
src/external/rl_gputex.h
vendored
10
src/external/rl_gputex.h
vendored
@ -585,7 +585,7 @@ int rl_save_ktx(const char *file_name, void *data, int width, int height, int fo
|
|||||||
// KTX 2.0: UInt32 supercompressionScheme - 0 (None), 1 (Crunch CRN), 2 (Zlib DEFLATE)...
|
// KTX 2.0: UInt32 supercompressionScheme - 0 (None), 1 (Crunch CRN), 2 (Zlib DEFLATE)...
|
||||||
// KTX 2.0 defines additional header elements...
|
// KTX 2.0 defines additional header elements...
|
||||||
} ktx_header;
|
} ktx_header;
|
||||||
|
|
||||||
Byte[12] identifier
|
Byte[12] identifier
|
||||||
UInt32 vkFormat
|
UInt32 vkFormat
|
||||||
UInt32 typeSize
|
UInt32 typeSize
|
||||||
@ -632,10 +632,10 @@ int rl_save_ktx(const char *file_name, void *data, int width, int height, int fo
|
|||||||
header.faces = 1;
|
header.faces = 1;
|
||||||
header.mipmap_levels = mipmaps; // If it was 0, it means mipmaps should be generated on loading (not for compressed formats)
|
header.mipmap_levels = mipmaps; // If it was 0, it means mipmaps should be generated on loading (not for compressed formats)
|
||||||
header.key_value_data_size = 0; // No extra data after the header
|
header.key_value_data_size = 0; // No extra data after the header
|
||||||
|
|
||||||
// TODO: WARNING: Function dependant on rlgl library!
|
// TODO: WARNING: Function dependant on rlgl library!
|
||||||
rlGetGlTextureFormats(format, &header.gl_internal_format, &header.gl_format, &header.gl_type); // rlgl module function
|
rlGetGlTextureFormats(format, &header.gl_internal_format, &header.gl_format, &header.gl_type); // rlgl module function
|
||||||
|
|
||||||
header.gl_base_internal_format = header.gl_format; // TODO: WARNING: KTX 1.1 only
|
header.gl_base_internal_format = header.gl_format; // TODO: WARNING: KTX 1.1 only
|
||||||
|
|
||||||
// NOTE: We can save into a .ktx all PixelFormats supported by raylib, including compressed formats like DXT, ETC or ASTC
|
// NOTE: We can save into a .ktx all PixelFormats supported by raylib, including compressed formats like DXT, ETC or ASTC
|
||||||
@ -947,7 +947,7 @@ void get_gl_texture_formats(int format, unsigned int *gl_internal_format, unsign
|
|||||||
{
|
{
|
||||||
// KTX 1.1 uses OpenGL formats on header info but KTX 2.0 uses Vulkan texture formats,
|
// KTX 1.1 uses OpenGL formats on header info but KTX 2.0 uses Vulkan texture formats,
|
||||||
// if this library is being improved to support KTX 2.0, it requires those formats to be provided -> View list at the end!
|
// if this library is being improved to support KTX 2.0, it requires those formats to be provided -> View list at the end!
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*gl_internal_format = 0;
|
*gl_internal_format = 0;
|
||||||
*gl_format = 0;
|
*gl_format = 0;
|
||||||
@ -1023,7 +1023,7 @@ void get_gl_texture_formats(int format, unsigned int *gl_internal_format, unsign
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
// OpenGL texture data formats
|
// OpenGL texture data formats
|
||||||
// NOTE: Those values can be useful for KTX 1.1 saving,
|
// NOTE: Those values can be useful for KTX 1.1 saving,
|
||||||
// probably only the latest OpenGL ones, not the extensions ones
|
// probably only the latest OpenGL ones, not the extensions ones
|
||||||
// So, there is no need to include full OpenGL headers
|
// So, there is no need to include full OpenGL headers
|
||||||
#define GL_UNSIGNED_BYTE 0x1401
|
#define GL_UNSIGNED_BYTE 0x1401
|
||||||
|
|||||||
@ -4473,9 +4473,17 @@ static Model LoadOBJ(const char *fileName)
|
|||||||
|
|
||||||
for (int i = 0; i < 3; i++) model.meshes[meshIndex].vertices[localMeshVertexCount*3 + i] = objAttributes.vertices[vertIndex*3 + i];
|
for (int i = 0; i < 3; i++) model.meshes[meshIndex].vertices[localMeshVertexCount*3 + i] = objAttributes.vertices[vertIndex*3 + i];
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++) model.meshes[meshIndex].normals[localMeshVertexCount*3 + i] = objAttributes.normals[normalIndex*3 + i];
|
|
||||||
|
|
||||||
for (int i = 0; i < 2; i++) model.meshes[meshIndex].texcoords[localMeshVertexCount*2 + i] = objAttributes.texcoords[texcordIndex*2 + i];
|
for (int i = 0; i < 2; i++) model.meshes[meshIndex].texcoords[localMeshVertexCount*2 + i] = objAttributes.texcoords[texcordIndex*2 + i];
|
||||||
|
if (objAttributes.normals != NULL && normalIndex != TINYOBJ_INVALID_INDEX && normalIndex >= 0)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 3; i++) model.meshes[meshIndex].normals[localMeshVertexCount*3 + i] = objAttributes.normals[normalIndex*3 + i];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
model.meshes[meshIndex].normals[localMeshVertexCount*3 + 0] = 0.0f;
|
||||||
|
model.meshes[meshIndex].normals[localMeshVertexCount*3 + 1] = 1.0f;
|
||||||
|
model.meshes[meshIndex].normals[localMeshVertexCount*3 + 2] = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
model.meshes[meshIndex].texcoords[localMeshVertexCount*2 + 1] = 1.0f - model.meshes[meshIndex].texcoords[localMeshVertexCount*2 + 1];
|
model.meshes[meshIndex].texcoords[localMeshVertexCount*2 + 1] = 1.0f - model.meshes[meshIndex].texcoords[localMeshVertexCount*2 + 1];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user