* Added helper function for easy pipeline vertex input state create info structure setup from glTF model vertex class * Split glTF loader into header and implementation * Updated sample to use glTF * Removed collada files Replaced assets are now part of the asset pack * Return value for glTF model vertex input state create info helper * Removed unused assets * Use glTF assets * Added default material for glTF node's without materials * Use glTF assets * Apply pre-transforms to normals * Use glTF assets * Use glTF assets * Use vertex input state from glTF model class * Scene setup * Use glTF assets * Use glTF assets * Display error message and exit if glTF file could not be loaded * Use glTF assets * Use glTF assets * Use glTF assets * Remove unused buffer binds * Use glTF assets * Remove no longer used model files * Remove no longer used model files * Added support for rendering glTF models with images * glTF model normal pre-transform ignores translation * Use glTF assets * Use glTF assets * Use glTF assets * Use glTF assets * Use glTF assets * Only add combined image samplers to pool if actually used in the scene * Use global descriptor set layouts * Use global descriptor set layouts * Use glTF assets * Use glTF assets * Use glTF assets Code cleanup Updated GLSL and HLSL shaders * Use glTF assets Code cleanup * Use glTF assets Code cleanup Updated GLSL and HLSL shaders * Remove no-longer used model * Use glTF assets Code cleanup Updated GLSL and HLSL shaders * Use glTF assets Code cleanup Updated GLSL and HLSL shaders Removed no-longer used model * Use glTF assets Code cleanup Use RGBA texture instead of different compressed formats Removed no-longer used assets * Adnrdoid build file * Use glTF assets Code cleanup and refactoring Updated GLSL and HLSL shaders * Added vertex count and way of passing additional memory property type flags to glTF loader * Use glTF assets Updated GLSL and HLSL shaders Removed no-longer used assets * Use glTF assets Updated GLSL and HLSL shaders * Remove unfinished sample * Completely reworked push constants sample Use glTF assets Updated GLSL and HLSL shaders Removed no-longer used assets * Android CMake build files * Removed un-used asset * Explicit buffer binding function * Use glTF assets Code cleanup Updated GLSL and HLSL shaders * Use glTF assets Code cleanup * Use glTF assets Code cleanup Removed no-longer used assets * Use glTF assets Code cleanup Updated GLSL and HLSL shaders Removed no-longer used assets * Remove no-longer used asset * Use glTF assets Code cleanup and refactoring Performance optimizations Updated GLSL and HLSL shaders Removed no-longer used assets * Use glTF assets Code cleanup and refactoring Updated GLSL and HLSL shaders Removed no-longer used assets * Use glTF assets Code cleanup and refactoring Updated GLSL and HLSL shaders Removed no-longer used assets * Use glTF assets Code cleanup and refactoring Removed no-longer used assets * Use glTF assets Code cleanup and refactoring Removed no-longer used assets * Use glTF assets Code cleanup and refactoring * Use glTF assets Code cleanup and refactoring * Use glTF assets Code cleanup and refactoring Removed no-longer used assets * Pass vertex size and calculate multiplier in shaders instead of hard-coding With this, changes to the glTF vertex structure won't break the ray tracing samples * Load tangents (if present) * Use glTF assets Code cleanup and heavy refactoring Reworked debug display code * Android build * Normal mapping fixes Udpated HLSL shaders * Use glTF assets Code cleanup and heavy refactoring Reworked debug display code Updated GLSL and HLSL shaders * Code cleanup, comments * Use glTF assets Code cleanup and heavy refactoring Reworked debug display code Updated GLSL and HLSL shaders * Added sample count to framebuffer create info * Removed no-longer used assets * Android build Removed no-longer used assets * Code cleanup and heavy refactoring Updated GLSL and HLSL shaders Use tangents stored in GLSL instead of calculating them in the fragment shader * Renamed textured PBR sample main cpp file * Use glTF assets Code cleanup and refactoring Updated GLSL and HLSL shaders Removed no-longer used assets * Use glTF assets Removed no-longer used assets * Android build files * Android build files * Use glTF assets Removed no-longer used assets * Fixed HLSL shaders * Android build files * Use glTF assets Updated GLSL and HLSL shaders Removed no-longer used assets * Use glTF assets Updated GLSL and HLSL shaders Removed no-longer used assets * Added flag to disable glTF image loading Useful for samples that use their own textures or don't use textures at all to speed up loading * Use glTF assets Code cleanup Use Sponza scene instead of Sibenik to better highlight the effect Updated GLSL and HLSL shaders * Updated Android build files * Removed left-over comment * Use Sponza scene for the SSAO sample * Removed unused code * Removed ASSIMP No longer required as all samples now use the glTF file format * Added missing vertex shader stage * Removed old ASSIMP-based model loader * Added support for loading external glTF images from ktx Android fixes for loading external buffer files * Scene setup * Added missing shader stages * Removed ASSIMP from build files * Fixed compiler warning * Removed ASSIMP from readmes * Android build files cleanup * Replaced ktx submodule with only the files required for this repo The ktx submodule was a tad too big and contained lots of files not required for this repo * Moved ktx build files into base project * Use glTF assets * Use glTF assets * Removed license files, will be moved to asset pack * Use RGBA textures * Use RGBA cubemp texture with face assignment based on original images Refs #679 * Android build files * Removed textures All textures will be moved to the asset pack * Ignore asset folders * Removed font Fonts will be moved to the asset pack * Link to gltf asset pack * Updated gitignore * Android build file
205 lines
6 KiB
C
205 lines
6 KiB
C
/* -*- tab-width: 4; -*- */
|
|
/* vi: set sw=2 ts=4 expandtab: */
|
|
|
|
/* $Id: 3dd768b381113d67ca7e4bde10e6252900bff845 $ */
|
|
|
|
/*
|
|
* Copyright (c) 2010-2018 The Khronos Group Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
|
|
/*
|
|
* Author: Mark Callow from original code by Georg Kolling
|
|
*/
|
|
|
|
#ifndef KTXINT_H
|
|
#define KTXINT_H
|
|
|
|
/* Define this to include the ETC unpack software in the library. */
|
|
#ifndef SUPPORT_SOFTWARE_ETC_UNPACK
|
|
/* Include for all GL versions because have seen OpenGL ES 3
|
|
* implementaions that do not support ETC1 (ARM Mali emulator v1.0)!
|
|
*/
|
|
#define SUPPORT_SOFTWARE_ETC_UNPACK 1
|
|
#endif
|
|
|
|
#ifndef MAX
|
|
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
|
|
#endif
|
|
|
|
#define KTX2_IDENTIFIER_REF { 0xAB, 0x4B, 0x54, 0x58, 0x20, 0x32, 0x30, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A }
|
|
#define KTX2_HEADER_SIZE (64)
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/**
|
|
* @internal
|
|
* @brief used to pass GL context capabilites to subroutines.
|
|
*/
|
|
#define _KTX_NO_R16_FORMATS 0x0
|
|
#define _KTX_R16_FORMATS_NORM 0x1
|
|
#define _KTX_R16_FORMATS_SNORM 0x2
|
|
#define _KTX_ALL_R16_FORMATS (_KTX_R16_FORMATS_NORM | _KTX_R16_FORMATS_SNORM)
|
|
extern GLint _ktxR16Formats;
|
|
extern GLboolean _ktxSupportsSRGB;
|
|
|
|
/**
|
|
* @internal
|
|
* @~English
|
|
* @brief KTX file header
|
|
*
|
|
* See the KTX specification for descriptions
|
|
*/
|
|
typedef struct KTX_header {
|
|
ktx_uint8_t identifier[12];
|
|
ktx_uint32_t endianness;
|
|
ktx_uint32_t glType;
|
|
ktx_uint32_t glTypeSize;
|
|
ktx_uint32_t glFormat;
|
|
ktx_uint32_t glInternalformat;
|
|
ktx_uint32_t glBaseInternalformat;
|
|
ktx_uint32_t pixelWidth;
|
|
ktx_uint32_t pixelHeight;
|
|
ktx_uint32_t pixelDepth;
|
|
ktx_uint32_t numberOfArrayElements;
|
|
ktx_uint32_t numberOfFaces;
|
|
ktx_uint32_t numberOfMipmapLevels;
|
|
ktx_uint32_t bytesOfKeyValueData;
|
|
} KTX_header;
|
|
|
|
/* This will cause compilation to fail if the struct size doesn't match */
|
|
typedef int KTX_header_SIZE_ASSERT [sizeof(KTX_header) == KTX_HEADER_SIZE];
|
|
|
|
/**
|
|
* @internal
|
|
* @~English
|
|
* @brief Structure for supplemental information about the texture.
|
|
*
|
|
* _ktxCheckHeader returns supplemental information about the texture in this
|
|
* structure that is derived during checking of the file header.
|
|
*/
|
|
typedef struct KTX_supplemental_info
|
|
{
|
|
ktx_uint8_t compressed;
|
|
ktx_uint8_t generateMipmaps;
|
|
ktx_uint16_t textureDimension;
|
|
} KTX_supplemental_info;
|
|
/**
|
|
* @internal
|
|
* @var ktx_uint8_t KTX_supplemental_info::compressed
|
|
* @~English
|
|
* @brief KTX_TRUE, if this a compressed texture, KTX_FALSE otherwise?
|
|
*/
|
|
/**
|
|
* @internal
|
|
* @var ktx_uint8_t KTX_supplemental_info::generateMipmaps
|
|
* @~English
|
|
* @brief KTX_TRUE, if mipmap generation is required, KTX_FALSE otherwise.
|
|
*/
|
|
/**
|
|
* @internal
|
|
* @var ktx_uint16_t KTX_supplemental_info::textureDimension
|
|
* @~English
|
|
* @brief The number of dimensions, 1, 2 or 3, of data in the texture image.
|
|
*/
|
|
|
|
/*
|
|
* @internal
|
|
* CheckHeader
|
|
*
|
|
* Reads the KTX file header and performs some sanity checking on the values
|
|
*/
|
|
KTX_error_code _ktxCheckHeader(KTX_header* pHeader,
|
|
KTX_supplemental_info* pSuppInfo);
|
|
|
|
/*
|
|
* SwapEndian16: Swaps endianness in an array of 16-bit values
|
|
*/
|
|
void _ktxSwapEndian16(ktx_uint16_t* pData16, int count);
|
|
|
|
/*
|
|
* SwapEndian32: Swaps endianness in an array of 32-bit values
|
|
*/
|
|
void _ktxSwapEndian32(ktx_uint32_t* pData32, int count);
|
|
|
|
/*
|
|
* UnpackETC: uncompresses an ETC compressed texture image
|
|
*/
|
|
KTX_error_code _ktxUnpackETC(const GLubyte* srcETC, const GLenum srcFormat,
|
|
ktx_uint32_t active_width, ktx_uint32_t active_height,
|
|
GLubyte** dstImage,
|
|
GLenum* format, GLenum* internalFormat, GLenum* type,
|
|
GLint R16Formats, GLboolean supportsSRGB);
|
|
|
|
/*
|
|
* Pad nbytes to next multiple of n
|
|
*/
|
|
/* Equivalent to n * ceil(nbytes / n) */
|
|
#define _KTX_PADN(n, nbytes) (nbytes + (n-1) & ~(ktx_uint32_t)(n-1))
|
|
/*
|
|
* Calculate bytes of of padding needed to reach next multiple of n.
|
|
*/
|
|
/* Equivalent to (n * ceil(nbytes / n)) - nbytes */
|
|
#define _KTX_PADN_LEN(n, nbytes) ((n-1) - (nbytes + (n-1) & (n-1)))
|
|
|
|
/*
|
|
* Pad nbytes to next multiple of 4
|
|
*/
|
|
#define _KTX_PAD4(nbytes) _KTX_PADN(4, nbytes)
|
|
/*
|
|
* Calculate bytes of of padding needed to reach next multiple of 4.
|
|
*/
|
|
#define _KTX_PAD4_LEN(nbytes) _KTX_PADN_LEN(4, nbytes)
|
|
|
|
/*
|
|
* Pad nbytes to KTX_GL_UNPACK_ALIGNMENT
|
|
*/
|
|
#define _KTX_PAD_UNPACK_ALIGN(nbytes) \
|
|
_KTX_PADN(KTX_GL_UNPACK_ALIGNMENT, nbytes)
|
|
/*
|
|
* Calculate bytes of of padding needed to reach KTX_GL_UNPACK_ALIGNMENT.
|
|
*/
|
|
#define _KTX_PAD_UNPACK_ALIGN_LEN(nbytes) \
|
|
_KTX_PADN_LEN(KTX_GL_UNPACK_ALIGNMENT, nbytes)
|
|
|
|
/*
|
|
======================================
|
|
Internal ktxTexture functions
|
|
======================================
|
|
*/
|
|
|
|
KTX_error_code
|
|
ktxTexture_iterateLoadedImages(ktxTexture* This, PFNKTXITERCB iterCb,
|
|
void* userdata);
|
|
KTX_error_code
|
|
ktxTexture_iterateSourceImages(ktxTexture* This, PFNKTXITERCB iterCb,
|
|
void* userdata);
|
|
|
|
ktx_uint32_t ktxTexture_glTypeSize(ktxTexture* This);
|
|
ktx_size_t ktxTexture_imageSize(ktxTexture* This, ktx_uint32_t level);
|
|
ktx_bool_t ktxTexture_isActiveStream(ktxTexture* This);
|
|
ktx_size_t ktxTexture_levelSize(ktxTexture* This, ktx_uint32_t level);
|
|
ktx_size_t ktxTexture_faceLodSize(ktxTexture* This, ktx_uint32_t level);
|
|
void ktxTexture_rowInfo(ktxTexture* This, ktx_uint32_t level,
|
|
ktx_uint32_t* numRows, ktx_uint32_t* rowBytes,
|
|
ktx_uint32_t* rowPadding);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* KTXINT_H */
|